-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
P1A high priority bug; for example, a single project is unusable or has many test failuresA high priority bug; for example, a single project is unusable or has many test failuresdart-model-analyzer-specIssues with the analyzer's implementation of the language specIssues with the analyzer's implementation of the language speclegacy-area-analyzerUse area-devexp instead.Use area-devexp instead.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)
Description
I found one more case while enabling this feature in Flutter. In dart 2.17.0-263.0.dev the analyzer is unhappy with the code below (see errors in comments), but it executes fine on the VM. I believe the code is valid and the analyzer is complaining incorrectly.
class PopupMenuItem<T> {
const PopupMenuItem({
this.enabled = true,
});
final bool enabled;
}
class CheckedPopupMenuItem<T> extends PopupMenuItem<T> {
const CheckedPopupMenuItem({
super.enabled,
});
}
// 🔥 error: A value of type 'Null' can't be assigned to a parameter of type 'bool' in a const constructor. (const_constructor_param_type_mismatch at [test] lib/pure_dart.dart:17)
// 🔥 error: Evaluation of this constant expression throws an exception. (const_eval_throws_exception at [test] lib/pure_dart.dart:16)
final CheckedPopupMenuItem menuItemType = const CheckedPopupMenuItem<String>();
void main() {
print(menuItemType.enabled);
}Metadata
Metadata
Assignees
Labels
P1A high priority bug; for example, a single project is unusable or has many test failuresA high priority bug; for example, a single project is unusable or has many test failuresdart-model-analyzer-specIssues with the analyzer's implementation of the language specIssues with the analyzer's implementation of the language speclegacy-area-analyzerUse area-devexp instead.Use area-devexp instead.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)