Skip to content

Commit 805b6d9

Browse files
committed
[CS] Remove some dead code in visitCaseItemPattern
We don't wire up the parent variables until after type-checking, and `recordInferredSwitchCasePatternVars` already handles joining the pattern types, so we can remove this.
1 parent 9db82cb commit 805b6d9

File tree

1 file changed

+0
-17
lines changed

1 file changed

+0
-17
lines changed

lib/Sema/CSSyntacticElement.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -738,23 +738,6 @@ class SyntacticElementConstraintGenerator
738738
LocatorPathElt::ContextualType(context.purpose)});
739739
cs.addConstraint(ConstraintKind::Equal, context.getType(), patternType,
740740
loc);
741-
742-
// For any pattern variable that has a parent variable (i.e., another
743-
// pattern variable with the same name in the same case), require that
744-
// the types be equivalent.
745-
pattern->forEachNode([&](Pattern *pattern) {
746-
auto namedPattern = dyn_cast<NamedPattern>(pattern);
747-
if (!namedPattern)
748-
return;
749-
750-
auto var = namedPattern->getDecl();
751-
if (auto parentVar = var->getParentVarDecl()) {
752-
cs.addConstraint(
753-
ConstraintKind::Equal, cs.getType(parentVar), cs.getType(var),
754-
cs.getConstraintLocator(
755-
locator, LocatorPathElt::PatternMatch(namedPattern)));
756-
}
757-
});
758741
}
759742

760743
void visitPatternBinding(PatternBindingDecl *patternBinding,

0 commit comments

Comments
 (0)