-
Notifications
You must be signed in to change notification settings - Fork 229
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 document
Description
Observed
In the Dart language specification there the following code example for the section "Generics > Instantiation to Bound > The Instantiation to Bound Algorithm":
typedef Inv<X> = X Function(X);
class B<Y extends num, Z extends Inv<Y>> {}
B b; // The raw B means B<num, Inv<num>>.(see 14efbe8/specification/dartLangSpec.tex#L8044-L8049)
This yields a not_initialized_non_nullable_variable error.
Expected
The variable b should have a nullable type, contain an instance of type B, or be declared within a function.
typedef Inv<X> = X Function(X);
class B<Y extends num, Z extends Inv<Y>> {
Y? y;
Z? z;
}
void main() {
B b = B();
assert(b.y is num?);
assert(b.z is Inv<num>?);
}Comment
In the example below there is a similar code snippet that shows an example for a compilation error. It might be useful to adapt this as well, so that it show the expected compilation error.
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 document
