mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
mismatches in function types. This improves the diagnostic in cases where we have argument-to-parameter conversion failures or contextual type mismatches due to inout attribute mismatches.
25 lines
578 B
Swift
25 lines
578 B
Swift
// RUN: %target-typecheck-verify-swift
|
|
|
|
func test15921520() {
|
|
var x: Int = 0
|
|
func f<T>(_ x: T) {}
|
|
f(&x) // expected-error{{'&' used with non-inout argument of type 'Int'}} {{7-8=}}
|
|
}
|
|
|
|
func test20807269() {
|
|
var x: Int = 0
|
|
func f<T>(_ x: T) {}
|
|
f(1, &x) // expected-error{{extra argument in call}}
|
|
}
|
|
|
|
func test15921530() {
|
|
struct X {}
|
|
|
|
func makef<T>() -> (T) -> () {
|
|
return {
|
|
x in ()
|
|
}
|
|
}
|
|
var _: (inout X) -> () = makef() // expected-error{{cannot convert value of type '(X) -> ()' to specified type '(inout X) -> ()'}}
|
|
}
|