Skip to content

Dart does not throw error if function type alias type parameter bound type is not instantiated #42435

@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 A<X>> {}
typedef AAlias = Function<X extends A>();
main() {}

Seems like dart should throw a compile error here too.

Sample output is:

$> dart test.dart

$> dartanalyzer test.dart
Analyzing test.dart...
error - Type parameter bound types must be instantiated. - test.dart:2:37 - not_instantiated_bound
1 error found.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions