Skip to content

Extend invalid-method-override diagnostics to cover methods being overridden by non-methods #2156

@AlexWaygood

Description

@AlexWaygood

We have a basic implementation of the Liskov Substitution Principle in place for method overrides. But we do not currently emit diagnostics for methods invalidly overridden by non-methods. We need to implement this.

This should include methods being overridden by definitions in the class body:

class A:
	def f(self) -> None: ...

class B(A):
	f = None

It should include methods overridden by declarations in the class body:

class A:
	def f(self) -> None: ...

class B(A):
	f: int

and it should include methods overridden by implicit instance attributes:

class A:
	def f(self): ...

class B(A):
	def __init__(self) -> None:
        self.f = 42

We may want to fix #1345 before fixing this issue.

Metadata

Metadata

Assignees

Labels

typing semanticstyping-module features, spec compliance, etc

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions