Skip to content
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

Mixin applications should support const constructors. #35548

Closed
lrhn opened this issue Jan 3, 2019 · 2 comments

Comments

Projects
None yet
3 participants
@lrhn
Copy link
Member

commented Jan 3, 2019

The specification states that a mixin application of a mixin that contains no instance variable declarations will forward const constructors as const constructors.
The analyzer does not support this, instead it gives the error

Const constructor can't be declared for a class with a mixin that declares a field.

The front-end supports the feature, but the analyzer is preventing us from using it.
(See, e.g., this CL).

@scheglov scheglov self-assigned this Jan 7, 2019

@scheglov

This comment has been minimized.

Copy link
Contributor

commented Jan 7, 2019

I think that the CL you are referencing has errors reported by Analyzer because it has static fields.

The spec does not make distinction between instance and static fields.
It seems that static fields should not matter, but it is not specified explicitly.
image

I will prepare a CL to ignore static fields for the purpose of checking for this error.

@scheglov

This comment has been minimized.

Copy link
Contributor

commented Jan 7, 2019

dart-bot pushed a commit that referenced this issue Jan 7, 2019

Issue 35548. Don't report CONST_CONSTRUCTOR_WITH_MIXIN_WITH_FIELD whe…
…n mixin has a static field.

R=brianwilkerson@google.com

Bug: #35548
Change-Id: I46a2006574e31505a860a9e54640b643bb514ae7
Reviewed-on: https://dart-review.googlesource.com/c/88600
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>

@scheglov scheglov closed this Jan 7, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.