-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Closed
Copy link
Labels
P2A bug or feature request we're likely to work onA bug or feature request we're likely to work onfront-end-missing-errorfront-end-requires-constant-evaluationIssue that can't be solved without evaluating compile-time constantsIssue that can't be solved without evaluating compile-time constantslegacy-area-front-endLegacy: Use area-dart-model instead.Legacy: Use area-dart-model instead.
Milestone
Description
This is the CFE 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 CFE 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);
}Metadata
Metadata
Assignees
Labels
P2A bug or feature request we're likely to work onA bug or feature request we're likely to work onfront-end-missing-errorfront-end-requires-constant-evaluationIssue that can't be solved without evaluating compile-time constantsIssue that can't be solved without evaluating compile-time constantslegacy-area-front-endLegacy: Use area-dart-model instead.Legacy: Use area-dart-model instead.