Skip to content

CFE doesn't report bound errors on parameters of local functions #44476

@chloestefantsova

Description

@chloestefantsova

Consider the following code:

class A<X extends int> {}

foo(A<num> x) {
  bar(A<num> y) {}
}

When run with dart the error is reported for foo, but not for bar:

$ dart /tmp/asdf.dart
/tmp/asdf.dart:5:12: Error: Type argument 'num' 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.
foo(A<num> x) {
           ^
/tmp/asdf.dart:3:9: Context: This is the type variable whose bound isn't conformed to.
class A<X extends int> {}
        ^

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions