@@ -1628,70 +1628,3 @@ match var:
1628
1628
case ("yes", b):
1629
1629
reveal_type(b) # N: Revealed type is "Union[builtins.int, builtins.str]"
1630
1630
[builtins fixtures/tuple.pyi]
1631
-
1632
- [case testMatchNamedAndKeywordsAreTheSame]
1633
- from typing import Generic, TypeVar, Union
1634
- from typing_extensions import Final
1635
- from dataclasses import dataclass
1636
-
1637
- T = TypeVar("T")
1638
-
1639
- class Regular:
1640
- x: str
1641
- y: int
1642
- __match_args__ = ("x",)
1643
- class ReveresedOrder:
1644
- x: int
1645
- y: str
1646
- __match_args__ = ("y",)
1647
- class GenericRegular(Generic[T]):
1648
- x: T
1649
- __match_args__ = ("x",)
1650
- class GenericWithFinal(Generic[T]):
1651
- x: T
1652
- __match_args__: Final = ("x",)
1653
- class RegularSubtype(GenericRegular[str]): ...
1654
-
1655
- @dataclass
1656
- class GenericDataclass(Generic[T]):
1657
- x: T
1658
-
1659
- input_arg: Union[
1660
- Regular,
1661
- ReveresedOrder,
1662
- GenericRegular[str],
1663
- GenericWithFinal[str],
1664
- RegularSubtype,
1665
- GenericDataclass[str],
1666
- ]
1667
-
1668
- # Positional:
1669
- match input_arg:
1670
- case Regular(a):
1671
- reveal_type(a) # N: Revealed type is "builtins.str"
1672
- case ReveresedOrder(a):
1673
- reveal_type(a) # N: Revealed type is "builtins.str"
1674
- case GenericWithFinal(a):
1675
- reveal_type(a) # N: Revealed type is "builtins.str"
1676
- case RegularSubtype(a):
1677
- reveal_type(a) # N: Revealed type is "builtins.str"
1678
- case GenericRegular(a):
1679
- reveal_type(a) # N: Revealed type is "builtins.str"
1680
- case GenericDataclass(a):
1681
- reveal_type(a) # N: Revealed type is "builtins.str"
1682
-
1683
- # Keywords:
1684
- match input_arg:
1685
- case Regular(x=a):
1686
- reveal_type(a) # N: Revealed type is "builtins.str"
1687
- case ReveresedOrder(x=b): # Order is different
1688
- reveal_type(b) # N: Revealed type is "builtins.int"
1689
- case GenericWithFinal(x=a):
1690
- reveal_type(a) # N: Revealed type is "builtins.str"
1691
- case RegularSubtype(x=a):
1692
- reveal_type(a) # N: Revealed type is "builtins.str"
1693
- case GenericRegular(x=a):
1694
- reveal_type(a) # N: Revealed type is "builtins.str"
1695
- case GenericDataclass(x=a):
1696
- reveal_type(a) # N: Revealed type is "builtins.str"
1697
- [builtins fixtures/dataclasses.pyi]
0 commit comments