-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
area-dart-modelFor issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.For issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.model-discrepancyDiscrepancies between analyzer and cfeDiscrepancies between analyzer and cfetype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)
Description
Dart version: 3.11.0
Platform: macOS
The following code snippet that was previously working in Dart 3.10.8 does not compile on Dart 3.11.0.
class Parent {}
class Base implements Parent {}
extension type const MidA._(Parent _) implements Parent {}
extension type const A._(Base _) implements MidA, Base {}
extension type const MidB._(Parent _) implements Parent {}
extension type const B._(Base _) implements MidB, Base {}
void f(Set<Base> s) {}
void main() {
final Set<A> a = {};
final Set<B> b = {};
// OK
f({...a, ...b});
// Error: CFE infers Set<Object> while analyzer infers Set<Base>
final merged = {...a, ...b};
f(merged);
}Analyzer infers the correct type:

Error:
lib/src/theme/main.dart:24:5: Error: The argument type 'Set<Object>' can't be assigned to the parameter type 'Set<Base>'.
- 'Set' is from 'dart:core'.
- 'Object' is from 'dart:core'.
- 'Base' is from 'package:forui/src/theme/main.dart' ('lib/src/theme/main.dart').
f(merged);
^
Process finished with exit code 254
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-dart-modelFor issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.For issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.model-discrepancyDiscrepancies between analyzer and cfeDiscrepancies between analyzer and cfetype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)