Files
swift-mirror/test/Generics/materializable_restrictions.swift
Holly Borla 7277f4f4ed [Diagnostics] Extend the AllowInOutConversion fix to cover inout attribute
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.
2019-09-05 14:16:24 -07:00

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) -> ()'}}
}