@@ -2071,7 +2071,8 @@ class CheckEffectsCoverage : public EffectsHandlingWalker<CheckEffectsCoverage>
20712071 llvm::DenseMap<Expr *, Expr *> parentMap;
20722072
20732073 static bool isEffectAnchor (Expr *e) {
2074- return isa<AbstractClosureExpr>(e) || isa<DiscardAssignmentExpr>(e) || isa<AssignExpr>(e);
2074+ return isa<AbstractClosureExpr>(e) || isa<DiscardAssignmentExpr>(e) ||
2075+ isa<AssignExpr>(e);
20752076 }
20762077
20772078 static bool isAnchorTooEarly (Expr *e) {
@@ -2091,24 +2092,13 @@ class CheckEffectsCoverage : public EffectsHandlingWalker<CheckEffectsCoverage>
20912092 if (parent && !isAnchorTooEarly (parent)) {
20922093 return parent;
20932094 }
2094-
20952095 if (isInterpolatedString) {
2096- // TODO: I'm being gentle with the casts to avoid breaking things
2097- // If we see incorrect fix-it locations in string interpolations
2098- // we need to change how this behaves
2099- // Assert builds will crash giving us a bug to fix, non-asserts will
2100- // quietly "just work".
21012096 assert (parent == nullptr && " Expected to be at top of expression" );
2102- assert (isa<CallExpr>(lastParent) &&
2103- " Expected top of string interpolation to be CalExpr" );
2104- assert (cast<CallExpr>(lastParent)->getArgs ()->isUnlabeledUnary () &&
2105- " Expected unary arg in string interpolation call" );
2106- if (auto *callExpr = dyn_cast<CallExpr>(lastParent)) {
2107- if (auto *unaryArg = callExpr->getArgs ()->getUnlabeledUnaryExpr ())
2097+ if (ArgumentList *args = lastParent->getArgs ()) {
2098+ if (Expr *unaryArg = args->getUnlabeledUnaryExpr ())
21082099 return unaryArg;
21092100 }
21102101 }
2111-
21122102 return lastParent;
21132103 }
21142104
0 commit comments