Skip to content

Commit b0d01de

Browse files
committed
[ConstraintSystem] Add a special locator element for implicit @dynamicCallable calls
1 parent 184e238 commit b0d01de

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

lib/Sema/ConstraintLocator.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ unsigned LocatorPathElt::getNewSummaryFlags() const {
113113
case ConstraintLocator::KeyPathValue:
114114
case ConstraintLocator::KeyPathComponentResult:
115115
case ConstraintLocator::Condition:
116+
case ConstraintLocator::DynamicCallable:
116117
return 0;
117118

118119
case ConstraintLocator::FunctionArgument:
@@ -453,6 +454,10 @@ void ConstraintLocator::dump(SourceManager *sm, raw_ostream &out) const {
453454
case Condition:
454455
out << "condition expression";
455456
break;
457+
458+
case DynamicCallable:
459+
out << "implicit call to @dynamicCallable method";
460+
break;
456461
}
457462
}
458463
out << ']';

lib/Sema/ConstraintLocatorPathElts.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,8 @@ CUSTOM_LOCATOR_PATH_ELT(Witness)
167167
/// The condition associated with 'if' expression or ternary operator.
168168
SIMPLE_LOCATOR_PATH_ELT(Condition)
169169

170+
SIMPLE_LOCATOR_PATH_ELT(DynamicCallable)
171+
170172
#undef LOCATOR_PATH_ELT
171173
#undef CUSTOM_LOCATOR_PATH_ELT
172174
#undef SIMPLE_LOCATOR_PATH_ELT

lib/Sema/ConstraintSystem.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3066,6 +3066,11 @@ void constraints::simplifyLocator(Expr *&anchor,
30663066
break;
30673067
}
30683068

3069+
case ConstraintLocator::DynamicCallable: {
3070+
path = path.slice(1);
3071+
continue;
3072+
}
3073+
30693074
case ConstraintLocator::ApplyFunction:
30703075
// Extract application function.
30713076
if (auto applyExpr = dyn_cast<ApplyExpr>(anchor)) {

0 commit comments

Comments
 (0)