Skip to content

Commit 572154d

Browse files
authored
fix: fail check if not enough or too many types provided to TypeAliasType()
1 parent 7d81f29 commit 572154d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

mypy/semanal.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4157,8 +4157,12 @@ def check_type_alias_type_call(self, rvalue: Expression, *, name: str) -> TypeGu
41574157
names.append("typing.TypeAliasType")
41584158
if not refers_to_fullname(rvalue.callee, tuple(names)):
41594159
return False
4160+
if not self.check_typevarlike_name(rvalue, name, rvalue):
4161+
return False
4162+
if rvalue.arg_kinds.count(ARG_POS) != 2:
4163+
return False
41604164

4161-
return self.check_typevarlike_name(rvalue, name, rvalue)
4165+
return True
41624166

41634167
def analyze_type_alias_type_params(
41644168
self, rvalue: CallExpr

0 commit comments

Comments
 (0)