mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[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.
This commit is contained in:
@@ -738,23 +738,6 @@ private:
|
||||
LocatorPathElt::ContextualType(context.purpose)});
|
||||
cs.addConstraint(ConstraintKind::Equal, context.getType(), patternType,
|
||||
loc);
|
||||
|
||||
// For any pattern variable that has a parent variable (i.e., another
|
||||
// pattern variable with the same name in the same case), require that
|
||||
// the types be equivalent.
|
||||
pattern->forEachNode([&](Pattern *pattern) {
|
||||
auto namedPattern = dyn_cast<NamedPattern>(pattern);
|
||||
if (!namedPattern)
|
||||
return;
|
||||
|
||||
auto var = namedPattern->getDecl();
|
||||
if (auto parentVar = var->getParentVarDecl()) {
|
||||
cs.addConstraint(
|
||||
ConstraintKind::Equal, cs.getType(parentVar), cs.getType(var),
|
||||
cs.getConstraintLocator(
|
||||
locator, LocatorPathElt::PatternMatch(namedPattern)));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void visitPatternBinding(PatternBindingDecl *patternBinding,
|
||||
|
||||
Reference in New Issue
Block a user