-
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
[parser/spec] initializerExpression inconsistency between the spec and implementation: the spec does not support some constructs supported by the implementation. #54271
Comments
This is something that we should just fix by changing the specification. https://dart-review.googlesource.com/340620 updates Dart.g. |
@eernstg The implementation does not support cascades with throw expressions in constructor initializer expressions. class Foo {
final a;
Foo() : throw 0..id;
}
|
@eernstg The proposed changes also add support for, e.g.: class Foo {
final a;
Foo() : a = a = () {};
} Which is rejected by the implementation:
|
This comment was marked as duplicate.
This comment was marked as duplicate.
The cascade issue is the topic of #54284. |
About this one: class Foo {
final a;
Foo() : a = a = () {};
} The proposed specification in dart-lang/language#3503 clearly needs to be refined. I'm asking for further information about how the parser actually works in #54284. When this has been clarified we should be in a better position to find a way to (1) write down what it does, and/or (2) ask for adjustments of the implemented behavior (in case it's not what we want). |
@eernst wrote in #51482 (comment)
Here's one failure:
sdk/pkg/_fe_analyzer_shared/test/flow_analysis/type_promotion/data/promotion_in_dead_code.dart
Lines 50 to 61 in 408e486
The spec does not appear to support throw expressions in constructor initializer expressions.
Throw expressions are supported by the implementation (actually,
throwExpressionWithoutCascade
), but not by the spec:Assignment expressions are also supported by the implementation (it even supports cascades), but not by the spec:
The spec also supports some expressions that the implementation does not support, see #11509 for that.
The text was updated successfully, but these errors were encountered: