-
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 constructor can redirect to non-const constructor #23622
Comments
I just stumped Gilad with this. There is no discussion of this in the spec. The spec should state that the redirection target must be const, just as the super initializer of a constant constructor must be a constant constructor. |
No milestone now: This clarification needs to be performed, but it will not block Dart 2. |
The language specification does specify that the redirectee must be const as well, as of 715d597. Given that the specification issue has been resolved I would close this issue. But I just checked that the given example is still accepted by the analyzer as well as the vm without errors, and dart2js crashes, so I'll relabel this issue instead. At this time it might well turn out to be an issue for the front end only, so I won't create a meta-bug and several more specific bugs. |
/cc @kmillikin |
We now get this error:
but technically still produce this class:
so some error recovery might be needed (e.g. remove the const from the redirecting constructor, or make its initializer invalid-initializer or whatnot). |
Splitting out the analyzer side of this into #27617. |
This program should fail, but prints:
Instance of 'A'
The text was updated successfully, but these errors were encountered: