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

Update code example for Instantiation to Bound Algorithm #2679

Closed
jmewes opened this issue Dec 2, 2022 · 1 comment
Closed

Update code example for Instantiation to Bound Algorithm #2679

jmewes opened this issue Dec 2, 2022 · 1 comment
Labels
bug There is a mistake in the language specification or in an active document

Comments

@jmewes
Copy link
Contributor

jmewes commented Dec 2, 2022

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.

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.

@jmewes jmewes added the bug There is a mistake in the language specification or in an active document label Dec 2, 2022
eernstg added a commit that referenced this issue Dec 2, 2022
eernstg added a commit that referenced this issue Dec 2, 2022
@eernstg
Copy link
Member

eernstg commented Dec 2, 2022

Good catch, thanks! Handled in 8f1fd57.

@eernstg eernstg closed this as completed Dec 2, 2022
eernstg added a commit that referenced this issue Dec 9, 2022
eernstg added a commit that referenced this issue Dec 15, 2022
eernstg added a commit that referenced this issue Jan 13, 2023
eernstg added a commit that referenced this issue Feb 2, 2023
eernstg added a commit that referenced this issue Apr 19, 2023
eernstg added a commit that referenced this issue May 31, 2023
eernstg added a commit that referenced this issue Jun 13, 2023
eernstg added a commit that referenced this issue Jul 6, 2023
eernstg added a commit that referenced this issue Jul 18, 2023
eernstg added a commit that referenced this issue Jul 19, 2023
eernstg added a commit that referenced this issue Aug 8, 2023
eernstg added a commit that referenced this issue Sep 11, 2023
eernstg added a commit that referenced this issue Sep 29, 2023
eernstg added a commit that referenced this issue Oct 9, 2023
eernstg added a commit that referenced this issue Oct 9, 2023
eernstg added a commit that referenced this issue Oct 25, 2023
eernstg added a commit that referenced this issue Nov 30, 2023
eernstg added a commit that referenced this issue Dec 18, 2023
eernstg added a commit that referenced this issue Feb 9, 2024
eernstg added a commit that referenced this issue Feb 22, 2024
eernstg added a commit that referenced this issue Apr 30, 2024
eernstg added a commit that referenced this issue May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug There is a mistake in the language specification or in an active document
Projects
None yet
Development

No branches or pull requests

2 participants