diff --git a/lib/Sema/TypeCheckEffects.cpp b/lib/Sema/TypeCheckEffects.cpp index aec66b7fd57cc..4dee003487800 100644 --- a/lib/Sema/TypeCheckEffects.cpp +++ b/lib/Sema/TypeCheckEffects.cpp @@ -2071,7 +2071,8 @@ class CheckEffectsCoverage : public EffectsHandlingWalker llvm::DenseMap parentMap; static bool isEffectAnchor(Expr *e) { - return isa(e) || isa(e) || isa(e); + return isa(e) || isa(e) || + isa(e); } static bool isAnchorTooEarly(Expr *e) { @@ -2091,24 +2092,13 @@ class CheckEffectsCoverage : public EffectsHandlingWalker if (parent && !isAnchorTooEarly(parent)) { return parent; } - if (isInterpolatedString) { - // TODO: I'm being gentle with the casts to avoid breaking things - // If we see incorrect fix-it locations in string interpolations - // we need to change how this behaves - // Assert builds will crash giving us a bug to fix, non-asserts will - // quietly "just work". assert(parent == nullptr && "Expected to be at top of expression"); - assert(isa(lastParent) && - "Expected top of string interpolation to be CalExpr"); - assert(cast(lastParent)->getArgs()->isUnlabeledUnary() && - "Expected unary arg in string interpolation call"); - if (auto *callExpr = dyn_cast(lastParent)) { - if (auto *unaryArg = callExpr->getArgs()->getUnlabeledUnaryExpr()) + if (ArgumentList *args = lastParent->getArgs()) { + if (Expr *unaryArg = args->getUnlabeledUnaryExpr()) return unaryArg; } } - return lastParent; }