Skip to content

Commit f210442

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.
1 parent 4debf30 commit f210442

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
@@ -441,7 +441,7 @@ class SyntacticElementConstraintGenerator
441441

442442
cs.addConstraint(
443443
ConstraintKind::Conversion, elementType, initType,
444-
cs.getConstraintLocator(contextualLocator,
444+
cs.getConstraintLocator(sequenceLocator,
445445
ConstraintLocator::SequenceElementType));
446446

447447
// Reference the makeIterator witness.
@@ -450,9 +450,10 @@ class SyntacticElementConstraintGenerator
450450

451451
Type makeIteratorType =
452452
cs.createTypeVariable(locator, TVO_CanBindToNoEscape);
453-
cs.addValueWitnessConstraint(LValueType::get(sequenceType), makeIterator,
454-
makeIteratorType, context.getAsDeclContext(),
455-
FunctionRefKind::Compound, contextualLocator);
453+
cs.addValueWitnessConstraint(
454+
LValueType::get(sequenceType), makeIterator, makeIteratorType,
455+
context.getAsDeclContext(), FunctionRefKind::Compound,
456+
cs.getConstraintLocator(sequenceLocator, ConstraintLocator::Witness));
456457

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

0 commit comments

Comments
 (0)