-
Notifications
You must be signed in to change notification settings - Fork 161
Labels
needs-discussionAn issue where it's not clear whether there is a bug or we are behaving as expected.An issue where it's not clear whether there is a bug or we are behaving as expected.typechecking
Description
Describe the Bug
descriptors can be unsafe:
class A:
pass
class B(A):
def __get__(self, *_) -> 1:
return 1
class C:
a: A = B()
C.a # static: A, runtime: 1
we can avoid this by reporting an error on the signature of __get__
: "__get__
s return type must be assignable to the super classes __get__
(defaulting to the type of the superclass in it's absense)"
the same applies to __set__
Sandbox Link
No response
(Only applicable for extension issues) IDE Information
No response
Hari-Oggy
Metadata
Metadata
Assignees
Labels
needs-discussionAn issue where it's not clear whether there is a bug or we are behaving as expected.An issue where it's not clear whether there is a bug or we are behaving as expected.typechecking