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 error if function type alias type parameter does not match bounds #42436

Closed
iarkh opened this issue Jun 22, 2020 · 7 comments
Assignees
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues. front-end-missing-error

Comments

@iarkh
Copy link
Contributor

iarkh commented Jun 22, 2020

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:

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

Seems like dart should throw a compile error here too.

Sample output is:

$> dart test.dart

$> dartanalyzer test.dart
Analyzing test.dart...
  error - 'X' doesn't extend 'int'. - test.dart:2:57 - type_argument_not_matching_bounds
1 error found.
@keertip keertip added the area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. label Jun 22, 2020
@a-siva
Copy link
Contributor

a-siva commented Jun 22, 2020

/cc @crelier

@alexmarkov
Copy link
Contributor

This is probably a front-end issue if compile-time error is missing.
/cc @johnniwinther @stefantsov

@alexmarkov alexmarkov added area-front-end Use area-front-end for front end / CFE / kernel format related issues. front-end-missing-error and removed area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. labels Jun 22, 2020
@johnniwinther
Copy link
Member

Likely related to #41684

@eernstg
Copy link
Member

eernstg commented Jul 1, 2020

Given that the example does not contain any non-function type aliases (only a regular type alias), I think this issue should be removed from the non-function type alias epic.

@leafpetersen
Copy link
Member

@eernstg is this still an issue? it's independent, but perhaps we should fix as part of this release?

@chloestefantsova
Copy link
Contributor

This appears to be fixed some time ago. This is what I see at the current HEAD.

$ xcodebuild/ReleaseX64/dart /tmp/asdf.dart
/tmp/asdf.dart:2:36: Error: Type argument 'X' doesn't conform to the bound 'int' of the type variable 'X' on 'A'.
Try changing type arguments so that they conform to the bounds.
typedef AAlias<X extends String> = Function<Y extends A<X>> ();
                                   ^
/tmp/asdf.dart:1:9: Context: This is the type variable whose bound isn't conformed to.
class A<X extends int> {}
        ^

I'm closing the issue. Feel free to re-open if needed.

@eernstg
Copy link
Member

eernstg commented Feb 11, 2021

Thanks @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
Projects
None yet
Development

No branches or pull requests

8 participants