-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Dart does not throw error if function type alias type parameter bound type is not instantiated #42435
Comments
/cc @crelier |
Likely related to #41684 |
cc @eernstg |
The type So there's a missing check in the CFE for having simple bounds. The issue arises independently of the type alias: class A<X extends A<X>> {}
Function<X extends A>() f = throw 1;
main() {} This program is accepted by the CFE, even though |
Cf. our discussions earlier today: Reading the error specification again, it does actually apply for formal type parameters declared by any kind of entity (in particular, it applies for formal type parameters of a function declaration and of a function type). So there is no need to change the specification after all. |
Re-checking: This issue should remain open at this point, |
I'm working on a fix for that at https://dart-review.googlesource.com/c/sdk/+/193662. |
Dart VM version: 2.9.0-17.0.dev (dev) (Thu Jun 18 10:22:39 2020 +0200) on "windows_x64"
The following source code example passes with dart and throws a compile error with analyzer:
Seems like dart should throw a compile error here too.
Sample output is:
The text was updated successfully, but these errors were encountered: