Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
hamdanal committed Feb 17, 2024
1 parent 916e686 commit 2f30c87
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions mypy/semanal.py
Original file line number Diff line number Diff line change
Expand Up @@ -3782,7 +3782,7 @@ def analyze_type_alias_type_params(self, rvalue: CallExpr) -> TypeVarLikeList:
have_type_var_tuple = False
for tp_expr in type_params:
if isinstance(tp_expr, StarExpr):
tp_expr.valid = True
tp_expr.valid = False
self.analyze_type_expr(tp_expr)
try:
base = self.expr_to_unanalyzed_type(tp_expr)
Expand Down Expand Up @@ -3818,7 +3818,8 @@ def analyze_type_alias_type_params(self, rvalue: CallExpr) -> TypeVarLikeList:
code=codes.TYPE_VAR,
)
continue
declared_tvars.append(tvar)
if tvar:
declared_tvars.append(tvar)
return declared_tvars

def disable_invalid_recursive_aliases(
Expand Down
2 changes: 1 addition & 1 deletion test-data/unit/check-type-aliases.test
Original file line number Diff line number Diff line change
Expand Up @@ -1147,7 +1147,7 @@ partially_generic2: Ta3[int] = {1: "a"} # E: Dict entry 0 has incompatible type
Ta4 = TypeAliasType("Ta4", Tuple[Unpack[Ts]], type_params=(Ts, Ts1)) # E: Can only use one type var tuple in type_params argument to TypeAliasType

Ta5 = TypeAliasType("Ta5", Dict) # Unlike old style aliases, this is not generic
non_generic_dict: Ta5[int, str] # E: Bad number of arguments for type alias, expected: 0, given: 2
non_generic_dict: Ta5[int, str] # E: Bad number of arguments for type alias, expected 0, given 2

[builtins fixtures/dict.pyi]

Expand Down

0 comments on commit 2f30c87

Please sign in to comment.