-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Const error when chaning method invocations #40644
Comments
Duplicate of dart-lang/language#542 (comment) |
I don't think this is a duplicate of #542, but it is similar. The reason this program does not compile is that The problem is not (as in #542) that the initializer refers to the new variable Rather, the problem is that const declarations really do not occur as part of the normal evaluation flow. For a local variable, we could perhaps find a way to split |
I assumed because of how constant evaluation is described in the linked issue, this would require the other |
I'm not sure if this is a bug or not, but it seems strange to me. The following program will fail to compile:
But
final Foo foo = const Foo()..resolve();
is ok, andconst Foo foo = const Foo(); foo.resolve();
are both ok. I would expect the compiler to desugar the failing version into the last version there.The text was updated successfully, but these errors were encountered: