Skip to content

Field-less mixins should be allowed for const constructors. #28492

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

Closed
johnniwinther opened this issue Jan 24, 2017 · 2 comments
Closed

Field-less mixins should be allowed for const constructors. #28492

johnniwinther opened this issue Jan 24, 2017 · 2 comments
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). type-enhancement A request for a change that isn't a bug

Comments

@johnniwinther
Copy link
Member

Const constructors should be allowed if mixed-in classes have no fields:

class Super {}
class Mixin {}
class Class extends Super with Mixin {
  const Class(); // This is currently not allowed.
}
@johnniwinther johnniwinther added the area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). label Jan 24, 2017
@lrhn
Copy link
Member

lrhn commented Jan 24, 2017

See also #9745

General constructor support isn't forthcoming, so maybe just allowing constructor forwarding to be const in the case where the superclass constructor is const and the mixin has no instance variables, will go a long way.

@lrhn lrhn added the type-enhancement A request for a change that isn't a bug label Jan 24, 2017
@eernstg
Copy link
Member

eernstg commented Feb 19, 2018

Closing: As of 63c6851, constructor forwarding does just that. Created #32223 to put this into the implementation pipeline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

3 participants