File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3177,14 +3177,14 @@ class B: ...
31773177
31783178T = TypeVar("T")
31793179
3180- def bad1 (self, obj: T) -> T:
3180+ def forgets_about_subclasses1 (self, obj: T) -> T:
31813181 if isinstance(obj, A):
31823182 return A() # E: Incompatible return value type (got "A", expected "T")
31833183 elif isinstance(obj, B):
31843184 return B() # E: Incompatible return value type (got "B", expected "T")
31853185 raise
31863186
3187- def f1 (self, obj: T) -> T:
3187+ def correct1 (self, obj: T) -> T:
31883188 if type(obj) == A:
31893189 return A() # E: Incompatible return value type (got "A", expected "T")
31903190 elif type(obj) == B:
@@ -3193,14 +3193,14 @@ def f1(self, obj: T) -> T:
31933193
31943194T_value = TypeVar("T_value", A, B)
31953195
3196- def bad2 (self, obj: T_value) -> T_value:
3196+ def forgets_about_subclasses2 (self, obj: T_value) -> T_value:
31973197 if isinstance(obj, A):
31983198 return A() # E: Incompatible return value type (got "A", expected "B")
31993199 elif isinstance(obj, B):
32003200 return B()
32013201 raise
32023202
3203- def f2 (self, obj: T_value) -> T_value:
3203+ def correct2 (self, obj: T_value) -> T_value:
32043204 if type(obj) == A:
32053205 return A()
32063206 elif type(obj) == B:
You can’t perform that action at this time.
0 commit comments