Skip to content

Commit

Permalink
Fix some validation-test regressions, mostly by tweaking tests
Browse files Browse the repository at this point in the history
but also by being a little more defensive during recovery.

Swift SVN r30424
  • Loading branch information
rjmccall committed Jul 21, 2015
1 parent b46aa33 commit 0ea7b2f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion lib/Sema/CSDiag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2565,8 +2565,10 @@ 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 =
cast_or_null<TupleExpr>(typeCheckChildIndependently(binop->getArg()));
dyn_cast_or_null<TupleExpr>(typeCheckChildIndependently(binop->getArg()));
if (!argExpr) return true;

auto argTuple = argExpr->getType()->getAs<TupleType>();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: not %target-swift-frontend %s -parse
// RUN: %target-swift-frontend %s -parse

_ = {
typealias A = Int
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
// http://www.openradar.me/17317691

func f() {
({}) // expected-error {{type of expression is ambiguous without more context}}
({}) // expected-error {{expression resolves to an unused function}}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ var f = 1
var e: Int -> Int = {
return $0
}
let d: Int = { c, b in
}(f, e) // expected-error {{missing return in a closure expected to return 'Int'}}
let d: Int = { c, b in // expected-error {{'()' is not convertible to 'Int'}}
}(f, e)

0 comments on commit 0ea7b2f

Please sign in to comment.