Skip to content

Commit aebe73a

Browse files
committed
[Type checker] Remove the now-unused InterpolationArgument locator element.
NFC; the prior commit eliminated all uses of this locator path element. (cherry picked from commit 4127f70)
1 parent 80e8a6a commit aebe73a

File tree

5 files changed

+1
-58
lines changed

5 files changed

+1
-58
lines changed

lib/Sema/CSApply.cpp

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4102,22 +4102,7 @@ findCalleeDeclRef(ConstraintSystem &cs, const Solution &solution,
41024102

41034103
unsigned newFlags = locator->getSummaryFlags();
41044104

4105-
// If we have an interpolation argument, dig out the constructor if we
4106-
// can.
4107-
// FIXME: This representation is actually quite awful
4108-
if (newPath.size() == 1 &&
4109-
newPath[0].getKind() == ConstraintLocator::InterpolationArgument) {
4110-
newPath.push_back(ConstraintLocator::ConstructorMember);
4111-
4112-
locator = cs.getConstraintLocator(locator->getAnchor(), newPath, newFlags);
4113-
auto known = solution.overloadChoices.find(locator);
4114-
if (known != solution.overloadChoices.end()) {
4115-
auto &choice = known->second.choice;
4116-
if (choice.getKind() == OverloadChoiceKind::Decl)
4117-
return cast<AbstractFunctionDecl>(choice.getDecl());
4118-
}
4119-
return nullptr;
4120-
} else if (isSubscript) {
4105+
if (isSubscript) {
41214106
newPath.push_back(ConstraintLocator::SubscriptMember);
41224107
} else {
41234108
newPath.push_back(ConstraintLocator::ApplyFunction);

lib/Sema/CSDiag.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -222,22 +222,6 @@ void constraints::simplifyLocator(Expr *&anchor,
222222
}
223223
break;
224224

225-
case ConstraintLocator::InterpolationArgument:
226-
if (auto interp = dyn_cast<InterpolatedStringLiteralExpr>(anchor)) {
227-
unsigned index = path[0].getValue();
228-
if (index < interp->getSegments().size()) {
229-
// No additional target locator information.
230-
// FIXME: Dig out the constructor we're trying to call?
231-
targetAnchor = nullptr;
232-
targetPath.clear();
233-
234-
anchor = interp->getSegments()[index];
235-
path = path.slice(1);
236-
continue;
237-
}
238-
}
239-
break;
240-
241225
case ConstraintLocator::SubscriptIndex:
242226
if (auto subscript = dyn_cast<SubscriptExpr>(anchor)) {
243227
targetAnchor = subscript->getBase();

lib/Sema/CSSolver.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2465,17 +2465,6 @@ bool ConstraintSystem::solveSimplified(
24652465
if (*restriction == ConversionRestrictionKind::TupleToTuple)
24662466
break;
24672467
}
2468-
2469-
// Or, if we see a conversion successfully applied to a string
2470-
// interpolation argument, we're done.
2471-
// FIXME: Probably should be more general, as mentioned above.
2472-
if (auto locator = disjunction->getLocator()) {
2473-
if (!locator->getPath().empty() &&
2474-
locator->getPath().back().getKind()
2475-
== ConstraintLocator::InterpolationArgument &&
2476-
constraint->getKind() == ConstraintKind::Conversion)
2477-
break;
2478-
}
24792468
}
24802469

24812470
if (TC.getLangOpts().DebugConstraintSolver) {

lib/Sema/ConstraintLocator.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ void ConstraintLocator::Profile(llvm::FoldingSetNodeID &id, Expr *anchor,
7070
case ScalarToTuple:
7171
case Load:
7272
case GenericArgument:
73-
case InterpolationArgument:
7473
case NamedTupleElement:
7574
case TupleElement:
7675
case ApplyArgToParam:
@@ -164,10 +163,6 @@ void ConstraintLocator::dump(SourceManager *sm, raw_ostream &out) {
164163
out << "instance type";
165164
break;
166165

167-
case InterpolationArgument:
168-
out << "interpolation argument #" << llvm::utostr(elt.getValue());
169-
break;
170-
171166
case Load:
172167
out << "load";
173168
break;

lib/Sema/ConstraintLocator.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,6 @@ class ConstraintLocator : public llvm::FoldingSetNode {
9191
SubscriptIndex,
9292
/// \brief The result of a subscript expression.
9393
SubscriptResult,
94-
/// \brief An argument to string interpolation.
95-
InterpolationArgument,
9694
/// \brief The lookup for a constructor member.
9795
ConstructorMember,
9896
/// \brief Rvalue adjustment.
@@ -155,7 +153,6 @@ class ConstraintLocator : public llvm::FoldingSetNode {
155153
return 0;
156154

157155
case GenericArgument:
158-
case InterpolationArgument:
159156
case NamedTupleElement:
160157
case TupleElement:
161158
return 1;
@@ -204,7 +201,6 @@ class ConstraintLocator : public llvm::FoldingSetNode {
204201
case Archetype:
205202
case AssociatedType:
206203
case GenericArgument:
207-
case InterpolationArgument:
208204
case NamedTupleElement:
209205
case TupleElement:
210206
case Requirement:
@@ -335,12 +331,6 @@ class ConstraintLocator : public llvm::FoldingSetNode {
335331
return PathElement(GenericArgument, position);
336332
}
337333

338-
/// \brief Retrieve a path element for an argument to string
339-
/// interpolation.
340-
static PathElement getInterpolationArgument(unsigned position) {
341-
return PathElement(InterpolationArgument, position);
342-
}
343-
344334
/// \brief Retrieve the kind of path element.
345335
PathElementKind getKind() const {
346336
switch (static_cast<StoredKind>(storedKind)) {

0 commit comments

Comments
 (0)