Skip to content

Dart does not throw error if function type alias type parameter does not match bounds #42436

@iarkh

Description

@iarkh

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions