File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -800,7 +800,7 @@ void SwitchStmtScope::expandAScopeThatDoesNotCreateANewInsertionPoint(
800
800
scopeCreator);
801
801
802
802
for (auto caseStmt : stmt->getCases ()) {
803
- if (!scopeCreator.isDuplicate (caseStmt)) {
803
+ if (!scopeCreator.isDuplicate (caseStmt) && !caseStmt-> isImplicit () ) {
804
804
scopeCreator.createSubtree <CaseStmtScope>(this , caseStmt);
805
805
}
806
806
}
@@ -812,7 +812,12 @@ void ForEachStmtScope::expandAScopeThatDoesNotCreateANewInsertionPoint(
812
812
scopeCreator);
813
813
814
814
// Add a child describing the scope of the pattern.
815
- scopeCreator.createSubtree <ForEachPatternScope>(this , stmt);
815
+ // In error cases such as:
816
+ // let v: C { for b : Int -> S((array: P { }
817
+ // the body is implicit and it would overlap the source range of the expr
818
+ // above.
819
+ if (!stmt->getBody ()->isImplicit ())
820
+ scopeCreator.createSubtree <ForEachPatternScope>(this , stmt);
816
821
}
817
822
818
823
void ForEachPatternScope::expandAScopeThatDoesNotCreateANewInsertionPoint (
You can’t perform that action at this time.
0 commit comments