@@ -232,7 +232,7 @@ class C(A[None]):
232232 # N: def f(self, s: int) -> int
233233[builtins fixtures/tuple.pyi]
234234
235- [case testSelfTypeOverrideCompatibilityTypeVar-xfail ]
235+ [case testSelfTypeOverrideCompatibilityTypeVar]
236236from typing import overload, TypeVar, Union
237237
238238AT = TypeVar("AT", bound="A")
@@ -266,6 +266,26 @@ class B(A):
266266 def f(*a, **kw): ...
267267[builtins fixtures/dict.pyi]
268268
269+ [case testSelfTypeOverrideCompatibilitySelfTypeVar]
270+ from typing import Any, Generic, Self, TypeVar, overload
271+
272+ T_co = TypeVar('T_co', covariant=True)
273+
274+ class Config(Generic[T_co]):
275+ @overload
276+ def get(self, instance: None) -> Self: ...
277+ @overload
278+ def get(self, instance: Any) -> T_co: ...
279+ def get(self, *a, **kw): ...
280+
281+ class MultiConfig(Config[T_co]):
282+ @overload
283+ def get(self, instance: None) -> Self: ...
284+ @overload
285+ def get(self, instance: Any) -> T_co: ...
286+ def get(self, *a, **kw): ...
287+ [builtins fixtures/dict.pyi]
288+
269289[case testSelfTypeSuper]
270290from typing import TypeVar, cast
271291
0 commit comments