mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
* 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).
16 lines
1.3 KiB
Swift
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)}}
|