mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Print diagnostic groups as part of the LLVM printer in the same manner as the
Swift one does, always. Make `-print-diagnostic-groups` an inert option, since we
always print diagnostic group names with the `[#GroupName]` syntax.
As part of this, we no longer render the diagnostic group name as part
of the diagnostic *text*, instead leaving it up to the diagnostic
renderer to handle the category appropriately. Update all of the tests
that were depending on `-print-diagnostic-groups` putting it into the
text to instead use the `{{documentation-file=<file name>}}`
diagnostic verification syntax.
38 lines
2.3 KiB
Swift
38 lines
2.3 KiB
Swift
// RUN: %target-typecheck-verify-swift -verify-ignore-unknown
|
|
|
|
import StdlibUnittest
|
|
|
|
func checkStringOverloadCompilationDiagnostics() {
|
|
|
|
_ = String(cString: "string") // expected-warning {{'init(cString:)' is deprecated: Use a copy of the String argument}}{{documentation-file=deprecated-declaration}}
|
|
|
|
_ = String(validatingUTF8: "string") // expected-warning {{init(validatingUTF8:)' is deprecated: Use a copy of the String argument}}{{documentation-file=deprecated-declaration}}
|
|
|
|
_ = String(validatingCString: "string") // expected-warning {{'init(validatingCString:)' is deprecated: Use a copy of the String argument}}{{documentation-file=deprecated-declaration}}
|
|
|
|
_ = String.decodeCString("string", as: Unicode.UTF8.self) // expected-warning {{'decodeCString(_:as:repairingInvalidCodeUnits:)' is deprecated: Use a copy of the String argument}}{{documentation-file=deprecated-declaration}}
|
|
|
|
_ = String(decodingCString: "string", as: Unicode.UTF8.self) // expected-warning {{'init(decodingCString:as:)' is deprecated: Use a copy of the String argument}}{{documentation-file=deprecated-declaration}}
|
|
}
|
|
|
|
func checkInoutConversionOverloadCompilationDiagnostics() {
|
|
|
|
var i = UInt8.zero
|
|
|
|
_ = String(cString: &i) // expected-warning {{'init(cString:)' is deprecated: Use String(_ scalar: Unicode.Scalar)}}{{documentation-file=deprecated-declaration}}
|
|
|
|
var c = CChar.zero
|
|
|
|
_ = String(cString: &c) // expected-warning {{'init(cString:)' is deprecated: Use String(_ scalar: Unicode.Scalar)}}{{documentation-file=deprecated-declaration}}
|
|
|
|
_ = String(validatingUTF8: &c) // expected-warning {{init(validatingUTF8:)' is deprecated: Use String(_ scalar: Unicode.Scalar)}}{{documentation-file=deprecated-declaration}}
|
|
|
|
_ = String(validatingCString: &c) // expected-warning {{'init(validatingCString:)' is deprecated: Use String(_ scalar: Unicode.Scalar)}}{{documentation-file=deprecated-declaration}}
|
|
|
|
var u = Unicode.UTF8.CodeUnit.zero
|
|
|
|
_ = String.decodeCString(&u, as: Unicode.UTF8.self) // expected-warning {{'decodeCString(_:as:repairingInvalidCodeUnits:)' is deprecated: Use String(_ scalar: Unicode.Scalar)}}{{documentation-file=deprecated-declaration}}
|
|
|
|
_ = String(decodingCString: &u, as: Unicode.UTF8.self) // expected-warning {{'init(decodingCString:as:)' is deprecated: Use String(_ scalar: Unicode.Scalar)}}{{documentation-file=deprecated-declaration}}
|
|
}
|