Closed
Description
This is the analyzer specific issue for the default parameter issue from #32415 .
Partial instantiations of generic methods are only const
objects if their type arguments are const
types. The analyzer should statically reject the following program, but currently doesn't.
dynamic _defaultCallback<T>(T t) => t;
class C<T> {
final dynamic Function(T) callback;
// Should be statically rejected
void foo([dynamic Function(T) f = _defaultCallback]) {}
// Should be statically rejected
const C({this.callback = _defaultCallback});
}
// Should be statically rejected
void bar<T>([dynamic Function(T) f = _defaultCallback]) {}
void main() {
print(new C<int>().callback);
}