Skip to content

Commit

Permalink
Fixed bug that results in incorrect inferred type for an instance or …
Browse files Browse the repository at this point in the history
…class variable assigned a value as part of a tuple expression target with an unpack operator (e.g. `a, *self.b = (1, 2, 3)`). This addresses #9841. (#9844)
  • Loading branch information
erictraut authored Feb 7, 2025
1 parent 74b11d4 commit fe79092
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions packages/pyright-internal/src/analyzer/typeEvaluator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4434,17 +4434,17 @@ export function createTypeEvaluator(
}

case ParseNodeType.Unpack: {
if (target.d.expr.nodeType === ParseNodeType.Name) {
assignTypeToNameNode(
target.d.expr,
{
type: getBuiltInObject(target.d.expr, 'list', [typeResult.type]),
isIncomplete: typeResult.isIncomplete,
},
ignoreEmptyContainers,
srcExpr
);
}
assignTypeToExpression(
target.d.expr,
{
type: getBuiltInObject(target.d.expr, 'list', [typeResult.type]),
isIncomplete: typeResult.isIncomplete,
},
srcExpr,
ignoreEmptyContainers,
allowAssignmentToFinalVar,
expectedTypeDiagAddendum
);
break;
}

Expand Down

0 comments on commit fe79092

Please sign in to comment.