Skip to content

Commit a65366e

Browse files
[tests] Adding SR-11540 tests into test/expr/closure/inference.swift
1 parent 1cccbc8 commit a65366e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/expr/closure/inference.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,16 @@ var nestedClosuresWithBrokenInference = { f: Int in {} }
3838
// expected-error@-2 {{consecutive statements on a line must be separated by ';'}} {{44-44=;}}
3939
// expected-error@-3 {{expected expression}}
4040
// expected-error@-4 {{use of unresolved identifier 'f'}}
41+
42+
// SR-11540
43+
44+
func SR11540<R>(action: () -> R) -> Void {}
45+
46+
func SR11540<T, R>(action: (T) -> R) -> Void {}
47+
48+
func SR11540_1<T, R>(action: (T) -> R) -> Void {}
49+
50+
SR11540(action: { return }) // Ok SR11540<R>(action: () -> R) was the selected overload.
51+
52+
// In case that's the only possible overload, it's acceptable
53+
SR11540_1(action: { return }) // OK

0 commit comments

Comments
 (0)