File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1458,3 +1458,45 @@ _testNoCrashOnGenericUnionUnpacking.py:10: error: Revealed type is 'Union[builti
14581458_testNoCrashOnGenericUnionUnpacking.py:11: error: Revealed type is 'Union[builtins.str, builtins.int]'
14591459_testNoCrashOnGenericUnionUnpacking.py:15: error: Revealed type is 'Union[builtins.int*, builtins.str*]'
14601460_testNoCrashOnGenericUnionUnpacking.py:16: error: Revealed type is 'Union[builtins.int*, builtins.str*]'
1461+
1462+ [case testEnumIteration]
1463+ from enum import Enum
1464+ class E(Enum):
1465+ A = 'a'
1466+ l = [e for e in E]
1467+ reveal_type(l[0]) # E: Revealed type is '_testEnumIteration.E*'
1468+ for e in E:
1469+ reveal_type(e) # E: Revealed type is '_testEnumIteration.E*'
1470+
1471+ [case testEnumIterable]
1472+ from enum import Enum
1473+ from typing import Iterable
1474+ class E(Enum):
1475+ a = 'a'
1476+ def f(ie:Iterable[E]):
1477+ pass
1478+ f(E)
1479+
1480+ [case testIntEnumIterable]
1481+ from enum import IntEnum
1482+ from typing import Iterable
1483+ class N(IntEnum):
1484+ x = 1
1485+ def f(ni: Iterable[N]):
1486+ pass
1487+ def g(ii: Iterable[int]):
1488+ pass
1489+ f(N)
1490+ g(N)
1491+
1492+ [case testDerivedEnumIterable]
1493+ from enum import Enum
1494+ from typing import Iterable
1495+ class E(str, Enum):
1496+ a = 'foo'
1497+ def f(ei: Iterable[E]):
1498+ pass
1499+ def g(si: Iterable[str]):
1500+ pass
1501+ f(E)
1502+ g(E)
You can’t perform that action at this time.
0 commit comments