-
Notifications
You must be signed in to change notification settings - Fork 227
Closed
Labels
bugThere is a mistake in the language specification or in an active documentThere is a mistake in the language specification or in an active documentspecification
Description
The grammar rules for instance fields are:
declaration ::= // other rules...
| 'covariant' 'late'? varOrType initializedIdentifierList
| 'late'? 'final' type? initializedIdentifierList
| 'late'? varOrType initializedIdentifierList
As far as I can tell, that prohibits:
class C {
covariant late final int x;
}The VM and analyzer accept this without error.
The corresponding rule for local variables and parameters is:
declaredIdentifier ::= 'covariant'? finalConstVarOrType identifier
finalConstVarOrType ::= 'late'? 'final' type?
| 'const' type?
| 'late'? varOrType
And that does let you get covariant late final, so it seems like this is likely a spec bug in declaration. (Though as far as I can tell it's never useful because you're either using declaredIdentifier for a local variable where covariant is prohibited or for a parameter where late is prohibited.)
Metadata
Metadata
Assignees
Labels
bugThere is a mistake in the language specification or in an active documentThere is a mistake in the language specification or in an active documentspecification