Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mypy/exprtotype.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def expr_to_unanalyzed_type(
else:
base_fullname = expr.base.fullname

if base_fullname is not None and base_fullname in ANNOTATED_TYPE_NAMES:
if base_fullname is not None and base_fullname in ANNOTATED_TYPE_NAMES and args:
# TODO: this is not the optimal solution as we are basically getting rid
# of the Annotation definition and only returning the type information,
# losing all the annotations.
Expand Down
5 changes: 5 additions & 0 deletions test-data/unit/check-annotated.test
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ x: Annotated[int] # E: Annotated[...] must have exactly one type argument and a
reveal_type(x) # N: Revealed type is "Any"
[builtins fixtures/tuple.pyi]

[case testAnnotatedBadEmptyTupleIndexInTypeApplication]
from typing_extensions import Annotated
list[Annotated[()]] # E: Annotated[...] must have exactly one type argument and at least one annotation
[builtins fixtures/list.pyi]

[case testAnnotatedNested0]
from typing_extensions import Annotated
x: Annotated[Annotated[int, ...], ...]
Expand Down
Loading