Files
swift-mirror/test/Sema/diag_deprecated_string_interpolation.swift
Doug Gregor b182c96bd7 Print diagnostic group names by default
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.
2025-03-29 15:40:56 -07:00

22 lines
1.1 KiB
Swift

// RUN: %target-typecheck-verify-swift -swift-version 5
extension DefaultStringInterpolation {
@available(*, deprecated) func appendInterpolation(deprecated: Int) {}
}
// Make sure diagnostics emitted via string interpolations have a reasonable source location
_ = "\(deprecated: 42)" // expected-warning@:7 {{'appendInterpolation(deprecated:)' is deprecated}}{{documentation-file=deprecated-declaration}}
_ = "hello, world\(deprecated: 42)!!!" // expected-warning@:19 {{'appendInterpolation(deprecated:)' is deprecated}}{{documentation-file=deprecated-declaration}}
_ = "\(42)\(deprecated: 42)test\(deprecated: 42)"
// expected-warning@-1:12 {{'appendInterpolation(deprecated:)' is deprecated}}{{documentation-file=deprecated-declaration}}
// expected-warning@-2:33 {{'appendInterpolation(deprecated:)' is deprecated}}{{documentation-file=deprecated-declaration}}
_ = """
This is a multiline literal with a deprecated interpolation:
\(deprecated: 42)
"""
// expected-warning@-2:2 {{'appendInterpolation(deprecated:)' is deprecated}}{{documentation-file=deprecated-declaration}}