Skip to content
Merged
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
3 changes: 0 additions & 3 deletions mypy/checkexpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -4885,9 +4885,6 @@ class LongName(Generic[T]): ...
"""
if alias.python_3_12_type_alias:
return self.type_alias_type_type()
if isinstance(alias.target, Instance) and alias.target.invalid: # type: ignore[misc]
# An invalid alias, error already has been reported
return AnyType(TypeOfAny.from_error)
# If this is a generic alias, we set all variables to `Any`.
# For example:
# A = List[Tuple[T, T]]
Expand Down
1 change: 0 additions & 1 deletion mypy/copytype.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ def visit_deleted_type(self, t: DeletedType) -> ProperType:

def visit_instance(self, t: Instance) -> ProperType:
dup = Instance(t.type, t.args, last_known_value=t.last_known_value)
dup.invalid = t.invalid
return self.copy_common(t, dup)

def visit_type_var(self, t: TypeVarType) -> ProperType:
Expand Down
2 changes: 0 additions & 2 deletions mypy/typeanal.py
Original file line number Diff line number Diff line change
Expand Up @@ -2097,7 +2097,6 @@ def fix_instance(
# Already wrong arg count error, don't emit missing type parameters error as well.
disallow_any = False
t.args = ()
arg_count = 0

args: list[Type] = [*(t.args[:max_tv_count])]
any_type: AnyType | None = None
Expand Down Expand Up @@ -2550,7 +2549,6 @@ def validate_instance(t: Instance, fail: MsgCallback, empty_tuple_index: bool) -
t,
code=codes.TYPE_ARG,
)
t.invalid = True
return False
return True

Expand Down
3 changes: 0 additions & 3 deletions mypy/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -1627,9 +1627,6 @@ def __init__(
self.args = tuple(args)
self.type_ref: str | None = None

# True if recovered after incorrect number of type arguments error
self.invalid = False

# This field keeps track of the underlying Literal[...] value associated with
# this instance, if one is known.
#
Expand Down
2 changes: 1 addition & 1 deletion test-data/unit/check-generics.test
Original file line number Diff line number Diff line change
Expand Up @@ -1126,7 +1126,7 @@ main:13:1: error: Value of type variable "T" of "SameA" cannot be "str"
class A: ...
Bad = A[int] # type: ignore

reveal_type(Bad) # N: Revealed type is "Any"
reveal_type(Bad) # N: Revealed type is "def () -> __main__.A"
[out]

[case testSubscriptionOfBuiltinAliases]
Expand Down