Files
swift-mirror/test/decl/protocol/req/deprecated.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

61 lines
1.7 KiB
Swift

// RUN: %target-typecheck-verify-swift
protocol DeprecatedRequirement {
@available(*, deprecated)
func f()
}
extension DeprecatedRequirement {
@available(*, deprecated)
func f() {}
}
// No warning if both the requirement and the default implementation are deprecated
struct S1: DeprecatedRequirement {}
protocol DeprecatedDefault {
func f() // expected-note {{requirement 'f()' declared here}}
}
extension DeprecatedDefault {
@available(*, deprecated)
func f() {} // expected-note {{'f()' declared here}}
}
// expected-warning@+1 {{deprecated default implementation is used to satisfy instance method 'f()' required by protocol 'DeprecatedDefault'}}{{documentation-file=deprecated-declaration}}
struct S2: DeprecatedDefault {}
// No warning if the conformance itself is deprecated
@available(*, deprecated)
struct S3: DeprecatedDefault {
}
struct S4: DeprecatedDefault {
func f() {}
}
struct S5 {}
// No warning if the conformance itself is deprecated
@available(*, deprecated)
extension S5: DeprecatedDefault {}
@available(*, deprecated)
enum UnavailableEnum {
struct Nested: DeprecatedDefault {}
}
// Include message string from @available attribute if provided
protocol DeprecatedDefaultWithMessage {
func f() // expected-note {{requirement 'f()' declared here}}
}
extension DeprecatedDefaultWithMessage {
@available(*, deprecated, message: "write it yourself")
func f() {} // expected-note {{'f()' declared here}}
}
// expected-warning@+1 {{deprecated default implementation is used to satisfy instance method 'f()' required by protocol 'DeprecatedDefaultWithMessage': write it yourself}}{{documentation-file=deprecated-declaration}}
struct S6: DeprecatedDefaultWithMessage {}