Skip to content

Commit

Permalink
Add testSelfTypeOverrideCompatibilitySelfTypeVar (not my work: take…
Browse files Browse the repository at this point in the history
…n from python#15045 for comparison)
  • Loading branch information
tyralla committed Apr 14, 2023
1 parent 6b1573f commit f1414f2
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test-data/unit/check-selftype.test
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,26 @@ class B(A):
def f(*a, **kw): ...
[builtins fixtures/dict.pyi]

[case testSelfTypeOverrideCompatibilitySelfTypeVar]
from typing import Any, Generic, Self, TypeVar, overload

T_co = TypeVar('T_co', covariant=True)

class Config(Generic[T_co]):
@overload
def get(self, instance: None) -> Self: ...
@overload
def get(self, instance: Any) -> T_co: ...
def get(self, *a, **kw): ...

class MultiConfig(Config[T_co]):
@overload
def get(self, instance: None) -> Self: ...
@overload
def get(self, instance: Any) -> T_co: ...
def get(self, *a, **kw): ...
[builtins fixtures/dict.pyi]

[case testSelfTypeSuper]
from typing import TypeVar, cast

Expand Down

0 comments on commit f1414f2

Please sign in to comment.