Files
swift-mirror/test/stdlib/PrintDiagnostics.swift
Pavel Yaskevich 91e330c289 [TypeChecker] Improve argument label matching
* Improve label mismatch callback:
 - Split "missing label" callback into 3 - missing, extraneous, incorrect (with typo(s));
 - Allow label callbacks to indicate if it's a fatal error or not;
* Improve matching of the variadic parameters;
* Improve matching of the parameters with defaults;
* Try to look for an argument with matching label before fallback to
  forced claming (if allowed).
2018-07-21 23:21:42 -07:00

16 lines
1.3 KiB
Swift

// RUN: %target-typecheck-verify-swift
var stream = ""
print(3, &stream) // expected-error{{'&' used with non-inout argument of type 'Any'}}
debugPrint(3, &stream) // expected-error{{'&' used with non-inout argument of type 'Any'}}
print(3, &stream, appendNewline: false) // expected-error {{cannot invoke 'print' with an argument list of type '(Int, inout String, appendNewline: Bool)'}}
// expected-note@-1 {{overloads for 'print' exist with these partially matching parameter lists: (Any..., separator: String, terminator: String), (Any..., separator: String, terminator: String, to: inout Target)}}
debugPrint(3, &stream, appendNewline: false) // expected-error {{cannot invoke 'debugPrint' with an argument list of type '(Int, inout String, appendNewline: Bool)'}}
// expected-note@-1 {{verloads for 'debugPrint' exist with these partially matching parameter lists: (Any..., separator: String, terminator: String), (Any..., separator: String, terminator: String, to: inout Target)}}
print(4, quack: 5) // expected-error {{cannot invoke 'print' with an argument list of type '(Int, quack: Int)'}}
// expected-note@-1 {{overloads for 'print' exist with these partially matching parameter lists: (Any..., separator: String, terminator: String), (Any..., separator: String, terminator: String, to: inout Target)}}