diff --git a/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java b/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java index a2e261d0f6a..4fd35279784 100644 --- a/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java +++ b/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java @@ -4014,15 +4014,8 @@ public void visitIfElse(final IfStatement ifElse) { restoreTypeBeforeConditional(); ifElse.getElseBlock().visit(this); - - // GROOVY-9786: if chaining: "if (...) x=?; else if (...) x=?;" - Map updates = - ifElse.getElseBlock().getNodeMetaData("assignments"); - if (updates != null) { - updates.forEach(this::recordAssignment); - } } finally { - ifElse.putNodeMetaData("assignments", popAssignmentTracking(oldTracker)); + popAssignmentTracking(oldTracker); } if (!typeCheckingContext.enclosingBlocks.isEmpty()) { @@ -4201,6 +4194,10 @@ protected Map popAssignmentTracking(final Map