-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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-inferenceImplementation of type inferenceImplementation of type inferencesoundnesstype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)
Description
typedef CallbackA<T extends MyClassBase> = void Function(MyClassB<T> s);
abstract class MyClassBase{
}
class MyClassA<T> extends MyClassBase{
T value;
MyClassA({
required this.value,
List<CallbackA<MyClassA<T>>> callbacks = const [],
});
}
class MyClassB<T extends MyClassBase> {}
var a = MyClassA(
value: 1,
callbacks:[
(c /* MyClassB<MyClassA<Object?>> */){
}
] // List<void Function(MyClassB<MyClassA<int>>)>
);
var b = MyClassA<int>(
value: 1,
callbacks:[
(c /* MyClassB<MyClassA<int>> */){
}
] // List<void Function(MyClassB<MyClassA<int>>)>
);In scenario a, the callback parameter is inferred as Object?, even though the callbacks property has the correct type.
the correct type can be inferred if the generic type for MyClassA is explicitly declared.
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-inferenceImplementation of type inferenceImplementation of type inferencesoundnesstype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)