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

Non-function type alias bounds checking is incomplete #42446

Closed
eernstg opened this issue Jun 23, 2020 · 2 comments
Closed

Non-function type alias bounds checking is incomplete #42446

eernstg opened this issue Jun 23, 2020 · 2 comments
Assignees
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues. language-nonfunction-type-aliases Issues related to non-function type aliases type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@eernstg
Copy link
Member

eernstg commented Jun 23, 2020

The following tests demonstrate that it is possible to create an instance using a type aliased denotation of a generative constructor where instantiation to bound causes the type arguments to violate the bounds, and no compile-time error is reported:

https://github.com/dart-lang/co19/blob/master/LanguageFeatures/Instantiate-to-bound/nonfunction_typedef/static/nonfunction_l1_t03.dart, https://github.com/dart-lang/co19/blob/master/LanguageFeatures/Instantiate-to-bound/nonfunction_typedef/static/nonfunction_l1_t04.dart, https://github.com/dart-lang/co19/blob/master/LanguageFeatures/Instantiate-to-bound/nonfunction_typedef/static/nonfunction_l2_t05.dart, https://github.com/dart-lang/co19/blob/master/LanguageFeatures/Instantiate-to-bound/nonfunction_typedef/static/nonfunction_l2_t06.dart, https://github.com/dart-lang/co19/blob/master/LanguageFeatures/Instantiate-to-bound/nonfunction_typedef/static/nonfunction_l2_t07.dart.

So we must add an extra check that these types are regular-bounded when they have been unaliased to the actual class type.

@eernstg eernstg added type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) area-front-end Use area-front-end for front end / CFE / kernel format related issues. language-nonfunction-type-aliases Issues related to non-function type aliases labels Jun 23, 2020
@johnniwinther
Copy link
Member

Likely related to #41684

@chloestefantsova chloestefantsova self-assigned this Feb 10, 2021
@chloestefantsova
Copy link
Contributor

I'm working on a fix at https://dart-review.googlesource.com/c/sdk/+/184270.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues. language-nonfunction-type-aliases Issues related to non-function type aliases type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

3 participants