You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: test-data/unit/pythoneval.test
+13-3Lines changed: 13 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -1601,14 +1601,24 @@ _testSpecialTypingProtocols.py:8: error: Statement is unreachable
1601
1601
[case testEnumValueWithPlaceholderNodeType]
1602
1602
# https://github.com/python/mypy/issues/11971
1603
1603
from enum import Enum
1604
-
from typing import Callable, Dict
1604
+
from typing import Any, Callable, Dict
1605
1605
class Foo(Enum):
1606
1606
Bar: Foo = Callable[[str], None]
1607
-
Baz: Foo = Callable[[Dict[str, "Missing"]], None]
1607
+
Baz: Any = Callable[[Dict[str, "Missing"]], None]
1608
+
1609
+
reveal_type(Foo.Bar)
1610
+
reveal_type(Foo.Bar.value) # this should probably not be "Foo" https://typing.readthedocs.io/en/latest/spec/enums.html#member-values
1611
+
reveal_type(Foo.Baz)
1612
+
reveal_type(Foo.Baz.value)
1608
1613
[out]
1614
+
_testEnumValueWithPlaceholderNodeType.py:5: error: Type annotations are not allowed for enum members
1609
1615
_testEnumValueWithPlaceholderNodeType.py:5: error: Incompatible types in assignment (expression has type "<typing special form>", variable has type "Foo")
1610
-
_testEnumValueWithPlaceholderNodeType.py:6: error: Incompatible types in assignment (expression has type "<typing special form>", variable has type "Foo")
1616
+
_testEnumValueWithPlaceholderNodeType.py:6: error: Type annotations are not allowed for enum members
1611
1617
_testEnumValueWithPlaceholderNodeType.py:6: error: Name "Missing" is not defined
1618
+
_testEnumValueWithPlaceholderNodeType.py:8: note: Revealed type is "Literal[_testEnumValueWithPlaceholderNodeType.Foo.Bar]?"
1619
+
_testEnumValueWithPlaceholderNodeType.py:9: note: Revealed type is "_testEnumValueWithPlaceholderNodeType.Foo"
1620
+
_testEnumValueWithPlaceholderNodeType.py:10: note: Revealed type is "Literal[_testEnumValueWithPlaceholderNodeType.Foo.Baz]?"
1621
+
_testEnumValueWithPlaceholderNodeType.py:11: note: Revealed type is "Any"
0 commit comments