Skip to content

Commit

Permalink
Do defensive coding properly this time.
Browse files Browse the repository at this point in the history
Swift SVN r30432
  • Loading branch information
rjmccall committed Jul 21, 2015
1 parent af957bc commit 1ee392e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions lib/Sema/CSDiag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2565,11 +2565,14 @@ FailureDiagnosis::collectCalleeCandidateInfo(Expr *fn, Type actualArgsType,
}

bool FailureDiagnosis::visitBinaryExpr(BinaryExpr *binop) {
// Pre-checking can turn (T,U) into a TypeExpr. That doesn't happen
// except in independent type-checking like this, so just ignore it.
auto argExpr =
dyn_cast_or_null<TupleExpr>(typeCheckChildIndependently(binop->getArg()));
if (!argExpr) return true;
auto checkedArgExpr = typeCheckChildIndependently(binop->getArg());
if (!checkedArgExpr) return true;

// Pre-checking can turn (T,U) into a TypeExpr. That's an artifact
// of independent type-checking; just use the standard diagnostics
// paths.
auto argExpr = dyn_cast<TupleExpr>(checkedArgExpr);
if (!argExpr) return false;

auto argTuple = argExpr->getType()->getAs<TupleType>();

Expand Down

0 comments on commit 1ee392e

Please sign in to comment.