Skip to content

Commit df34cdc

Browse files
committed
Test including multiple generic args with missing unwraps.
1 parent 0db31c9 commit df34cdc

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/Constraints/closures.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,20 @@ struct S<T> {
288288
}
289289
}
290290

291+
// Similar to SR1069 but with multiple generic arguments
292+
func simplified1069() {
293+
class C {}
294+
struct S {
295+
func genericallyNonOptional<T: AnyObject>(_ a: T, _ b: T, _ c: T) { }
296+
297+
func f(_ a: C?, _ b: C?, _ c: C) {
298+
genericallyNonOptional(a, b, c) // expected-error 2{{value of optional type 'C?' must be unwrapped to a value of type 'C'}}
299+
// expected-note @-1 2{{coalesce}}
300+
// expected-note @-2 2{{force-unwrap}}
301+
}
302+
}
303+
}
304+
291305
// Make sure we cannot infer an () argument from an empty parameter list.
292306
func acceptNothingToInt (_: () -> Int) {}
293307
func testAcceptNothingToInt(ac1: @autoclosure () -> Int) {

0 commit comments

Comments
 (0)