|
16 | 16 | CallableType, NoneType, ErasedType, DeletedType, TypeList, TypeVarDef, SyntheticTypeVisitor,
|
17 | 17 | StarType, PartialType, EllipsisType, UninhabitedType, TypeType,
|
18 | 18 | CallableArgument, TypeQuery, union_items, TypeOfAny, LiteralType, RawExpressionType,
|
19 |
| - PlaceholderType, Overloaded, get_proper_type, TypeAliasType, TypeVarLikeDef |
| 19 | + PlaceholderType, Overloaded, get_proper_type, TypeAliasType, TypeVarLikeDef, ParamSpecDef |
20 | 20 | )
|
21 | 21 |
|
22 | 22 | from mypy.nodes import (
|
23 | 23 | TypeInfo, Context, SymbolTableNode, Var, Expression,
|
24 | 24 | nongen_builtins, check_arg_names, check_arg_kinds, ARG_POS, ARG_NAMED,
|
25 |
| - ARG_OPT, ARG_NAMED_OPT, ARG_STAR, ARG_STAR2, TypeVarExpr, TypeVarLikeExpr, |
| 25 | + ARG_OPT, ARG_NAMED_OPT, ARG_STAR, ARG_STAR2, TypeVarExpr, TypeVarLikeExpr, ParamSpecExpr, |
26 | 26 | TypeAlias, PlaceholderNode, SYMBOL_FUNCBASE_TYPES, Decorator, MypyFile
|
27 | 27 | )
|
28 | 28 | from mypy.typetraverser import TypeTraverserVisitor
|
@@ -200,6 +200,10 @@ def visit_unbound_type_nonoptional(self, t: UnboundType, defining_literal: bool)
|
200 | 200 | self.fail(no_subscript_builtin_alias(fullname,
|
201 | 201 | propose_alt=not self.defining_alias), t)
|
202 | 202 | tvar_def = self.tvar_scope.get_binding(sym)
|
| 203 | + if isinstance(sym.node, ParamSpecExpr): |
| 204 | + if tvar_def is None: |
| 205 | + self.fail('ParamSpec "{}" is unbound'.format(t.name), t) |
| 206 | + return AnyType(TypeOfAny.from_error) |
203 | 207 | if isinstance(sym.node, TypeVarExpr) and tvar_def is not None and self.defining_alias:
|
204 | 208 | self.fail('Can\'t use bound type variable "{}"'
|
205 | 209 | ' to define generic alias'.format(t.name), t)
|
|
0 commit comments