diff --git a/mypy/checker.py b/mypy/checker.py index b343e644d590..1684278ca319 100644 --- a/mypy/checker.py +++ b/mypy/checker.py @@ -884,6 +884,8 @@ def check_method_override_for_base_with_name( name, base.name(), defn) + elif isinstance(original_type, AnyType): + pass else: self.msg.signature_incompatible_with_supertype( defn.name(), name, base.name(), defn) diff --git a/test-data/unit/check-functions.test b/test-data/unit/check-functions.test index 5fb89326ce8a..2996213c8209 100644 --- a/test-data/unit/check-functions.test +++ b/test-data/unit/check-functions.test @@ -147,6 +147,25 @@ ee_def = specific_1 # E: Incompatible types in assignment (expression has type C [builtins fixtures/dict.pyi] +[case testSubtypingFunctionsDecorated] +from typing import Any + +# untyped decorator +def deco(f): pass + +class A: + @deco + def f(self) -> Any: + pass + +class B(A): + @deco + def f(self) -> Any: + pass + +[builtins fixtures/list.pyi] + + [case testLackOfNames] def f(__a: int, __b: str) -> None: pass def g(a: int, b: str) -> None: pass