Skip to content

Bounds on generic methods should be treated invariantly in subtyping #29014

Closed
@leafpetersen

Description

Currently, the analyzer treats generic method bounds contra-variantly for sub-typing purposes. For example, the following is allowed:

class A {
  void foo<T extends num>() {}
}

class B extends A {
  void foo<T extends Object>() {}
}

Per language team decision, this should be changed to require that bounds be equal.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Labels

P2A bug or feature request we're likely to work onarea-analyzerUse area-analyzer for Dart analyzer issues, including the analysis server and code completion.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions