Fix <rdar://problem/23550816> QoI: Poor diagnostic in argument list of "print" (varargs related)

When passing a contextual type to a call, if we have a scalar element
initializing a varargs parameter list, we need to use the varargs element type
contextually.  Fixing this improves some confusing diagnostics.
This commit is contained in:
Chris Lattner
2015-11-15 15:13:21 -08:00
parent 6f931ca8c0
commit 2f04cb13f1
4 changed files with 26 additions and 7 deletions

View File

@@ -762,7 +762,7 @@ func inoutTests(inout arr: Int) {
func takeAny(x: Any) {}
takeAny(&x) // expected-error{{'&' used with non-inout argument of type 'Any'}}
func takeManyAny(x: Any...) {}
takeManyAny(&x) // expected-error{{'&' used with non-inout argument of type '[Any]'}}
takeManyAny(&x) // expected-error{{'&' used with non-inout argument of type 'Any' (aka 'protocol<>')}}
takeManyAny(1, &x) // expected-error{{'&' used with non-inout argument of type 'Any'}}
func takeIntAndAny(x: Int, _ y: Any) {}
takeIntAndAny(1, &x) // expected-error{{'&' used with non-inout argument of type 'Any'}}