Fix hole where missing_nullary_call wasn't diagnosed in ternary condition.

This commit is contained in:
Greg Titus
2024-06-16 14:20:09 -07:00
parent 25830d6bc3
commit 10138d8390
2 changed files with 6 additions and 0 deletions

View File

@@ -6524,6 +6524,9 @@ bool ConstraintSystem::repairFailures(
locator))
return true;
if (repairByInsertingExplicitCall(lhs, rhs))
return true;
conversionsOrFixes.push_back(IgnoreContextualType::create(
*this, lhs, rhs, getConstraintLocator(locator)));
break;

View File

@@ -59,6 +59,9 @@ _ = true ? x : 1.2 // expected-error {{result values in '? :' expression have mi
_ = (x: true) ? true : false // expected-error {{cannot convert value of type '(x: Bool)' to expected condition type 'Bool'}}
_ = (x: 1) ? true : false // expected-error {{cannot convert value of type '(x: Int)' to expected condition type 'Bool'}}
func resultBool() -> Bool { true }
_ = resultBool ? true : false // expected-error {{function 'resultBool' was used as a property; add () to call it}} {{15-15=()}}
let ib: Bool! = false
let eb: Bool? = .some(false)
let conditional = ib ? "Broken" : "Heart" // should infer Bool!