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

Dart does not throw compile time error if bounds do not match for type argument of typedef function #36960

Open
iarkh opened this issue May 14, 2019 · 2 comments
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues. front-end-missing-error type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@iarkh
Copy link
Contributor

iarkh commented May 14, 2019

Dart SDK Version: 2.3.1-dev.0.0
OS: Windows 10 64 bit

The following code sample declares a typedef with type argument which does not match the bounds because [String] does not extend [num]:

class A<X extends num> {}
typedef F<Y extends String> = A<Y> Function();
main() {}

Analyzer expectedly throws a compile time error here whereas dart runs without any errors or warnings.

I believe dart should throw a error here too.

Sample output is:

$> dart test.dart

$> dartanalyzer test.dart
Analyzing test.dart...
error - 'Y' doesn't extend 'num' at test.dart:2:33 - type_argument_not_matching_bounds
1 error found.

@lrhn lrhn added area-front-end Use area-front-end for front end / CFE / kernel format related issues. front-end-missing-error type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels May 14, 2019
@eernstg
Copy link
Member

eernstg commented May 21, 2019

Yep.

@kmillikin
Copy link

/cc @stefantsov

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. front-end-missing-error type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

4 participants