Skip to content

Commit 4c8f1c8

Browse files
[test] Adding SR-9839 test cases
1 parent 2704b6d commit 4c8f1c8

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test/expr/closure/closures.swift

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,3 +483,24 @@ let closure = { // expected-error {{unable to infer complex closure return type;
483483
var helper = true
484484
return helper
485485
}
486+
487+
// SR-9839
488+
func SR9839(_ x: @escaping @convention(block) () -> Void) {}
489+
490+
func id<T>(_ x: T) -> T {
491+
return x
492+
}
493+
494+
var qux: () -> Void = {}
495+
496+
SR9839(qux)
497+
SR9839(id(qux)) // expected-error {{conflicting arguments to generic parameter 'T' ('() -> Void' vs. '@convention(block) () -> Void')}}
498+
499+
func forceUnwrap<T>(_ x: T?) -> T {
500+
return x!
501+
}
502+
503+
var qux1: (() -> Void)? = {}
504+
505+
SR9839(qux1!)
506+
SR9839(forceUnwrap(qux1))

0 commit comments

Comments
 (0)