-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
P3A lower priority bug or feature requestA lower priority bug or feature requestanalyzer-constantsarea-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-const-evalImplementation of constant evaluation in analyzer/cfeImplementation of constant evaluation in analyzer/cfetype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)
Description
We don't know which value we will get, so it is fair to say that the value is unknown.
The implementation is relatively straightforward.
But it breaks a couple of language/ tests, e.g. language/type/constants_test/07, which can be reduced to:
const bool fromEnvironment =
const bool.fromEnvironment("foo", defaultValue: true);
void testSwitch(args) {
switch (args) {
case fromEnvironment ? const MyType() : Type: //# 07: compile-time error
}
}
class MyType implements Type {
const MyType();
bool operator ==(Object other) => identical(this, other);
}We stopped reporting the compile-time error, because the result of evaluating fromEnvironment ? const MyType() : Type is unknown, which does not implement operator ==.
Metadata
Metadata
Assignees
Labels
P3A lower priority bug or feature requestA lower priority bug or feature requestanalyzer-constantsarea-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-const-evalImplementation of constant evaluation in analyzer/cfeImplementation of constant evaluation in analyzer/cfetype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)