File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -2228,3 +2228,27 @@ reveal_type(Foo.Baz) # N: Revealed type is "Literal[__main__.Foo.Baz]?"
22282228reveal_type(Foo.Baz.value) # N: Revealed type is "Any"
22292229[builtins fixtures/tuple.pyi]
22302230[typing fixtures/typing-full.pyi]
2231+
2232+
2233+ [case testEnumWithAnnotationOnly]
2234+ # flags: --warn-unreachable
2235+ import enum
2236+
2237+
2238+ class E(enum.IntEnum):
2239+ A: int # E: Enum members must be left unannotated \
2240+ # N: See https://typing.readthedocs.io/en/latest/spec/enums.html#defining-members
2241+ B: int # E: Enum members must be left unannotated \
2242+ # N: See https://typing.readthedocs.io/en/latest/spec/enums.html#defining-members
2243+
2244+
2245+ def do_check(value: E) -> None:
2246+ reveal_type(value) # N: Revealed type is "__main__.E"
2247+ if value is E.A:
2248+ return
2249+
2250+ reveal_type(value) # N: Revealed type is "Literal[__main__.E.B]"
2251+ "should be reachable"
2252+
2253+ [builtins fixtures/primitives.pyi]
2254+ [typing fixtures/typing-full.pyi]
You can’t perform that action at this time.
0 commit comments