Skip to content

Commit a5f87f2

Browse files
committed
[CSClosure] Anchor for-in sequence constraints on sequence expression
This was an incorrect locator since constraints do belong to a sequence expression and not to a contextual pattern. (cherry picked from commit f210442)
1 parent 09752ff commit a5f87f2

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lib/Sema/CSClosure.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ class ClosureConstraintGenerator
440440

441441
cs.addConstraint(
442442
ConstraintKind::Conversion, elementType, initType,
443-
cs.getConstraintLocator(contextualLocator,
443+
cs.getConstraintLocator(sequenceLocator,
444444
ConstraintLocator::SequenceElementType));
445445

446446
// Reference the makeIterator witness.
@@ -449,9 +449,10 @@ class ClosureConstraintGenerator
449449

450450
Type makeIteratorType =
451451
cs.createTypeVariable(locator, TVO_CanBindToNoEscape);
452-
cs.addValueWitnessConstraint(LValueType::get(sequenceType), makeIterator,
453-
makeIteratorType, closure,
454-
FunctionRefKind::Compound, contextualLocator);
452+
cs.addValueWitnessConstraint(
453+
LValueType::get(sequenceType), makeIterator, makeIteratorType,
454+
closure, FunctionRefKind::Compound,
455+
cs.getConstraintLocator(sequenceLocator, ConstraintLocator::Witness));
455456

456457
// After successful constraint generation, let's record
457458
// solution application target with all relevant information.

0 commit comments

Comments
 (0)