-
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.dart-model-analyzer-specIssues with the analyzer's implementation of the language specIssues with the analyzer's implementation of the language specfeature-null-aware-elementsImplementation of the Null-aware elements featureImplementation of the Null-aware elements featuretype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)
Description
Example:
void main() {
const b = identical(1, 1.0);
const Object? v = b ? 0 : null;
const l1 = [?v]; // OK, a `?v` is a constant expression.
const l2 = [if (b) ?v]; // Not OK here?
const l3 = [if (b) v else ?v]; // Not OK here?
const s1 = {?v}; // Different bug!
const s2 = {if (b) ?v}; // Not OK here?
const s3 = {if (b) v else ?v}; // Not OK here?
}The ?v in l2, l3, s2 and s3 makes the analyzer say
The values in a const list literal must be constants.
It has no issue treating the same ?v element as constant outside of a conditional. The CFE accepts the program.
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.dart-model-analyzer-specIssues with the analyzer's implementation of the language specIssues with the analyzer's implementation of the language specfeature-null-aware-elementsImplementation of the Null-aware elements featureImplementation of the Null-aware elements featuretype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)