@@ -2071,7 +2071,8 @@ class CheckEffectsCoverage : public EffectsHandlingWalker<CheckEffectsCoverage>
2071
2071
llvm::DenseMap<Expr *, Expr *> parentMap;
2072
2072
2073
2073
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);
2075
2076
}
2076
2077
2077
2078
static bool isAnchorTooEarly (Expr *e) {
@@ -2091,24 +2092,13 @@ class CheckEffectsCoverage : public EffectsHandlingWalker<CheckEffectsCoverage>
2091
2092
if (parent && !isAnchorTooEarly (parent)) {
2092
2093
return parent;
2093
2094
}
2094
-
2095
2095
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".
2101
2096
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 ())
2108
2099
return unaryArg;
2109
2100
}
2110
2101
}
2111
-
2112
2102
return lastParent;
2113
2103
}
2114
2104
0 commit comments