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

Comments

Projects
None yet
4 participants
@iarkh
Copy link

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.

@eernstg

This comment has been minimized.

Copy link
Member

commented May 21, 2019

@kmillikin

This comment has been minimized.

Copy link
Member

commented May 21, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.