You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This proposal is non-breaking and backwards compatible. Where we introduce new syntactic ambiguities, we retain the current interpretation.
I don't think this is correct. If a class currently has an unnamed constructor and a named constructor named "new", what happens when it upgrades to the constructor tearoff language feature? This presumably will not be allowed with the constructor tearoffs language feature.
The spec does not specify any errors when a class declares an unnamed constructor and a constructor named new.
The spec does not specify any errors when a class declares a static method, getter, setter, or field named new. Should there be? Can an extension on a class declare a static method (or getter or setter) named new? (This seems OK) Can a mixin? Can they only not declare these in a class with an unnamed constructor?
The answers to these questions may encourage some new compile-time warnings ahead of the language feature, and I'd love to know if we should be implementing these ASAP.
The text was updated successfully, but these errors were encountered:
srawlins
added
the
bug
There is a mistake in the language specification or in an active document
label
May 21, 2021
3. The spec does not specify any errors when a class declares a static method, getter, setter, or field named new
Again, new is a keyword, so I believe errors here are specified (cc @eernstg ) and are certainly implemented. Do you have a case where we are not currently emitting an error?
I don't understand, new is currently a keyword, and so there can be no existing classes with such a named constructor.
Excellent.
Again, new is a keyword, so I believe errors here are specified (cc @eernstg ) and are certainly implemented. Do you have a case where we are not currently emitting an error?
Excellent. No I don't have any cases; looks like the correct error is being reported everywhere.
(I'm opening a new issue as this is an issue with the current spec; #1564 is a pretty long thread so I didn't want to rat-hole over there.)
https://github.com/dart-lang/language/blob/master/working/0216%20-%20constructor%20tearoffs/proposal.md
contains:
I don't think this is correct. If a class currently has an unnamed constructor and a named constructor named "new", what happens when it upgrades to the constructor tearoff language feature? This presumably will not be allowed with the constructor tearoffs language feature.
The spec does not specify any errors when a class declares an unnamed constructor and a constructor named
new
.The spec does not specify any errors when a class declares a static method, getter, setter, or field named
new
. Should there be?Can an extension on a class declare a static method (or getter or setter) named(This seems OK) Can a mixin? Can they only not declare these in a class with an unnamed constructor?new
?The answers to these questions may encourage some new compile-time warnings ahead of the language feature, and I'd love to know if we should be implementing these ASAP.
The text was updated successfully, but these errors were encountered: