Skip to content

In front end, do not relax override rules when overridden parameter is covariant #31596

Closed
@stereotype441

Description

@stereotype441

Consider the following code:

class A {}
class B extends A {}
class C {
  void f(B x, B y) {}
}
abstract class I1 {
  void f(covariant A x, B y);
}
class D extends C implements I1 {}

As pointed out in #31580 (comment), the class D should be rejected at compile time because its implementation of f has type void Function(B, B), which is not a valid override type for the member type of f in the interface of D, void Function(covariant A, B).

I have not yet implemented the override checking rules in the front end (I will soon). This bug serves as a reminder that the case above should result in an error.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions