diff --git a/mypy/semanal.py b/mypy/semanal.py index 15036e065265..1c39aa0de256 100644 --- a/mypy/semanal.py +++ b/mypy/semanal.py @@ -3172,11 +3172,15 @@ def process_paramspec_declaration(self, s: AssignmentStmt) -> bool: # PEP 612 reserves the right to define bound, covariant and contravariant arguments to # ParamSpec in a later PEP. If and when that happens, we should do something # on the lines of process_typevar_parameters - paramspec_var = ParamSpecExpr( - name, self.qualified_name(name), self.object_type(), INVARIANT - ) - paramspec_var.line = call.line - call.analyzed = paramspec_var + + if not call.analyzed: + paramspec_var = ParamSpecExpr( + name, self.qualified_name(name), self.object_type(), INVARIANT + ) + paramspec_var.line = call.line + call.analyzed = paramspec_var + else: + assert isinstance(call.analyzed, ParamSpecExpr) self.add_symbol(name, call.analyzed, s) return True