Skip to content

Commit 9bedabe

Browse files
committed
add some tests for some (currently horrible) diagnostics generated in closure examples.
Swift SVN r30518
1 parent 842b3c7 commit 9bedabe

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test/Constraints/diagnostics.swift

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,3 +392,20 @@ extension CurriedClass {
392392
method3(self) // expected-error {{missing argument for parameter 'b' in call}}
393393
}
394394
}
395+
396+
397+
// <rdar://problem/19870975> Incorrect diagnostic for failed member lookups within closures passed as arguments ("(_) -> _")
398+
func ident<T>(t: T) -> T {}
399+
var c = ident({1.DOESNT_EXIST}) // error: expected-error {{cannot invoke 'ident' with an argument list of type '(() -> _)'}}
400+
//expected-note @-1 {{expected an argument list of type '(T)'}}
401+
402+
// <rdar://problem/20712541> QoI: Int/UInt mismatch produces useless error inside a block
403+
var afterMessageCount : Int? = nil
404+
405+
func uintFunc() -> UInt {}
406+
func takeVoidVoidFn(a : () -> ()) {}
407+
takeVoidVoidFn { () -> Void in // expected-error {{cannot invoke 'takeVoidVoidFn' with an argument list of type '(() -> Void)'}}
408+
// expected-note @-1 {{expected an argument list of type '(() -> ())'}}
409+
afterMessageCount = uintFunc()
410+
}
411+

0 commit comments

Comments
 (0)