mypy icon indicating copy to clipboard operation
mypy copied to clipboard

(🎁) Error when `__get__` returns incompatible type

Open KotlinIsland opened this issue 1 year ago • 0 comments

class A: ...
class B(A):
    def __get__(self, i, o) -> int:
        return 1
class Something:
    a: A = B()
reveal_type(Something.a)  # Revealed type is "A"

actual value at runtime is int

KotlinIsland avatar Jun 11 '24 01:06 KotlinIsland