Skip to content

Commit bdabde7

Browse files
committed
[Tests] NFC: Add a test-case for rdar://139238255
1 parent bc949c3 commit bdabde7

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test/Constraints/closures.swift

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,3 +1267,19 @@ do {
12671267

12681268
// Currently legal.
12691269
let _: () -> Int = { return fatalError() }
1270+
1271+
// Make sure that `Void` assigned to closure result doesn't get eagerly propagated into the body
1272+
do {
1273+
class C {
1274+
func f(_: Any) -> Int! { fatalError() }
1275+
static func f(_: Any) -> Int! { fatalError() }
1276+
}
1277+
1278+
class G<T> {
1279+
func g<U>(_ u: U, _: (U, T) -> ()) {}
1280+
1281+
func g<U: C>(_ u: U) {
1282+
g(u) { $0.f($1) } // expected-warning {{result of call to 'f' is unused}}
1283+
}
1284+
}
1285+
}

0 commit comments

Comments
 (0)