Revert "[CSBindings] Delay inference through OptionalObject if "object" is l-value capable"

This reverts commit 700a57ac4f.
This commit is contained in:
Pavel Yaskevich
2023-12-01 11:35:21 -08:00
parent ab230b94d9
commit cbfe349e33
2 changed files with 7 additions and 28 deletions

View File

@@ -1121,11 +1121,9 @@ func rdar17170728() {
var j: Int?
var k: Int? = 2
let _ = [i, j, k].reduce(0 as Int?) { // expected-error {{missing argument label 'into:' in call}}
// expected-error@-1 {{cannot convert value of type 'Int?' to expected argument type '(inout @escaping (Bool, Bool) -> Bool?, Int?) throws -> ()'}}
let _ = [i, j, k].reduce(0 as Int?) {
$0 && $1 ? $0! + $1! : ($0 ? $0! : ($1 ? $1! : nil))
// expected-error@-1 {{binary operator '+' cannot be applied to two 'Bool' operands}}
// expected-error@-2 4 {{cannot force unwrap value of non-optional type 'Bool'}}
// expected-error@-1 4 {{optional type 'Int?' cannot be used as a boolean; test for '!= nil' instead}}
}
let _ = [i, j, k].reduce(0 as Int?) { // expected-error {{missing argument label 'into:' in call}}
@@ -1555,18 +1553,18 @@ func testNilCoalescingOperatorRemoveFix() {
let _ = "" /* This is a comment */ ?? "" // expected-warning {{left side of nil coalescing operator '??' has non-optional type 'String', so the right side is never used}} {{13-43=}}
let _ = "" // This is a comment
?? "" // expected-warning {{left side of nil coalescing operator '??' has non-optional type 'String', so the right side is never used}} {{1557:13-1558:10=}}
?? "" // expected-warning {{left side of nil coalescing operator '??' has non-optional type 'String', so the right side is never used}} {{1555:13-1556:10=}}
let _ = "" // This is a comment
/*
* The blank line below is part of the test case, do not delete it
*/
?? "" // expected-warning {{left side of nil coalescing operator '??' has non-optional type 'String', so the right side is never used}} {{1560:13-1565:10=}}
?? "" // expected-warning {{left side of nil coalescing operator '??' has non-optional type 'String', so the right side is never used}} {{1558:13-1563:10=}}
if ("" ?? // This is a comment // expected-warning {{left side of nil coalescing operator '??' has non-optional type 'String', so the right side is never used}} {{9-1568:9=}}
if ("" ?? // This is a comment // expected-warning {{left side of nil coalescing operator '??' has non-optional type 'String', so the right side is never used}} {{9-1566:9=}}
"").isEmpty {}
if ("" // This is a comment
?? "").isEmpty {} // expected-warning {{left side of nil coalescing operator '??' has non-optional type 'String', so the right side is never used}} {{1570:9-1571:12=}}
?? "").isEmpty {} // expected-warning {{left side of nil coalescing operator '??' has non-optional type 'String', so the right side is never used}} {{1568:9-1569:12=}}
}