Describe the bug
This describes some exotic bug/ not working like expected.
I was playing around with a decorator that might replace a method with a function, said replacement would report reportIncompatibleMethodOverride,
because the function is defined elsewhere and I did not fully type the signature the error is moved to the function definition and not where the method is:
Code or Screenshots
A mwe is:
from typing import Callable, TypeVar
_C = TypeVar("_C", bound=Callable[..., Any])
def replace_with(func: _C) -> Callable[..., _C]: # problem if this or decorator *only* returns _C
def decorator(foo) -> _C:
return func
return decorator
class A:
def foo(self, a: int, b: int) -> int: ...
def foo_like(likeA: Any, a: int, c: bool) -> int: ...
# <<<< Error is displayed here:
# Method "foo" overrides class "A" in an incompatible manner
# Parameter 3 name mismatch: base parameter is named "b", override parameter is named "c"
class B(A):
def bar(self):
self.foo(1, True)
@replace_with(foo_like)
def foo(_): ... # <-- would expect error here
VS Code extension or command-line
pyright 1.1.377; command line and in VS Code
This is as said pretty exotic, feel free to close as WontFix, I still wanted to report it.
Describe the bug This describes some exotic bug/ not working like expected. I was playing around with a decorator that might replace a method with a function, said replacement would report
reportIncompatibleMethodOverride
, because the function is defined elsewhere and I did not fully type the signature the error is moved to the function definition and not where the method is:Code or Screenshots
A mwe is:
VS Code extension or command-line pyright 1.1.377; command line and in VS Code
This is as said pretty exotic, feel free to close as WontFix, I still wanted to report it.