[Diagnostics] DeprecatedDeclaration group

This commit is contained in:
Dmitrii Galimzianov
2024-09-13 18:48:30 +02:00
parent 4693a4765f
commit aa5e10f8d2
33 changed files with 375 additions and 346 deletions

View File

@@ -22,12 +22,8 @@
GROUP(no_group, "")
GROUP(deprecated, "deprecated.md")
GROUP_LINK(deprecated, availability_deprecated)
GROUP(availability_deprecated, "availability_deprecated.md")
GROUP(unknown_warning_group, "unknown_warning_group.md")
GROUP(DeprecatedDeclaration, "DeprecatedDeclaration.md")
GROUP(UnknownWarningGroup, "UnknownWarningGroup.md")
#define UNDEFINE_DIAGNOSTIC_GROUPS_MACROS
#include "swift/AST/DefineDiagnosticGroupsMacros.h"

View File

@@ -89,7 +89,7 @@ ERROR(error_missing_arg_value,none,
(StringRef, unsigned))
ERROR(error_unknown_arg,none,
"unknown argument: '%0'", (StringRef))
GROUPED_WARNING(unknown_warning_group, unknown_warning_group, none,
GROUPED_WARNING(unknown_warning_group, UnknownWarningGroup, none,
"unknown warning group: '%0'", (StringRef))
ERROR(error_invalid_arg_value,none,
"invalid value '%1' in '%0'", (StringRef, StringRef))

View File

@@ -3134,10 +3134,11 @@ ERROR(witness_unavailable,none,
"unavailable %kind0 was used to satisfy a requirement of protocol %1%select{|: %2}2",
(const ValueDecl *, const ProtocolDecl *, StringRef))
WARNING(witness_deprecated,none,
"deprecated default implementation is used to satisfy %kind0 required by "
"protocol %1%select{|: %2}2",
(const ValueDecl *, Identifier, StringRef))
GROUPED_WARNING(
witness_deprecated, DeprecatedDeclaration, none,
"deprecated default implementation is used to satisfy %kind0 required by "
"protocol %1%select{|: %2}2",
(const ValueDecl *, Identifier, StringRef))
WARNING(unavailable_conformance,none,
"conformance of %0 to protocol %1 is already unavailable",
@@ -6652,14 +6653,14 @@ NOTE(availability_obsoleted, none,
"%0 was obsoleted in %1 %2",
(const ValueDecl *, StringRef, llvm::VersionTuple))
GROUPED_WARNING(availability_deprecated, availability_deprecated, Deprecation,
GROUPED_WARNING(availability_deprecated, DeprecatedDeclaration, Deprecation,
"%0 %select{is|%select{is|was}3}1 "
"deprecated%select{| in %2%select{| %4}3}1%select{|: %5}5",
(const ValueDecl *, bool, StringRef, bool, llvm::VersionTuple,
StringRef))
GROUPED_WARNING(
availability_deprecated_rename, availability_deprecated, Deprecation,
availability_deprecated_rename, DeprecatedDeclaration, Deprecation,
"%0 %select{is|%select{is|was}3}1 "
"deprecated%select{| in %2%select{| %4}3}1: "
"%select{renamed to|replaced by}5%" REPLACEMENT_DECL_KIND_SELECT "6 "
@@ -6837,11 +6838,12 @@ NOTE(conformance_availability_obsoleted, none,
"conformance of %0 to %1 was obsoleted in %2 %3",
(Type, Type, StringRef, llvm::VersionTuple))
WARNING(conformance_availability_deprecated, Deprecation,
"conformance of %0 to %1 %select{is|%select{is|was}4}2 "
"deprecated%select{| in %3%select{| %5}4}2%select{|: %6}6",
(Type, Type, bool, StringRef, bool, llvm::VersionTuple,
StringRef))
GROUPED_WARNING(conformance_availability_deprecated,
DeprecatedDeclaration, Deprecation,
"conformance of %0 to %1 %select{is|%select{is|was}4}2 "
"deprecated%select{| in %3%select{| %5}4}2%select{|: %6}6",
(Type, Type, bool, StringRef, bool, llvm::VersionTuple,
StringRef))
ERROR(conformance_availability_only_version_newer, none,
"conformance of %0 to %1 is only available in %2 %3 or newer",
@@ -7107,15 +7109,19 @@ ERROR(override_nsobject_hash_error,none,
"'NSObject.hash(into:)' is not overridable; "
"did you mean to override 'NSObject.hash'?", ())
WARNING(hashvalue_implementation,Deprecation,
"'Hashable.hashValue' is deprecated as a protocol requirement; "
"conform type %0 to 'Hashable' by implementing 'hash(into:)' instead",
(Type))
GROUPED_WARNING(
hashvalue_implementation, DeprecatedDeclaration, Deprecation,
"'Hashable.hashValue' is deprecated as a protocol requirement; "
"conform type %0 to 'Hashable' by implementing 'hash(into:)' instead",
(Type))
WARNING(executor_enqueue_deprecated_owned_job_implementation,Deprecation,
"'Executor.enqueue(Job)' is deprecated as a protocol requirement; "
"conform type %0 to 'Executor' by implementing 'func enqueue(ExecutorJob)' instead",
(Type))
GROUPED_WARNING(
executor_enqueue_deprecated_owned_job_implementation,
DeprecatedDeclaration, Deprecation,
"'Executor.enqueue(Job)' is deprecated as a protocol requirement; "
"conform type %0 to 'Executor' by implementing 'func enqueue(ExecutorJob)' "
"instead",
(Type))
WARNING(executor_enqueue_unused_implementation, none,
"'Executor.enqueue(ExecutorJob)' will never be used, due to the presence of "
"'enqueue(UnownedJob)'",

View File

@@ -208,6 +208,10 @@ constexpr bool isGroupInSupergroup() {
return true;
return false;
}
// Check for isGroupInSupergroup itself
static_assert(!isGroupInSupergroup<DiagGroupID::no_group,
DiagGroupID::DeprecatedDeclaration>() &&
"Bug in isGroupInSupergroup");
static_assert(!hasCycle(), "Diagnostic groups graph has a cycle!");
// Sanity check for the "no_group" group
@@ -216,9 +220,15 @@ static_assert(std::get<0>(diagnosticGroupConnections).supergroups.size() == 0,
"no_group isn't a top-level group");
static_assert(std::get<0>(diagnosticGroupConnections).subgroups.size() == 0,
"no_group shouldn't have subgroups");
// Check groups have expected supergroups
static_assert(isGroupInSupergroup<DiagGroupID::availability_deprecated,
DiagGroupID::deprecated>());
// Check groups have associated diagnostics
#define CHECK_NOT_EMPTY(Group) \
static_assert( \
std::get<(uint16_t)DiagGroupID::Group>(diagnosticGroupConnections) \
.diagnostics.size() > 0, \
"'" #Group "' group shouldn't be empty.");
CHECK_NOT_EMPTY(DeprecatedDeclaration)
CHECK_NOT_EMPTY(UnknownWarningGroup)
#undef CHECK_NOT_EMPTY
} // end namespace validation

View File

@@ -90,7 +90,7 @@ func testCaseTrivialValue4() {
// expected-note @-8 {{capturing use}}
}
class Klass: UnsafeSendable { // expected-warning{{'UnsafeSendable' is deprecated: Use @unchecked Sendable instead [availability_deprecated]}}
class Klass: UnsafeSendable { // expected-warning{{'UnsafeSendable' is deprecated: Use @unchecked Sendable instead [DeprecatedDeclaration]}}
var next: Klass? = nil
}
func inoutUserKlass(_ k: inout Klass) {}

View File

@@ -1,7 +1,7 @@
// RUN: %target-swift-frontend -enable-experimental-move-only %s -emit-sil -o /dev/null -verify
// RUN: %target-swift-frontend -enable-experimental-move-only %s -emit-sil -o /dev/null -verify -strict-concurrency=targeted
// RUN: %target-swift-frontend -enable-experimental-move-only %s -emit-sil -o /dev/null -verify -strict-concurrency=complete
// RUN: %target-swift-frontend -enable-experimental-move-only %s -emit-sil -o /dev/null -verify -strict-concurrency=complete -enable-upcoming-feature RegionBasedIsolation
// RUN: %target-swift-frontend -print-diagnostic-groups -enable-experimental-move-only %s -emit-sil -o /dev/null -verify
// RUN: %target-swift-frontend -print-diagnostic-groups -enable-experimental-move-only %s -emit-sil -o /dev/null -verify -strict-concurrency=targeted
// RUN: %target-swift-frontend -print-diagnostic-groups -enable-experimental-move-only %s -emit-sil -o /dev/null -verify -strict-concurrency=complete
// RUN: %target-swift-frontend -print-diagnostic-groups -enable-experimental-move-only %s -emit-sil -o /dev/null -verify -strict-concurrency=complete -enable-upcoming-feature RegionBasedIsolation
// REQUIRES: concurrency
// REQUIRES: OS=macosx
@@ -55,7 +55,7 @@ final class TripleExecutor: SerialExecutor {
// expected-warning@+2{{'Job' is deprecated: renamed to 'ExecutorJob'}}
// expected-note@+1{{use 'ExecutorJob' instead}}
func enqueue(_ job: __owned Job) {} // expected-warning{{'Executor.enqueue(Job)' is deprecated as a protocol requirement; conform type 'TripleExecutor' to 'Executor' by implementing 'func enqueue(ExecutorJob)' instead}}
func enqueue(_ job: __owned Job) {} // expected-warning{{'Executor.enqueue(Job)' is deprecated as a protocol requirement; conform type 'TripleExecutor' to 'Executor' by implementing 'func enqueue(ExecutorJob)' instead [DeprecatedDeclaration]}}
func enqueue(_ job: consuming ExecutorJob) {}

View File

@@ -1,7 +1,7 @@
// RUN: %target-swift-frontend -disable-availability-checking -emit-sil -o /dev/null -verify %s
// RUN: %target-swift-frontend -disable-availability-checking -emit-sil -o /dev/null -verify -strict-concurrency=targeted %s
// RUN: %target-swift-frontend -disable-availability-checking -emit-sil -o /dev/null -verify -strict-concurrency=complete %s
// RUN: %target-swift-frontend -disable-availability-checking -emit-sil -o /dev/null -verify -strict-concurrency=complete -enable-upcoming-feature RegionBasedIsolation %s
// RUN: %target-swift-frontend -print-diagnostic-groups -disable-availability-checking -emit-sil -o /dev/null -verify %s
// RUN: %target-swift-frontend -print-diagnostic-groups -disable-availability-checking -emit-sil -o /dev/null -verify -strict-concurrency=targeted %s
// RUN: %target-swift-frontend -print-diagnostic-groups -disable-availability-checking -emit-sil -o /dev/null -verify -strict-concurrency=complete %s
// RUN: %target-swift-frontend -print-diagnostic-groups -disable-availability-checking -emit-sil -o /dev/null -verify -strict-concurrency=complete -enable-upcoming-feature RegionBasedIsolation %s
// REQUIRES: concurrency
// REQUIRES: asserts
@@ -41,7 +41,7 @@ final class TripleExecutor: SerialExecutor {
// expected-warning@+2{{'Job' is deprecated: renamed to 'ExecutorJob'}}
// expected-note@+1{{use 'ExecutorJob' instead}}
func enqueue(_ job: __owned Job) {} // expected-warning{{'Executor.enqueue(Job)' is deprecated as a protocol requirement; conform type 'TripleExecutor' to 'Executor' by implementing 'func enqueue(ExecutorJob)' instead}}
func enqueue(_ job: __owned Job) {} // expected-warning{{'Executor.enqueue(Job)' is deprecated as a protocol requirement; conform type 'TripleExecutor' to 'Executor' by implementing 'func enqueue(ExecutorJob)' instead [DeprecatedDeclaration]}}
func enqueue(_ job: consuming ExecutorJob) {}
@@ -65,7 +65,7 @@ final class NoneExecutor: SerialExecutor { // expected-error{{type 'NoneExecutor
final class StillDeprecated: SerialExecutor {
// expected-warning@+2{{'Job' is deprecated: renamed to 'ExecutorJob'}}
// expected-note@+1{{use 'ExecutorJob' instead}}
func enqueue(_ job: __owned Job) {} // expected-warning{{'Executor.enqueue(Job)' is deprecated as a protocol requirement; conform type 'StillDeprecated' to 'Executor' by implementing 'func enqueue(ExecutorJob)' instead}}
func enqueue(_ job: __owned Job) {} // expected-warning{{'Executor.enqueue(Job)' is deprecated as a protocol requirement; conform type 'StillDeprecated' to 'Executor' by implementing 'func enqueue(ExecutorJob)' instead [DeprecatedDeclaration]}}
func asUnownedSerialExecutor() -> UnownedSerialExecutor {
UnownedSerialExecutor(ordinary: self)

View File

@@ -10,8 +10,8 @@ extension SLD: ExpressibleByStringLiteral {
init(stringLiteral value: StringLiteralType) {}
}
let _ = SLD(stringLiteral: "") // expected-warning{{'init(stringLiteral:)' is deprecated [availability_deprecated]}}
let _: SLD = "" // expected-warning{{'init(stringLiteral:)' is deprecated [availability_deprecated]}}
let _ = SLD(stringLiteral: "") // expected-warning{{'init(stringLiteral:)' is deprecated [DeprecatedDeclaration]}}
let _: SLD = "" // expected-warning{{'init(stringLiteral:)' is deprecated [DeprecatedDeclaration]}}
struct SLU {}
@@ -30,8 +30,8 @@ extension ILD: ExpressibleByIntegerLiteral {
init(integerLiteral value: IntegerLiteralType) {}
}
let _ = ILD(integerLiteral: 1) // expected-warning{{'init(integerLiteral:)' is deprecated [availability_deprecated]}}
let _: ILD = 1 // expected-warning{{'init(integerLiteral:)' is deprecated [availability_deprecated]}}
let _ = ILD(integerLiteral: 1) // expected-warning{{'init(integerLiteral:)' is deprecated [DeprecatedDeclaration]}}
let _: ILD = 1 // expected-warning{{'init(integerLiteral:)' is deprecated [DeprecatedDeclaration]}}
struct ILU {}
@@ -51,8 +51,8 @@ extension NLD: ExpressibleByNilLiteral {
init(nilLiteral: ()) {}
}
let _: NLD = .init(nilLiteral: ()) // expected-warning{{'init(nilLiteral:)' is deprecated [availability_deprecated]}}
let _: NLD = nil // expected-warning{{'init(nilLiteral:)' is deprecated [availability_deprecated]}}
let _: NLD = .init(nilLiteral: ()) // expected-warning{{'init(nilLiteral:)' is deprecated [DeprecatedDeclaration]}}
let _: NLD = nil // expected-warning{{'init(nilLiteral:)' is deprecated [DeprecatedDeclaration]}}
struct NLU {}
@@ -70,8 +70,8 @@ struct BLD {}
extension BLD: ExpressibleByBooleanLiteral {
init(booleanLiteral value: BooleanLiteralType) {}
}
let _: BLD = .init(booleanLiteral: false) // expected-warning{{'init(booleanLiteral:)' is deprecated [availability_deprecated]}}
let _: BLD = false // expected-warning{{'init(booleanLiteral:)' is deprecated [availability_deprecated]}}
let _: BLD = .init(booleanLiteral: false) // expected-warning{{'init(booleanLiteral:)' is deprecated [DeprecatedDeclaration]}}
let _: BLD = false // expected-warning{{'init(booleanLiteral:)' is deprecated [DeprecatedDeclaration]}}
struct BLU {}
@available(macOS 100, *)
@@ -87,8 +87,8 @@ struct FLD {}
extension FLD: ExpressibleByFloatLiteral {
init(floatLiteral value: FloatLiteralType) {}
}
let _: FLD = .init(floatLiteral: 0.1) // expected-warning{{'init(floatLiteral:)' is deprecated [availability_deprecated]}}
let _: FLD = 0.1 // expected-warning{{'init(floatLiteral:)' is deprecated [availability_deprecated]}}
let _: FLD = .init(floatLiteral: 0.1) // expected-warning{{'init(floatLiteral:)' is deprecated [DeprecatedDeclaration]}}
let _: FLD = 0.1 // expected-warning{{'init(floatLiteral:)' is deprecated [DeprecatedDeclaration]}}
struct FLU {}
@available(macOS 100, *)
@@ -104,8 +104,8 @@ struct ALD {}
extension ALD: ExpressibleByArrayLiteral {
init(arrayLiteral elements: Int...) {}
}
let _: ALD = .init(arrayLiteral: 1) // expected-warning{{'init(arrayLiteral:)' is deprecated [availability_deprecated]}}
let _: ALD = [1] // expected-warning{{'init(arrayLiteral:)' is deprecated [availability_deprecated]}}
let _: ALD = .init(arrayLiteral: 1) // expected-warning{{'init(arrayLiteral:)' is deprecated [DeprecatedDeclaration]}}
let _: ALD = [1] // expected-warning{{'init(arrayLiteral:)' is deprecated [DeprecatedDeclaration]}}
struct ALU {}
@available(macOS 100, *)
@@ -121,8 +121,8 @@ struct DLD {}
extension DLD: ExpressibleByDictionaryLiteral {
init(dictionaryLiteral elements: (Int, Int)...) {}
}
let _: DLD = .init(dictionaryLiteral: (1,1)) // expected-warning{{'init(dictionaryLiteral:)' is deprecated [availability_deprecated]}}
let _: DLD = [1: 1] // expected-warning{{'init(dictionaryLiteral:)' is deprecated [availability_deprecated]}}
let _: DLD = .init(dictionaryLiteral: (1,1)) // expected-warning{{'init(dictionaryLiteral:)' is deprecated [DeprecatedDeclaration]}}
let _: DLD = [1: 1] // expected-warning{{'init(dictionaryLiteral:)' is deprecated [DeprecatedDeclaration]}}
struct DLU {}
@available(macOS 100, *)
@@ -139,8 +139,8 @@ extension USLD: ExpressibleByUnicodeScalarLiteral {
typealias UnicodeScalarLiteralType = Character
init(unicodeScalarLiteral value: UnicodeScalarLiteralType) {}
}
let _: USLD = .init(unicodeScalarLiteral: "a") // expected-warning{{'init(unicodeScalarLiteral:)' is deprecated [availability_deprecated]}}
let _: USLD = "a" // expected-warning{{'init(unicodeScalarLiteral:)' is deprecated [availability_deprecated]}}
let _: USLD = .init(unicodeScalarLiteral: "a") // expected-warning{{'init(unicodeScalarLiteral:)' is deprecated [DeprecatedDeclaration]}}
let _: USLD = "a" // expected-warning{{'init(unicodeScalarLiteral:)' is deprecated [DeprecatedDeclaration]}}
struct USLU {}
@available(macOS 100, *)
@@ -157,8 +157,8 @@ struct GCLD {}
extension GCLD: ExpressibleByExtendedGraphemeClusterLiteral {
init(extendedGraphemeClusterLiteral value: Character) {}
}
let _: GCLD = .init(extendedGraphemeClusterLiteral: "🇧🇷") // expected-warning{{'init(extendedGraphemeClusterLiteral:)' is deprecated [availability_deprecated]}}
let _: GCLD = "🇧🇷" // expected-warning{{'init(extendedGraphemeClusterLiteral:)' is deprecated [availability_deprecated]}}
let _: GCLD = .init(extendedGraphemeClusterLiteral: "🇧🇷") // expected-warning{{'init(extendedGraphemeClusterLiteral:)' is deprecated [DeprecatedDeclaration]}}
let _: GCLD = "🇧🇷" // expected-warning{{'init(extendedGraphemeClusterLiteral:)' is deprecated [DeprecatedDeclaration]}}
struct GCLU {}
@available(macOS 100, *)

View File

@@ -2,6 +2,6 @@
// RUN: -disable-availability-checking \
// RUN: -print-diagnostic-groups
struct S : _BitwiseCopyable {} // expected-warning {{'_BitwiseCopyable' is deprecated: Use BitwiseCopyable [availability_deprecated]}}
struct S : _BitwiseCopyable {} // expected-warning {{'_BitwiseCopyable' is deprecated: Use BitwiseCopyable [DeprecatedDeclaration]}}
func f<T : _BitwiseCopyable>(_ t: T) {} // expected-warning {{'_BitwiseCopyable' is deprecated: Use BitwiseCopyable [availability_deprecated]}}
func f<T : _BitwiseCopyable>(_ t: T) {} // expected-warning {{'_BitwiseCopyable' is deprecated: Use BitwiseCopyable [DeprecatedDeclaration]}}

View File

@@ -1,4 +1,4 @@
// RUN: %target-typecheck-verify-swift -swift-version 6
// RUN: %target-typecheck-verify-swift -print-diagnostic-groups -swift-version 6
// REQUIRES: OS=macosx
@@ -166,12 +166,12 @@ public struct HasDeprecatedConformance1 {}
extension HasDeprecatedConformance1 : Horse {}
func passDeprecatedConformance1(x: HasDeprecatedConformance1) {
takesHorse(x) // expected-warning {{conformance of 'HasDeprecatedConformance1' to 'Horse' is deprecated}}
takesHorseExistential(x) // expected-warning {{conformance of 'HasDeprecatedConformance1' to 'Horse' is deprecated}}
x.giddyUp() // expected-warning {{conformance of 'HasDeprecatedConformance1' to 'Horse' is deprecated}}
_ = x.isGalloping // expected-warning {{conformance of 'HasDeprecatedConformance1' to 'Horse' is deprecated}}
_ = x[keyPath: \.isGalloping] // expected-warning {{conformance of 'HasDeprecatedConformance1' to 'Horse' is deprecated}}
_ = UsesHorse<HasDeprecatedConformance1>.self // expected-warning {{conformance of 'HasDeprecatedConformance1' to 'Horse' is deprecated}}
takesHorse(x) // expected-warning {{conformance of 'HasDeprecatedConformance1' to 'Horse' is deprecated [DeprecatedDeclaration]}}
takesHorseExistential(x) // expected-warning {{conformance of 'HasDeprecatedConformance1' to 'Horse' is deprecated [DeprecatedDeclaration]}}
x.giddyUp() // expected-warning {{conformance of 'HasDeprecatedConformance1' to 'Horse' is deprecated [DeprecatedDeclaration]}}
_ = x.isGalloping // expected-warning {{conformance of 'HasDeprecatedConformance1' to 'Horse' is deprecated [DeprecatedDeclaration]}}
_ = x[keyPath: \.isGalloping] // expected-warning {{conformance of 'HasDeprecatedConformance1' to 'Horse' is deprecated [DeprecatedDeclaration]}}
_ = UsesHorse<HasDeprecatedConformance1>.self // expected-warning {{conformance of 'HasDeprecatedConformance1' to 'Horse' is deprecated [DeprecatedDeclaration]}}
}
@available(*, deprecated)
@@ -191,12 +191,12 @@ public struct HasDeprecatedConformance2 {}
extension HasDeprecatedConformance2 : Horse {}
func passDeprecatedConformance2(x: HasDeprecatedConformance2) {
takesHorse(x) // expected-warning {{conformance of 'HasDeprecatedConformance2' to 'Horse' is deprecated: This conformance is deprecated}}
takesHorseExistential(x) // expected-warning {{conformance of 'HasDeprecatedConformance2' to 'Horse' is deprecated: This conformance is deprecated}}
x.giddyUp() // expected-warning {{conformance of 'HasDeprecatedConformance2' to 'Horse' is deprecated: This conformance is deprecated}}
_ = x.isGalloping // expected-warning {{conformance of 'HasDeprecatedConformance2' to 'Horse' is deprecated: This conformance is deprecated}}
_ = x[keyPath: \.isGalloping] // expected-warning {{conformance of 'HasDeprecatedConformance2' to 'Horse' is deprecated: This conformance is deprecated}}
_ = UsesHorse<HasDeprecatedConformance2>.self // expected-warning {{conformance of 'HasDeprecatedConformance2' to 'Horse' is deprecated: This conformance is deprecated}}
takesHorse(x) // expected-warning {{conformance of 'HasDeprecatedConformance2' to 'Horse' is deprecated: This conformance is deprecated [DeprecatedDeclaration]}}
takesHorseExistential(x) // expected-warning {{conformance of 'HasDeprecatedConformance2' to 'Horse' is deprecated: This conformance is deprecated [DeprecatedDeclaration]}}
x.giddyUp() // expected-warning {{conformance of 'HasDeprecatedConformance2' to 'Horse' is deprecated: This conformance is deprecated [DeprecatedDeclaration]}}
_ = x.isGalloping // expected-warning {{conformance of 'HasDeprecatedConformance2' to 'Horse' is deprecated: This conformance is deprecated [DeprecatedDeclaration]}}
_ = x[keyPath: \.isGalloping] // expected-warning {{conformance of 'HasDeprecatedConformance2' to 'Horse' is deprecated: This conformance is deprecated [DeprecatedDeclaration]}}
_ = UsesHorse<HasDeprecatedConformance2>.self // expected-warning {{conformance of 'HasDeprecatedConformance2' to 'Horse' is deprecated: This conformance is deprecated [DeprecatedDeclaration]}}
}
@available(*, deprecated)
@@ -216,12 +216,12 @@ public struct HasDeprecatedConformance3 {}
extension HasDeprecatedConformance3 : Horse {}
func passDeprecatedConformance3(x: HasDeprecatedConformance3) {
takesHorse(x) // expected-warning {{conformance of 'HasDeprecatedConformance3' to 'Horse' was deprecated in macOS 10.8}}
takesHorseExistential(x) // expected-warning {{conformance of 'HasDeprecatedConformance3' to 'Horse' was deprecated in macOS 10.8}}
x.giddyUp() // expected-warning {{conformance of 'HasDeprecatedConformance3' to 'Horse' was deprecated in macOS 10.8}}
_ = x.isGalloping // expected-warning {{conformance of 'HasDeprecatedConformance3' to 'Horse' was deprecated in macOS 10.8}}
_ = x[keyPath: \.isGalloping] // expected-warning {{conformance of 'HasDeprecatedConformance3' to 'Horse' was deprecated in macOS 10.8}}
_ = UsesHorse<HasDeprecatedConformance3>.self // expected-warning {{conformance of 'HasDeprecatedConformance3' to 'Horse' was deprecated in macOS 10.8}}
takesHorse(x) // expected-warning {{conformance of 'HasDeprecatedConformance3' to 'Horse' was deprecated in macOS 10.8 [DeprecatedDeclaration]}}
takesHorseExistential(x) // expected-warning {{conformance of 'HasDeprecatedConformance3' to 'Horse' was deprecated in macOS 10.8 [DeprecatedDeclaration]}}
x.giddyUp() // expected-warning {{conformance of 'HasDeprecatedConformance3' to 'Horse' was deprecated in macOS 10.8 [DeprecatedDeclaration]}}
_ = x.isGalloping // expected-warning {{conformance of 'HasDeprecatedConformance3' to 'Horse' was deprecated in macOS 10.8 [DeprecatedDeclaration]}}
_ = x[keyPath: \.isGalloping] // expected-warning {{conformance of 'HasDeprecatedConformance3' to 'Horse' was deprecated in macOS 10.8 [DeprecatedDeclaration]}}
_ = UsesHorse<HasDeprecatedConformance3>.self // expected-warning {{conformance of 'HasDeprecatedConformance3' to 'Horse' was deprecated in macOS 10.8 [DeprecatedDeclaration]}}
}
func passDeprecatedConformance3a(x: HasDeprecatedConformance3) {
@@ -301,7 +301,7 @@ struct AssocConformanceUnavailable : Rider {
// Associated conformance with deprecation
struct AssocConformanceDeprecated : Rider {
// expected-warning@-1 {{conformance of 'HasDeprecatedConformance1' to 'Horse' is deprecated}}
// expected-warning@-1 {{conformance of 'HasDeprecatedConformance1' to 'Horse' is deprecated [DeprecatedDeclaration]}}
// expected-note@-2 {{in associated type 'Self.H' (inferred as 'HasDeprecatedConformance1')}}
typealias H = HasDeprecatedConformance1
}

View File

@@ -26,11 +26,11 @@ func useClassThatTriggersImportOfDeprecatedEnum() {
}
func directUseShouldStillTriggerDeprecationWarning() {
_ = NSDeprecatedOptions.first // expected-warning {{'NSDeprecatedOptions' was deprecated in macOS 51: Use a different API [availability_deprecated]}}
_ = NSDeprecatedEnum.first // expected-warning {{'NSDeprecatedEnum' was deprecated in macOS 51: Use a different API [availability_deprecated]}}
_ = NSDeprecatedOptions.first // expected-warning {{'NSDeprecatedOptions' was deprecated in macOS 51: Use a different API [DeprecatedDeclaration]}}
_ = NSDeprecatedEnum.first // expected-warning {{'NSDeprecatedEnum' was deprecated in macOS 51: Use a different API [DeprecatedDeclaration]}}
}
func useInSignature(options: NSDeprecatedOptions) { // expected-warning {{'NSDeprecatedOptions' was deprecated in macOS 51: Use a different API [availability_deprecated]}}
func useInSignature(options: NSDeprecatedOptions) { // expected-warning {{'NSDeprecatedOptions' was deprecated in macOS 51: Use a different API [DeprecatedDeclaration]}}
}
@@ -83,20 +83,20 @@ class ClassWithComputedPropertyDeprecatedIn51 {
}
}
var unannotatedPropertyDeprecatedIn51 : ClassDeprecatedIn51 { // expected-warning {{ClassDeprecatedIn51' was deprecated in macOS 51 [availability_deprecated]}}
var unannotatedPropertyDeprecatedIn51 : ClassDeprecatedIn51 { // expected-warning {{ClassDeprecatedIn51' was deprecated in macOS 51 [DeprecatedDeclaration]}}
get {
return ClassDeprecatedIn51() // expected-warning {{ClassDeprecatedIn51' was deprecated in macOS 51 [availability_deprecated]}}
return ClassDeprecatedIn51() // expected-warning {{ClassDeprecatedIn51' was deprecated in macOS 51 [DeprecatedDeclaration]}}
}
set(newValue) {
_ = ClassDeprecatedIn51() // expected-warning {{ClassDeprecatedIn51' was deprecated in macOS 51 [availability_deprecated]}}
_ = ClassDeprecatedIn51() // expected-warning {{ClassDeprecatedIn51' was deprecated in macOS 51 [DeprecatedDeclaration]}}
}
}
var unannotatedStoredPropertyOfTypeDeprecatedIn51 : ClassDeprecatedIn51? = nil // expected-warning {{ClassDeprecatedIn51' was deprecated in macOS 51 [availability_deprecated]}}
var unannotatedStoredPropertyOfTypeDeprecatedIn51 : ClassDeprecatedIn51? = nil // expected-warning {{ClassDeprecatedIn51' was deprecated in macOS 51 [DeprecatedDeclaration]}}
}
func usesFunctionDeprecatedIn51() {
_ = ClassDeprecatedIn51() // expected-warning {{ClassDeprecatedIn51' was deprecated in macOS 51 [availability_deprecated]}}
_ = ClassDeprecatedIn51() // expected-warning {{ClassDeprecatedIn51' was deprecated in macOS 51 [DeprecatedDeclaration]}}
}
@available(OSX, introduced: 10.8, deprecated: 51)
@@ -104,34 +104,34 @@ func annotatedUsesFunctionDeprecatedIn51() {
_ = ClassDeprecatedIn51()
}
func hasParameterDeprecatedIn51(p: ClassDeprecatedIn51) { // expected-warning {{ClassDeprecatedIn51' was deprecated in macOS 51 [availability_deprecated]}}
func hasParameterDeprecatedIn51(p: ClassDeprecatedIn51) { // expected-warning {{ClassDeprecatedIn51' was deprecated in macOS 51 [DeprecatedDeclaration]}}
}
@available(OSX, introduced: 10.8, deprecated: 51)
func annotatedHasParameterDeprecatedIn51(p: ClassDeprecatedIn51) {
}
func hasReturnDeprecatedIn51() -> ClassDeprecatedIn51 { // expected-warning {{ClassDeprecatedIn51' was deprecated in macOS 51 [availability_deprecated]}}
func hasReturnDeprecatedIn51() -> ClassDeprecatedIn51 { // expected-warning {{ClassDeprecatedIn51' was deprecated in macOS 51 [DeprecatedDeclaration]}}
}
@available(OSX, introduced: 10.8, deprecated: 51)
func annotatedHasReturnDeprecatedIn51() -> ClassDeprecatedIn51 {
}
var globalWithDeprecatedType : ClassDeprecatedIn51? = nil // expected-warning {{ClassDeprecatedIn51' was deprecated in macOS 51 [availability_deprecated]}}
var globalWithDeprecatedType : ClassDeprecatedIn51? = nil // expected-warning {{ClassDeprecatedIn51' was deprecated in macOS 51 [DeprecatedDeclaration]}}
@available(OSX, introduced: 10.8, deprecated: 51)
var annotatedGlobalWithDeprecatedType : ClassDeprecatedIn51?
enum EnumWithDeprecatedCasePayload {
case WithDeprecatedPayload(p: ClassDeprecatedIn51) // expected-warning {{ClassDeprecatedIn51' was deprecated in macOS 51 [availability_deprecated]}}
case WithDeprecatedPayload(p: ClassDeprecatedIn51) // expected-warning {{ClassDeprecatedIn51' was deprecated in macOS 51 [DeprecatedDeclaration]}}
@available(OSX, introduced: 10.8, deprecated: 51)
case AnnotatedWithDeprecatedPayload(p: ClassDeprecatedIn51)
}
extension ClassDeprecatedIn51 { // expected-warning {{'ClassDeprecatedIn51' was deprecated in macOS 51 [availability_deprecated]}}
extension ClassDeprecatedIn51 { // expected-warning {{'ClassDeprecatedIn51' was deprecated in macOS 51 [DeprecatedDeclaration]}}
}
@@ -142,9 +142,9 @@ extension ClassDeprecatedIn51 {
}
func callMethodInDeprecatedExtension() {
let o = ClassDeprecatedIn51() // expected-warning {{'ClassDeprecatedIn51' was deprecated in macOS 51 [availability_deprecated]}}
let o = ClassDeprecatedIn51() // expected-warning {{'ClassDeprecatedIn51' was deprecated in macOS 51 [DeprecatedDeclaration]}}
o.methodInExtensionOfClassDeprecatedIn51() // expected-warning {{'methodInExtensionOfClassDeprecatedIn51()' was deprecated in macOS 51 [availability_deprecated]}}
o.methodInExtensionOfClassDeprecatedIn51() // expected-warning {{'methodInExtensionOfClassDeprecatedIn51()' was deprecated in macOS 51 [DeprecatedDeclaration]}}
}
func functionWithDeprecatedMethodInDeadElseBranch() {
@@ -179,7 +179,7 @@ class I59843_A {
func method(with: Int) {}
func f() {
self.method(a: "a", b: "b") // expected-warning{{'method(a:b:)' was deprecated in macOS 51: renamed to 'method(with:)' [availability_deprecated]}}
self.method(a: "a", b: "b") // expected-warning{{'method(a:b:)' was deprecated in macOS 51: renamed to 'method(with:)' [DeprecatedDeclaration]}}
// expected-note@-1{{use 'method(with:)' instead}} {{none}}
}
}
@@ -207,18 +207,18 @@ class I59843_B {
static func contextDiff(with: Int, and: Int) {}
func f() {
self.method(a: "a", b: "b") // expected-warning{{'method(a:b:)' was deprecated in macOS 51: renamed to 'method(with:and:)' [availability_deprecated]}}
self.method(a: "a", b: "b") // expected-warning{{'method(a:b:)' was deprecated in macOS 51: renamed to 'method(with:and:)' [DeprecatedDeclaration]}}
// expected-note@-1{{use 'method(with:and:)' instead}} {{17-18=with}} {{25-26=and}}
}
}
func I59843_f() {
I59843_A.configure(a: "a", b: "b") // expected-warning{{'configure(a:b:)' was deprecated in macOS 51: renamed to 'configure(with:)' [availability_deprecated]}}
I59843_A.configure(a: "a", b: "b") // expected-warning{{'configure(a:b:)' was deprecated in macOS 51: renamed to 'configure(with:)' [DeprecatedDeclaration]}}
// expected-note@-1{{use 'configure(with:)' instead}} {{none}}
I59843_B.configure(a: "a", b: "b") // expected-warning{{'configure(a:b:)' was deprecated in macOS 51: renamed to 'configure(with:and:)' [availability_deprecated]}}
I59843_B.configure(a: "a", b: "b") // expected-warning{{'configure(a:b:)' was deprecated in macOS 51: renamed to 'configure(with:and:)' [DeprecatedDeclaration]}}
// expected-note@-1{{use 'configure(with:and:)' instead}} {{22-23=with}} {{30-31=and}}
I59843_B.context(a: "a", b: "b") // expected-warning{{'context(a:b:)' was deprecated in macOS 51: replaced by 'I59843_B.context(with:and:)' [availability_deprecated]}}
I59843_B.context(a: "a", b: "b") // expected-warning{{'context(a:b:)' was deprecated in macOS 51: replaced by 'I59843_B.context(with:and:)' [DeprecatedDeclaration]}}
// expected-note@-1{{use 'I59843_B.context(with:and:)' instead}} {{20-21=with}} {{28-29=and}}
I59843_B.contextDiff(a: "a", b: "b") // expected-warning{{'contextDiff(a:b:)' was deprecated in macOS 51: replaced by 'I59843_A.contextDiff(with:and:)' [availability_deprecated]}}
I59843_B.contextDiff(a: "a", b: "b") // expected-warning{{'contextDiff(a:b:)' was deprecated in macOS 51: replaced by 'I59843_A.contextDiff(with:and:)' [DeprecatedDeclaration]}}
// expected-note@-1{{use 'I59843_A.contextDiff(with:and:)' instead}} {{3-23=I59843_A.contextDiff}} {{24-25=with}} {{32-33=and}}
}

View File

@@ -6,16 +6,16 @@ extension DefaultStringInterpolation {
// Make sure diagnostics emitted via string interpolations have a reasonable source location
_ = "\(deprecated: 42)" // expected-warning@:7 {{'appendInterpolation(deprecated:)' is deprecated [availability_deprecated]}}
_ = "\(deprecated: 42)" // expected-warning@:7 {{'appendInterpolation(deprecated:)' is deprecated [DeprecatedDeclaration]}}
_ = "hello, world\(deprecated: 42)!!!" // expected-warning@:19 {{'appendInterpolation(deprecated:)' is deprecated [availability_deprecated]}}
_ = "hello, world\(deprecated: 42)!!!" // expected-warning@:19 {{'appendInterpolation(deprecated:)' is deprecated [DeprecatedDeclaration]}}
_ = "\(42)\(deprecated: 42)test\(deprecated: 42)"
// expected-warning@-1:12 {{'appendInterpolation(deprecated:)' is deprecated [availability_deprecated]}}
// expected-warning@-2:33 {{'appendInterpolation(deprecated:)' is deprecated [availability_deprecated]}}
// expected-warning@-1:12 {{'appendInterpolation(deprecated:)' is deprecated [DeprecatedDeclaration]}}
// expected-warning@-2:33 {{'appendInterpolation(deprecated:)' is deprecated [DeprecatedDeclaration]}}
_ = """
This is a multiline literal with a deprecated interpolation:
\(deprecated: 42)
"""
// expected-warning@-2:2 {{'appendInterpolation(deprecated:)' is deprecated [availability_deprecated]}}
// expected-warning@-2:2 {{'appendInterpolation(deprecated:)' is deprecated [DeprecatedDeclaration]}}

View File

@@ -1,4 +1,4 @@
// RUN: %target-swift-frontend -typecheck -verify -primary-file %s %S/Inputs/struct_equatable_hashable_other.swift -verify-ignore-unknown -swift-version 4
// RUN: %target-swift-frontend -typecheck -verify -print-diagnostic-groups -primary-file %s %S/Inputs/struct_equatable_hashable_other.swift -verify-ignore-unknown -swift-version 4
var hasher = Hasher()
@@ -276,7 +276,7 @@ struct OldSchoolStruct: Hashable {
return true
}
var hashValue: Int { return 42 }
// expected-warning@-1{{'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'OldSchoolStruct' to 'Hashable' by implementing 'hash(into:)' instead}}
// expected-warning@-1{{'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'OldSchoolStruct' to 'Hashable' by implementing 'hash(into:)' instead [DeprecatedDeclaration]}}
}
enum OldSchoolEnum: Hashable {
case foo
@@ -286,14 +286,14 @@ enum OldSchoolEnum: Hashable {
return true
}
var hashValue: Int { return 23 }
// expected-warning@-1{{'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'OldSchoolEnum' to 'Hashable' by implementing 'hash(into:)' instead}}
// expected-warning@-1{{'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'OldSchoolEnum' to 'Hashable' by implementing 'hash(into:)' instead [DeprecatedDeclaration]}}
}
class OldSchoolClass: Hashable {
static func ==(left: OldSchoolClass, right: OldSchoolClass) -> Bool {
return true
}
var hashValue: Int { return -9000 }
// expected-warning@-1{{'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'OldSchoolClass' to 'Hashable' by implementing 'hash(into:)' instead}}
// expected-warning@-1{{'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'OldSchoolClass' to 'Hashable' by implementing 'hash(into:)' instead [DeprecatedDeclaration]}}
}
// However, it's okay to implement `hashValue` as long as `hash(into:)` is also

View File

@@ -191,8 +191,8 @@ func deprecated_func_with_message() {}
struct DeprecatedTypeWithMessage { }
func use_deprecated_with_message() {
deprecated_func_with_message() // expected-warning{{'deprecated_func_with_message()' is deprecated: Say \"Hi\" [availability_deprecated]}}
var _: DeprecatedTypeWithMessage // expected-warning{{'DeprecatedTypeWithMessage' is deprecated: Pandas \u{1F43C} are cute [availability_deprecated]}}
deprecated_func_with_message() // expected-warning{{'deprecated_func_with_message()' is deprecated: Say \"Hi\" [DeprecatedDeclaration]}}
var _: DeprecatedTypeWithMessage // expected-warning{{'DeprecatedTypeWithMessage' is deprecated: Pandas \u{1F43C} are cute [DeprecatedDeclaration]}}
}
@available(*, deprecated, message: "message")
@@ -210,16 +210,16 @@ func deprecated_func_with_message_renamed() {}
struct DeprecatedTypeWithRename { }
func use_deprecated_with_renamed() {
deprecated_func_with_renamed() // expected-warning{{'deprecated_func_with_renamed()' is deprecated: renamed to 'blarg' [availability_deprecated]}}
deprecated_func_with_renamed() // expected-warning{{'deprecated_func_with_renamed()' is deprecated: renamed to 'blarg' [DeprecatedDeclaration]}}
// expected-note@-1{{use 'blarg'}}{{3-31=blarg}}
Test.deprecated_func_with_renamed() // expected-warning{{'deprecated_func_with_renamed()' is deprecated: renamed to 'blarg' [availability_deprecated]}}
Test.deprecated_func_with_renamed() // expected-warning{{'deprecated_func_with_renamed()' is deprecated: renamed to 'blarg' [DeprecatedDeclaration]}}
// expected-note@-1{{use 'blarg' instead}}
deprecated_func_with_message_renamed() //expected-warning{{'deprecated_func_with_message_renamed()' is deprecated: blarg is your friend [availability_deprecated]}}
deprecated_func_with_message_renamed() //expected-warning{{'deprecated_func_with_message_renamed()' is deprecated: blarg is your friend [DeprecatedDeclaration]}}
// expected-note@-1{{use 'blarg'}}{{3-39=blarg}}
var _: DeprecatedTypeWithRename // expected-warning{{'DeprecatedTypeWithRename' is deprecated: renamed to 'wobble' [availability_deprecated]}}
var _: DeprecatedTypeWithRename // expected-warning{{'DeprecatedTypeWithRename' is deprecated: renamed to 'wobble' [DeprecatedDeclaration]}}
// expected-note@-1{{use 'wobble'}}{{10-34=wobble}}
}
@@ -304,7 +304,7 @@ func -(x: DummyType, y: DummyType) {}
func testOperators(x: DummyType, y: DummyType) {
x + y // expected-error {{'+' has been renamed to '&+'}} {{5-6=&+}}
x - y // expected-warning {{'-' is deprecated: renamed to '&-' [availability_deprecated]}} expected-note {{use '&-' instead}} {{5-6=&-}}
x - y // expected-warning {{'-' is deprecated: renamed to '&-' [DeprecatedDeclaration]}} expected-note {{use '&-' instead}} {{5-6=&-}}
}
@available(*, unavailable, renamed: "DummyType.foo")
@@ -321,11 +321,11 @@ typealias DeprecatedType = Int
func testGlobalToMembers() {
unavailableMember() // expected-error {{'unavailableMember()' has been renamed to 'DummyType.foo'}} {{3-20=DummyType.foo}}
deprecatedMember() // expected-warning {{'deprecatedMember()' is deprecated: renamed to 'DummyType.bar' [availability_deprecated]}} expected-note {{use 'DummyType.bar' instead}} {{3-19=DummyType.bar}}
deprecatedMember() // expected-warning {{'deprecatedMember()' is deprecated: renamed to 'DummyType.bar' [DeprecatedDeclaration]}} expected-note {{use 'DummyType.bar' instead}} {{3-19=DummyType.bar}}
unavailableNestedMember() // expected-error {{'unavailableNestedMember()' has been renamed to 'DummyType.Inner.foo'}} {{3-26=DummyType.Inner.foo}}
let x: UnavailableType? = nil // expected-error {{'UnavailableType' has been renamed to 'DummyType.Foo'}} {{10-25=DummyType.Foo}}
_ = x
let y: DeprecatedType? = nil // expected-warning {{'DeprecatedType' is deprecated: renamed to 'DummyType.Bar' [availability_deprecated]}} expected-note {{use 'DummyType.Bar' instead}} {{10-24=DummyType.Bar}}
let y: DeprecatedType? = nil // expected-warning {{'DeprecatedType' is deprecated: renamed to 'DummyType.Bar' [DeprecatedDeclaration]}} expected-note {{use 'DummyType.Bar' instead}} {{10-24=DummyType.Bar}}
_ = y
}
@@ -374,13 +374,13 @@ func unavailableNestedInit(a: Int) {} // expected-note 2 {{here}}
func testArgNames() {
unavailableArgNames(a: 0) // expected-error {{'unavailableArgNames(a:)' has been renamed to 'shinyLabeledArguments(example:)'}} {{3-22=shinyLabeledArguments}} {{23-24=example}}
deprecatedArgNames(b: 1) // expected-warning {{'deprecatedArgNames(b:)' is deprecated: renamed to 'moreShinyLabeledArguments(example:)' [availability_deprecated]}} expected-note {{use 'moreShinyLabeledArguments(example:)' instead}} {{3-21=moreShinyLabeledArguments}} {{22-23=example}}
deprecatedArgNames(b: 1) // expected-warning {{'deprecatedArgNames(b:)' is deprecated: renamed to 'moreShinyLabeledArguments(example:)' [DeprecatedDeclaration]}} expected-note {{use 'moreShinyLabeledArguments(example:)' instead}} {{3-21=moreShinyLabeledArguments}} {{22-23=example}}
unavailableMemberArgNames(a: 0) // expected-error {{'unavailableMemberArgNames(a:)' has been replaced by 'DummyType.shinyLabeledArguments(example:)'}} {{3-28=DummyType.shinyLabeledArguments}} {{29-30=example}}
deprecatedMemberArgNames(b: 1) // expected-warning {{'deprecatedMemberArgNames(b:)' is deprecated: replaced by 'DummyType.moreShinyLabeledArguments(example:)' [availability_deprecated]}} expected-note {{use 'DummyType.moreShinyLabeledArguments(example:)' instead}} {{3-27=DummyType.moreShinyLabeledArguments}} {{28-29=example}}
deprecatedMemberArgNames(b: 1) // expected-warning {{'deprecatedMemberArgNames(b:)' is deprecated: replaced by 'DummyType.moreShinyLabeledArguments(example:)' [DeprecatedDeclaration]}} expected-note {{use 'DummyType.moreShinyLabeledArguments(example:)' instead}} {{3-27=DummyType.moreShinyLabeledArguments}} {{28-29=example}}
unavailableMemberArgNamesMsg(a: 0) // expected-error {{'unavailableMemberArgNamesMsg(a:)' has been replaced by 'DummyType.shinyLabeledArguments(example:)': ha}} {{3-31=DummyType.shinyLabeledArguments}} {{32-33=example}}
deprecatedMemberArgNamesMsg(b: 1) // expected-warning {{'deprecatedMemberArgNamesMsg(b:)' is deprecated: ha [availability_deprecated]}} expected-note {{use 'DummyType.moreShinyLabeledArguments(example:)' instead}} {{3-30=DummyType.moreShinyLabeledArguments}} {{31-32=example}}
deprecatedMemberArgNamesMsg(b: 1) // expected-warning {{'deprecatedMemberArgNamesMsg(b:)' is deprecated: ha [DeprecatedDeclaration]}} expected-note {{use 'DummyType.moreShinyLabeledArguments(example:)' instead}} {{3-30=DummyType.moreShinyLabeledArguments}} {{31-32=example}}
unavailableNoArgs() // expected-error {{'unavailableNoArgs()' has been renamed to 'shinyLabeledArguments()'}} {{3-20=shinyLabeledArguments}}
unavailableSame(a: 0) // expected-error {{'unavailableSame(a:)' has been renamed to 'shinyLabeledArguments(a:)'}} {{3-18=shinyLabeledArguments}}
@@ -452,8 +452,8 @@ func testRenameInstance() {
unavailableInstance(a: 0 + 0) // expected-error{{'unavailableInstance(a:)' has been replaced by instance method 'Int.foo()'}} {{3-22=(0 + 0).foo}} {{23-31=}}
unavailableInstanceMessage(a: 0) // expected-error{{'unavailableInstanceMessage(a:)' has been replaced by instance method 'Int.foo()': blah}} {{3-29=0.foo}} {{30-34=}}
deprecatedInstance(a: 0) // expected-warning{{'deprecatedInstance(a:)' is deprecated: replaced by instance method 'Int.foo()' [availability_deprecated]}} expected-note{{use 'Int.foo()' instead}} {{3-21=0.foo}} {{22-26=}}
deprecatedInstanceMessage(a: 0) // expected-warning{{'deprecatedInstanceMessage(a:)' is deprecated: blah [availability_deprecated]}} expected-note{{use 'Int.foo()' instead}} {{3-28=0.foo}} {{29-33=}}
deprecatedInstance(a: 0) // expected-warning{{'deprecatedInstance(a:)' is deprecated: replaced by instance method 'Int.foo()' [DeprecatedDeclaration]}} expected-note{{use 'Int.foo()' instead}} {{3-21=0.foo}} {{22-26=}}
deprecatedInstanceMessage(a: 0) // expected-warning{{'deprecatedInstanceMessage(a:)' is deprecated: blah [DeprecatedDeclaration]}} expected-note{{use 'Int.foo()' instead}} {{3-28=0.foo}} {{29-33=}}
unavailableNestedInstance(a: 0) // expected-error{{'unavailableNestedInstance(a:)' has been replaced by instance method 'Foo.Bar.foo()'}} {{3-28=0.foo}} {{29-33=}}
}
@@ -519,13 +519,13 @@ func testRenameGetters() {
unavailableClassPropertyMessage() // expected-error{{'unavailableClassPropertyMessage()' has been replaced by property 'Int.prop': blah}} {{3-34=Int.prop}} {{34-36=}}
unavailableGlobalPropertyMessage() // expected-error{{'unavailableGlobalPropertyMessage()' has been replaced by 'global': blah}} {{3-35=global}} {{35-37=}}
deprecatedInstanceProperty(a: 1) // expected-warning {{'deprecatedInstanceProperty(a:)' is deprecated: replaced by property 'Int.prop' [availability_deprecated]}} expected-note{{use 'Int.prop' instead}} {{3-29=1.prop}} {{29-35=}}
deprecatedClassProperty() // expected-warning {{'deprecatedClassProperty()' is deprecated: replaced by property 'Int.prop' [availability_deprecated]}} expected-note{{use 'Int.prop' instead}} {{3-26=Int.prop}} {{26-28=}}
deprecatedGlobalProperty() // expected-warning {{'deprecatedGlobalProperty()' is deprecated: replaced by 'global' [availability_deprecated]}} expected-note{{use 'global' instead}} {{3-27=global}} {{27-29=}}
deprecatedInstanceProperty(a: 1) // expected-warning {{'deprecatedInstanceProperty(a:)' is deprecated: replaced by property 'Int.prop' [DeprecatedDeclaration]}} expected-note{{use 'Int.prop' instead}} {{3-29=1.prop}} {{29-35=}}
deprecatedClassProperty() // expected-warning {{'deprecatedClassProperty()' is deprecated: replaced by property 'Int.prop' [DeprecatedDeclaration]}} expected-note{{use 'Int.prop' instead}} {{3-26=Int.prop}} {{26-28=}}
deprecatedGlobalProperty() // expected-warning {{'deprecatedGlobalProperty()' is deprecated: replaced by 'global' [DeprecatedDeclaration]}} expected-note{{use 'global' instead}} {{3-27=global}} {{27-29=}}
deprecatedInstancePropertyMessage(a: 1) // expected-warning {{'deprecatedInstancePropertyMessage(a:)' is deprecated: blah [availability_deprecated]}} expected-note{{use 'Int.prop' instead}} {{3-36=1.prop}} {{36-42=}}
deprecatedClassPropertyMessage() // expected-warning {{'deprecatedClassPropertyMessage()' is deprecated: blah [availability_deprecated]}} expected-note{{use 'Int.prop' instead}} {{3-33=Int.prop}} {{33-35=}}
deprecatedGlobalPropertyMessage() // expected-warning {{'deprecatedGlobalPropertyMessage()' is deprecated: blah [availability_deprecated]}} expected-note{{use 'global' instead}} {{3-34=global}} {{34-36=}}
deprecatedInstancePropertyMessage(a: 1) // expected-warning {{'deprecatedInstancePropertyMessage(a:)' is deprecated: blah [DeprecatedDeclaration]}} expected-note{{use 'Int.prop' instead}} {{3-36=1.prop}} {{36-42=}}
deprecatedClassPropertyMessage() // expected-warning {{'deprecatedClassPropertyMessage()' is deprecated: blah [DeprecatedDeclaration]}} expected-note{{use 'Int.prop' instead}} {{3-33=Int.prop}} {{33-35=}}
deprecatedGlobalPropertyMessage() // expected-warning {{'deprecatedGlobalPropertyMessage()' is deprecated: blah [DeprecatedDeclaration]}} expected-note{{use 'global' instead}} {{3-34=global}} {{34-36=}}
}
@available(*, unavailable, renamed: "setter:Int.prop(self:_:)")
@@ -636,7 +636,7 @@ class DeprecatedInitBase {
convenience init(testSelf: Int) {
// https://github.com/apple/swift/issues/57354
// The fix-it should not remove `.init`
self.init(old: testSelf) // expected-warning {{'init(old:)' is deprecated: replaced by 'init(new:)' [availability_deprecated]}} expected-note {{use 'init(new:)' instead}} {{15-18=new}}
self.init(old: testSelf) // expected-warning {{'init(old:)' is deprecated: replaced by 'init(new:)' [DeprecatedDeclaration]}} expected-note {{use 'init(new:)' instead}} {{15-18=new}}
}
init(testSuper: Int) {}
@@ -655,32 +655,32 @@ class DeprecatedInitSub1: DeprecatedInitBase {
override init(testSuper: Int) {
// https://github.com/apple/swift/issues/57354
// The fix-it should not remove `.init`
super.init(old: testSuper) // expected-warning {{'init(old:)' is deprecated: replaced by 'init(new:)' [availability_deprecated]}} expected-note {{use 'init(new:)' instead}} {{16-19=new}}
super.init(old: testSuper) // expected-warning {{'init(old:)' is deprecated: replaced by 'init(new:)' [DeprecatedDeclaration]}} expected-note {{use 'init(new:)' instead}} {{16-19=new}}
}
}
class DeprecatedInitSub2: DeprecatedInitBase { }
_ = DeprecatedInitBase(old: 0) // expected-warning {{'init(old:)' is deprecated: replaced by 'init(new:)' [availability_deprecated]}} expected-note {{use 'init(new:)' instead}} {{24-27=new}}
_ = DeprecatedInitBase.init(old: 0) // expected-warning {{'init(old:)' is deprecated: replaced by 'init(new:)' [availability_deprecated]}} expected-note {{use 'init(new:)' instead}} {{29-32=new}}
let _: DeprecatedInitBase = .init(old: 0) // expected-warning {{'init(old:)' is deprecated: replaced by 'init(new:)' [availability_deprecated]}} expected-note {{use 'init(new:)' instead}} {{35-38=new}}
_ = DeprecatedInitSub2(old: 0) // expected-warning {{'init(old:)' is deprecated: replaced by 'init(new:)' [availability_deprecated]}} expected-note {{use 'init(new:)' instead}} {{24-27=new}}
_ = DeprecatedInitSub2.init(old: 0) // expected-warning {{'init(old:)' is deprecated: replaced by 'init(new:)' [availability_deprecated]}} expected-note {{use 'init(new:)' instead}} {{29-32=new}}
let _: DeprecatedInitSub2 = .init(old: 0) // expected-warning {{'init(old:)' is deprecated: replaced by 'init(new:)' [availability_deprecated]}} expected-note {{use 'init(new:)' instead}} {{35-38=new}}
_ = DeprecatedInitBase(old: 0) // expected-warning {{'init(old:)' is deprecated: replaced by 'init(new:)' [DeprecatedDeclaration]}} expected-note {{use 'init(new:)' instead}} {{24-27=new}}
_ = DeprecatedInitBase.init(old: 0) // expected-warning {{'init(old:)' is deprecated: replaced by 'init(new:)' [DeprecatedDeclaration]}} expected-note {{use 'init(new:)' instead}} {{29-32=new}}
let _: DeprecatedInitBase = .init(old: 0) // expected-warning {{'init(old:)' is deprecated: replaced by 'init(new:)' [DeprecatedDeclaration]}} expected-note {{use 'init(new:)' instead}} {{35-38=new}}
_ = DeprecatedInitSub2(old: 0) // expected-warning {{'init(old:)' is deprecated: replaced by 'init(new:)' [DeprecatedDeclaration]}} expected-note {{use 'init(new:)' instead}} {{24-27=new}}
_ = DeprecatedInitSub2.init(old: 0) // expected-warning {{'init(old:)' is deprecated: replaced by 'init(new:)' [DeprecatedDeclaration]}} expected-note {{use 'init(new:)' instead}} {{29-32=new}}
let _: DeprecatedInitSub2 = .init(old: 0) // expected-warning {{'init(old:)' is deprecated: replaced by 'init(new:)' [DeprecatedDeclaration]}} expected-note {{use 'init(new:)' instead}} {{35-38=new}}
_ = DeprecatedInitBase(multipleEqualAvailabilityAttributes: 0) // expected-warning {{'init(multipleEqualAvailabilityAttributes:)' is deprecated: replaced by 'init(new:)' [availability_deprecated]}} expected-note {{use 'init(new:)' instead}} {{24-59=new}}
_ = DeprecatedInitBase.init(multipleEqualAvailabilityAttributes: 0) // expected-warning {{'init(multipleEqualAvailabilityAttributes:)' is deprecated: replaced by 'init(new:)' [availability_deprecated]}} expected-note {{use 'init(new:)' instead}} {{29-64=new}}
let _: DeprecatedInitBase = .init(multipleEqualAvailabilityAttributes: 0) // expected-warning {{'init(multipleEqualAvailabilityAttributes:)' is deprecated: replaced by 'init(new:)' [availability_deprecated]}} expected-note {{use 'init(new:)' instead}} {{35-70=new}}
_ = DeprecatedInitSub2(multipleEqualAvailabilityAttributes: 0) // expected-warning {{'init(multipleEqualAvailabilityAttributes:)' is deprecated: replaced by 'init(new:)' [availability_deprecated]}} expected-note {{use 'init(new:)' instead}} {{24-59=new}}
_ = DeprecatedInitSub2.init(multipleEqualAvailabilityAttributes: 0) // expected-warning {{'init(multipleEqualAvailabilityAttributes:)' is deprecated: replaced by 'init(new:)' [availability_deprecated]}} expected-note {{use 'init(new:)' instead}} {{29-64=new}}
let _: DeprecatedInitSub2 = .init(multipleEqualAvailabilityAttributes: 0) // expected-warning {{'init(multipleEqualAvailabilityAttributes:)' is deprecated: replaced by 'init(new:)' [availability_deprecated]}} expected-note {{use 'init(new:)' instead}} {{35-70=new}}
_ = DeprecatedInitBase(multipleEqualAvailabilityAttributes: 0) // expected-warning {{'init(multipleEqualAvailabilityAttributes:)' is deprecated: replaced by 'init(new:)' [DeprecatedDeclaration]}} expected-note {{use 'init(new:)' instead}} {{24-59=new}}
_ = DeprecatedInitBase.init(multipleEqualAvailabilityAttributes: 0) // expected-warning {{'init(multipleEqualAvailabilityAttributes:)' is deprecated: replaced by 'init(new:)' [DeprecatedDeclaration]}} expected-note {{use 'init(new:)' instead}} {{29-64=new}}
let _: DeprecatedInitBase = .init(multipleEqualAvailabilityAttributes: 0) // expected-warning {{'init(multipleEqualAvailabilityAttributes:)' is deprecated: replaced by 'init(new:)' [DeprecatedDeclaration]}} expected-note {{use 'init(new:)' instead}} {{35-70=new}}
_ = DeprecatedInitSub2(multipleEqualAvailabilityAttributes: 0) // expected-warning {{'init(multipleEqualAvailabilityAttributes:)' is deprecated: replaced by 'init(new:)' [DeprecatedDeclaration]}} expected-note {{use 'init(new:)' instead}} {{24-59=new}}
_ = DeprecatedInitSub2.init(multipleEqualAvailabilityAttributes: 0) // expected-warning {{'init(multipleEqualAvailabilityAttributes:)' is deprecated: replaced by 'init(new:)' [DeprecatedDeclaration]}} expected-note {{use 'init(new:)' instead}} {{29-64=new}}
let _: DeprecatedInitSub2 = .init(multipleEqualAvailabilityAttributes: 0) // expected-warning {{'init(multipleEqualAvailabilityAttributes:)' is deprecated: replaced by 'init(new:)' [DeprecatedDeclaration]}} expected-note {{use 'init(new:)' instead}} {{35-70=new}}
_ = DeprecatedInitBase(multipleUnequalAvailabilityAttributes: 0) // expected-warning {{'init(multipleUnequalAvailabilityAttributes:)' is deprecated: replaced by 'init(new:)' [availability_deprecated]}} expected-note {{use 'init(new:)' instead}} {{24-61=new}}
_ = DeprecatedInitBase.init(multipleUnequalAvailabilityAttributes: 0) // expected-warning {{'init(multipleUnequalAvailabilityAttributes:)' is deprecated: replaced by 'init(new:)' [availability_deprecated]}} expected-note {{use 'init(new:)' instead}} {{29-66=new}}
let _: DeprecatedInitBase = .init(multipleUnequalAvailabilityAttributes: 0) // expected-warning {{'init(multipleUnequalAvailabilityAttributes:)' is deprecated: replaced by 'init(new:)' [availability_deprecated]}} expected-note {{use 'init(new:)' instead}} {{35-72=new}}
_ = DeprecatedInitSub2(multipleUnequalAvailabilityAttributes: 0) // expected-warning {{'init(multipleUnequalAvailabilityAttributes:)' is deprecated: replaced by 'init(new:)' [availability_deprecated]}} expected-note {{use 'init(new:)' instead}} {{24-61=new}}
_ = DeprecatedInitSub2.init(multipleUnequalAvailabilityAttributes: 0) // expected-warning {{'init(multipleUnequalAvailabilityAttributes:)' is deprecated: replaced by 'init(new:)' [availability_deprecated]}} expected-note {{use 'init(new:)' instead}} {{29-66=new}}
let _: DeprecatedInitSub2 = .init(multipleUnequalAvailabilityAttributes: 0) // expected-warning {{'init(multipleUnequalAvailabilityAttributes:)' is deprecated: replaced by 'init(new:)' [availability_deprecated]}} expected-note {{use 'init(new:)' instead}} {{35-72=new}}
_ = DeprecatedInitBase(multipleUnequalAvailabilityAttributes: 0) // expected-warning {{'init(multipleUnequalAvailabilityAttributes:)' is deprecated: replaced by 'init(new:)' [DeprecatedDeclaration]}} expected-note {{use 'init(new:)' instead}} {{24-61=new}}
_ = DeprecatedInitBase.init(multipleUnequalAvailabilityAttributes: 0) // expected-warning {{'init(multipleUnequalAvailabilityAttributes:)' is deprecated: replaced by 'init(new:)' [DeprecatedDeclaration]}} expected-note {{use 'init(new:)' instead}} {{29-66=new}}
let _: DeprecatedInitBase = .init(multipleUnequalAvailabilityAttributes: 0) // expected-warning {{'init(multipleUnequalAvailabilityAttributes:)' is deprecated: replaced by 'init(new:)' [DeprecatedDeclaration]}} expected-note {{use 'init(new:)' instead}} {{35-72=new}}
_ = DeprecatedInitSub2(multipleUnequalAvailabilityAttributes: 0) // expected-warning {{'init(multipleUnequalAvailabilityAttributes:)' is deprecated: replaced by 'init(new:)' [DeprecatedDeclaration]}} expected-note {{use 'init(new:)' instead}} {{24-61=new}}
_ = DeprecatedInitSub2.init(multipleUnequalAvailabilityAttributes: 0) // expected-warning {{'init(multipleUnequalAvailabilityAttributes:)' is deprecated: replaced by 'init(new:)' [DeprecatedDeclaration]}} expected-note {{use 'init(new:)' instead}} {{29-66=new}}
let _: DeprecatedInitSub2 = .init(multipleUnequalAvailabilityAttributes: 0) // expected-warning {{'init(multipleUnequalAvailabilityAttributes:)' is deprecated: replaced by 'init(new:)' [DeprecatedDeclaration]}} expected-note {{use 'init(new:)' instead}} {{35-72=new}}
class Base {
@@ -950,31 +950,31 @@ var deprecatedProperty: Int {
@available(*, deprecated, message: "bad setter") set {}
}
_ = deprecatedGetter // expected-warning {{getter for 'deprecatedGetter' is deprecated [availability_deprecated]}} {{none}}
_ = deprecatedGetter // expected-warning {{getter for 'deprecatedGetter' is deprecated [DeprecatedDeclaration]}} {{none}}
deprecatedGetter = 0
deprecatedGetter += 1 // expected-warning {{getter for 'deprecatedGetter' is deprecated [availability_deprecated]}} {{none}}
deprecatedGetter += 1 // expected-warning {{getter for 'deprecatedGetter' is deprecated [DeprecatedDeclaration]}} {{none}}
_ = deprecatedGetterOnly // expected-warning {{getter for 'deprecatedGetterOnly' is deprecated [availability_deprecated]}} {{none}}
_ = deprecatedGetterOnly // expected-warning {{getter for 'deprecatedGetterOnly' is deprecated [DeprecatedDeclaration]}} {{none}}
_ = deprecatedSetter
deprecatedSetter = 0 // expected-warning {{setter for 'deprecatedSetter' is deprecated [availability_deprecated]}} {{none}}
deprecatedSetter += 1 // expected-warning {{setter for 'deprecatedSetter' is deprecated [availability_deprecated]}} {{none}}
deprecatedSetter = 0 // expected-warning {{setter for 'deprecatedSetter' is deprecated [DeprecatedDeclaration]}} {{none}}
deprecatedSetter += 1 // expected-warning {{setter for 'deprecatedSetter' is deprecated [DeprecatedDeclaration]}} {{none}}
_ = deprecatedBoth // expected-warning {{getter for 'deprecatedBoth' is deprecated [availability_deprecated]}} {{none}}
deprecatedBoth = 0 // expected-warning {{setter for 'deprecatedBoth' is deprecated [availability_deprecated]}} {{none}}
deprecatedBoth += 1 // expected-warning {{getter for 'deprecatedBoth' is deprecated [availability_deprecated]}} {{none}} expected-warning {{setter for 'deprecatedBoth' is deprecated [availability_deprecated]}} {{none}}
_ = deprecatedBoth // expected-warning {{getter for 'deprecatedBoth' is deprecated [DeprecatedDeclaration]}} {{none}}
deprecatedBoth = 0 // expected-warning {{setter for 'deprecatedBoth' is deprecated [DeprecatedDeclaration]}} {{none}}
deprecatedBoth += 1 // expected-warning {{getter for 'deprecatedBoth' is deprecated [DeprecatedDeclaration]}} {{none}} expected-warning {{setter for 'deprecatedBoth' is deprecated [DeprecatedDeclaration]}} {{none}}
_ = deprecatedMessage // expected-warning {{getter for 'deprecatedMessage' is deprecated: bad getter [availability_deprecated]}} {{none}}
deprecatedMessage = 0 // expected-warning {{setter for 'deprecatedMessage' is deprecated: bad setter [availability_deprecated]}} {{none}}
deprecatedMessage += 1 // expected-warning {{getter for 'deprecatedMessage' is deprecated: bad getter [availability_deprecated]}} {{none}} expected-warning {{setter for 'deprecatedMessage' is deprecated: bad setter [availability_deprecated]}} {{none}}
_ = deprecatedMessage // expected-warning {{getter for 'deprecatedMessage' is deprecated: bad getter [DeprecatedDeclaration]}} {{none}}
deprecatedMessage = 0 // expected-warning {{setter for 'deprecatedMessage' is deprecated: bad setter [DeprecatedDeclaration]}} {{none}}
deprecatedMessage += 1 // expected-warning {{getter for 'deprecatedMessage' is deprecated: bad getter [DeprecatedDeclaration]}} {{none}} expected-warning {{setter for 'deprecatedMessage' is deprecated: bad setter [DeprecatedDeclaration]}} {{none}}
_ = deprecatedRename // expected-warning {{getter for 'deprecatedRename' is deprecated: renamed to 'betterThing()' [availability_deprecated]}} {{none}}
deprecatedRename = 0 // expected-warning {{setter for 'deprecatedRename' is deprecated: renamed to 'setBetterThing(_:)' [availability_deprecated]}} {{none}}
deprecatedRename += 1 // expected-warning {{getter for 'deprecatedRename' is deprecated: renamed to 'betterThing()' [availability_deprecated]}} {{none}} expected-warning {{setter for 'deprecatedRename' is deprecated: renamed to 'setBetterThing(_:)' [availability_deprecated]}} {{none}}
_ = deprecatedRename // expected-warning {{getter for 'deprecatedRename' is deprecated: renamed to 'betterThing()' [DeprecatedDeclaration]}} {{none}}
deprecatedRename = 0 // expected-warning {{setter for 'deprecatedRename' is deprecated: renamed to 'setBetterThing(_:)' [DeprecatedDeclaration]}} {{none}}
deprecatedRename += 1 // expected-warning {{getter for 'deprecatedRename' is deprecated: renamed to 'betterThing()' [DeprecatedDeclaration]}} {{none}} expected-warning {{setter for 'deprecatedRename' is deprecated: renamed to 'setBetterThing(_:)' [DeprecatedDeclaration]}} {{none}}
_ = deprecatedProperty // expected-warning {{'deprecatedProperty' is deprecated: bad variable [availability_deprecated]}} {{none}}
deprecatedProperty = 0 // expected-warning {{'deprecatedProperty' is deprecated: bad variable [availability_deprecated]}} {{none}}
deprecatedProperty += 1 // expected-warning {{'deprecatedProperty' is deprecated: bad variable [availability_deprecated]}} {{none}}
_ = deprecatedProperty // expected-warning {{'deprecatedProperty' is deprecated: bad variable [DeprecatedDeclaration]}} {{none}}
deprecatedProperty = 0 // expected-warning {{'deprecatedProperty' is deprecated: bad variable [DeprecatedDeclaration]}} {{none}}
deprecatedProperty += 1 // expected-warning {{'deprecatedProperty' is deprecated: bad variable [DeprecatedDeclaration]}} {{none}}
var unavailableGetter: Int {
@available(*, unavailable) get { return 0 } // expected-note * {{here}}
@@ -1060,29 +1060,29 @@ struct DeprecatedAccessors {
}
mutating func testAccessors(other: inout DeprecatedAccessors) {
_ = deprecatedMessage // expected-warning {{getter for 'deprecatedMessage' is deprecated: bad getter [availability_deprecated]}} {{none}}
deprecatedMessage = 0 // expected-warning {{setter for 'deprecatedMessage' is deprecated: bad setter [availability_deprecated]}} {{none}}
deprecatedMessage += 1 // expected-warning {{getter for 'deprecatedMessage' is deprecated: bad getter [availability_deprecated]}} {{none}} expected-warning {{setter for 'deprecatedMessage' is deprecated: bad setter [availability_deprecated]}} {{none}}
_ = deprecatedMessage // expected-warning {{getter for 'deprecatedMessage' is deprecated: bad getter [DeprecatedDeclaration]}} {{none}}
deprecatedMessage = 0 // expected-warning {{setter for 'deprecatedMessage' is deprecated: bad setter [DeprecatedDeclaration]}} {{none}}
deprecatedMessage += 1 // expected-warning {{getter for 'deprecatedMessage' is deprecated: bad getter [DeprecatedDeclaration]}} {{none}} expected-warning {{setter for 'deprecatedMessage' is deprecated: bad setter [DeprecatedDeclaration]}} {{none}}
_ = other.deprecatedMessage // expected-warning {{getter for 'deprecatedMessage' is deprecated: bad getter [availability_deprecated]}} {{none}}
other.deprecatedMessage = 0 // expected-warning {{setter for 'deprecatedMessage' is deprecated: bad setter [availability_deprecated]}} {{none}}
other.deprecatedMessage += 1 // expected-warning {{getter for 'deprecatedMessage' is deprecated: bad getter [availability_deprecated]}} {{none}} expected-warning {{setter for 'deprecatedMessage' is deprecated: bad setter [availability_deprecated]}} {{none}}
_ = other.deprecatedMessage // expected-warning {{getter for 'deprecatedMessage' is deprecated: bad getter [DeprecatedDeclaration]}} {{none}}
other.deprecatedMessage = 0 // expected-warning {{setter for 'deprecatedMessage' is deprecated: bad setter [DeprecatedDeclaration]}} {{none}}
other.deprecatedMessage += 1 // expected-warning {{getter for 'deprecatedMessage' is deprecated: bad getter [DeprecatedDeclaration]}} {{none}} expected-warning {{setter for 'deprecatedMessage' is deprecated: bad setter [DeprecatedDeclaration]}} {{none}}
_ = other.deprecatedProperty // expected-warning {{'deprecatedProperty' is deprecated: bad property [availability_deprecated]}} {{none}}
other.deprecatedProperty = 0 // expected-warning {{'deprecatedProperty' is deprecated: bad property [availability_deprecated]}} {{none}}
other.deprecatedProperty += 1 // expected-warning {{'deprecatedProperty' is deprecated: bad property [availability_deprecated]}} {{none}}
_ = other.deprecatedProperty // expected-warning {{'deprecatedProperty' is deprecated: bad property [DeprecatedDeclaration]}} {{none}}
other.deprecatedProperty = 0 // expected-warning {{'deprecatedProperty' is deprecated: bad property [DeprecatedDeclaration]}} {{none}}
other.deprecatedProperty += 1 // expected-warning {{'deprecatedProperty' is deprecated: bad property [DeprecatedDeclaration]}} {{none}}
_ = DeprecatedAccessors.staticDeprecated // expected-warning {{getter for 'staticDeprecated' is deprecated: bad getter [availability_deprecated]}} {{none}}
DeprecatedAccessors.staticDeprecated = 0 // expected-warning {{setter for 'staticDeprecated' is deprecated: bad setter [availability_deprecated]}} {{none}}
DeprecatedAccessors.staticDeprecated += 1 // expected-warning {{getter for 'staticDeprecated' is deprecated: bad getter [availability_deprecated]}} {{none}} expected-warning {{setter for 'staticDeprecated' is deprecated: bad setter [availability_deprecated]}} {{none}}
_ = DeprecatedAccessors.staticDeprecated // expected-warning {{getter for 'staticDeprecated' is deprecated: bad getter [DeprecatedDeclaration]}} {{none}}
DeprecatedAccessors.staticDeprecated = 0 // expected-warning {{setter for 'staticDeprecated' is deprecated: bad setter [DeprecatedDeclaration]}} {{none}}
DeprecatedAccessors.staticDeprecated += 1 // expected-warning {{getter for 'staticDeprecated' is deprecated: bad getter [DeprecatedDeclaration]}} {{none}} expected-warning {{setter for 'staticDeprecated' is deprecated: bad setter [DeprecatedDeclaration]}} {{none}}
_ = other[0] // expected-warning {{getter for 'subscript(_:)' is deprecated: bad subscript getter [availability_deprecated]}} {{none}}
other[0] = 0 // expected-warning {{setter for 'subscript(_:)' is deprecated: bad subscript setter [availability_deprecated]}} {{none}}
other[0] += 1 // expected-warning {{getter for 'subscript(_:)' is deprecated: bad subscript getter [availability_deprecated]}} {{none}} expected-warning {{setter for 'subscript(_:)' is deprecated: bad subscript setter [availability_deprecated]}} {{none}}
_ = other[0] // expected-warning {{getter for 'subscript(_:)' is deprecated: bad subscript getter [DeprecatedDeclaration]}} {{none}}
other[0] = 0 // expected-warning {{setter for 'subscript(_:)' is deprecated: bad subscript setter [DeprecatedDeclaration]}} {{none}}
other[0] += 1 // expected-warning {{getter for 'subscript(_:)' is deprecated: bad subscript getter [DeprecatedDeclaration]}} {{none}} expected-warning {{setter for 'subscript(_:)' is deprecated: bad subscript setter [DeprecatedDeclaration]}} {{none}}
_ = other[alsoDeprecated: 0] // expected-warning {{'subscript(alsoDeprecated:)' is deprecated: bad subscript! [availability_deprecated]}} {{none}}
other[alsoDeprecated: 0] = 0 // expected-warning {{'subscript(alsoDeprecated:)' is deprecated: bad subscript! [availability_deprecated]}} {{none}}
other[alsoDeprecated: 0] += 1 // expected-warning {{'subscript(alsoDeprecated:)' is deprecated: bad subscript! [availability_deprecated]}} {{none}}
_ = other[alsoDeprecated: 0] // expected-warning {{'subscript(alsoDeprecated:)' is deprecated: bad subscript! [DeprecatedDeclaration]}} {{none}}
other[alsoDeprecated: 0] = 0 // expected-warning {{'subscript(alsoDeprecated:)' is deprecated: bad subscript! [DeprecatedDeclaration]}} {{none}}
other[alsoDeprecated: 0] += 1 // expected-warning {{'subscript(alsoDeprecated:)' is deprecated: bad subscript! [DeprecatedDeclaration]}} {{none}}
}
}
@@ -1198,7 +1198,7 @@ struct BadRename {
}
func testBadRename() {
_ = BadRename(from: 5, to: 17) // expected-warning{{'init(from:to:step:)' is deprecated: replaced by 'init(range:step:)' [availability_deprecated]}}
_ = BadRename(from: 5, to: 17) // expected-warning{{'init(from:to:step:)' is deprecated: replaced by 'init(range:step:)' [DeprecatedDeclaration]}}
// expected-note@-1{{use 'init(range:step:)' instead}}
}
@@ -1231,27 +1231,27 @@ func threeTrailingClosuresRemoveLabels(_ x: TypeWithTrailingClosures, a: () -> V
func variadicTrailingClosures(_ x: TypeWithTrailingClosures, a: (() -> Void)...) {}
func testMultipleTrailingClosures(_ x: TypeWithTrailingClosures) {
twoTrailingClosures(x) {} b: {} // expected-warning {{'twoTrailingClosures(_:a:b:)' is deprecated: replaced by instance method 'TypeWithTrailingClosures.twoTrailingClosures(a:b:)' [availability_deprecated]}}
twoTrailingClosures(x) {} b: {} // expected-warning {{'twoTrailingClosures(_:a:b:)' is deprecated: replaced by instance method 'TypeWithTrailingClosures.twoTrailingClosures(a:b:)' [DeprecatedDeclaration]}}
// expected-note@-1 {{use 'TypeWithTrailingClosures.twoTrailingClosures(a:b:)' instead}} {{3-22=x.twoTrailingClosures}} {{23-24=}} {{none}}
x.twoTrailingClosures() {} b: {}
twoTrailingClosuresWithDefaults(x: x) {} b: {} // expected-warning {{'twoTrailingClosuresWithDefaults(x:y:z:a:b:)' is deprecated: replaced by instance method 'TypeWithTrailingClosures.twoTrailingClosures(a:b:)' [availability_deprecated]}}
twoTrailingClosuresWithDefaults(x: x) {} b: {} // expected-warning {{'twoTrailingClosuresWithDefaults(x:y:z:a:b:)' is deprecated: replaced by instance method 'TypeWithTrailingClosures.twoTrailingClosures(a:b:)' [DeprecatedDeclaration]}}
// expected-note@-1 {{use 'TypeWithTrailingClosures.twoTrailingClosures(a:b:)' instead}} {{3-34=x.twoTrailingClosures}} {{35-39=}} {{none}}
x.twoTrailingClosures() {} b: {}
threeTrailingClosures(x, a: {}) {} c: {} // expected-warning {{'threeTrailingClosures(_:a:b:c:)' is deprecated: replaced by instance method 'TypeWithTrailingClosures.threeTrailingClosures(a:b:c:)' [availability_deprecated]}}
threeTrailingClosures(x, a: {}) {} c: {} // expected-warning {{'threeTrailingClosures(_:a:b:c:)' is deprecated: replaced by instance method 'TypeWithTrailingClosures.threeTrailingClosures(a:b:c:)' [DeprecatedDeclaration]}}
// expected-note@-1 {{use 'TypeWithTrailingClosures.threeTrailingClosures(a:b:c:)' instead}} {{3-24=x.threeTrailingClosures}} {{25-28=}} {{none}}
x.threeTrailingClosures(a: {}) {} c: {}
threeTrailingClosuresDiffLabels(x, x: {}) {} z: {} // expected-warning {{'threeTrailingClosuresDiffLabels(_:x:y:z:)' is deprecated: replaced by instance method 'TypeWithTrailingClosures.threeTrailingClosures(a:b:c:)' [availability_deprecated]}}
threeTrailingClosuresDiffLabels(x, x: {}) {} z: {} // expected-warning {{'threeTrailingClosuresDiffLabels(_:x:y:z:)' is deprecated: replaced by instance method 'TypeWithTrailingClosures.threeTrailingClosures(a:b:c:)' [DeprecatedDeclaration]}}
// expected-note@-1 {{use 'TypeWithTrailingClosures.threeTrailingClosures(a:b:c:)' instead}} {{3-34=x.threeTrailingClosures}} {{35-38=}} {{38-39=a}} {{48-49=c}} {{none}}
x.threeTrailingClosures(a: {}) {} c: {}
threeTrailingClosuresRemoveLabels(x, a: {}) {} c: {} // expected-warning {{'threeTrailingClosuresRemoveLabels(_:a:b:c:)' is deprecated: replaced by instance method 'TypeWithTrailingClosures.threeUnlabeledTrailingClosures(_:_:_:)' [availability_deprecated]}}
threeTrailingClosuresRemoveLabels(x, a: {}) {} c: {} // expected-warning {{'threeTrailingClosuresRemoveLabels(_:a:b:c:)' is deprecated: replaced by instance method 'TypeWithTrailingClosures.threeUnlabeledTrailingClosures(_:_:_:)' [DeprecatedDeclaration]}}
// expected-note@-1 {{use 'TypeWithTrailingClosures.threeUnlabeledTrailingClosures(_:_:_:)' instead}} {{3-36=x.threeUnlabeledTrailingClosures}} {{37-40=}} {{40-43=}} {{50-51=_}} {{none}}
x.threeUnlabeledTrailingClosures({}) {} _: {}
variadicTrailingClosures(x) {} _: {} _: {} // expected-warning {{'variadicTrailingClosures(_:a:)' is deprecated: replaced by instance method 'TypeWithTrailingClosures.variadicTrailingClosures(a:b:c:)' [availability_deprecated]}}
variadicTrailingClosures(x) {} _: {} _: {} // expected-warning {{'variadicTrailingClosures(_:a:)' is deprecated: replaced by instance method 'TypeWithTrailingClosures.variadicTrailingClosures(a:b:c:)' [DeprecatedDeclaration]}}
// expected-note@-1 {{use 'TypeWithTrailingClosures.variadicTrailingClosures(a:b:c:)' instead}} {{3-27=x.variadicTrailingClosures}} {{28-29=}} {{none}}
x.variadicTrailingClosures() {} _: {} _: {}
}
@@ -1294,16 +1294,16 @@ struct UnavailableSubscripts {
_ = self[getAValue: 3] // expected-error {{'subscript(getAValue:)' has been renamed to 'getAValue(new:)'}} {{13-14=.getAValue(}} {{26-27=)}} {{14-23=new}}
_ = x[getAValue: 3] // expected-error {{'subscript(getAValue:)' has been renamed to 'getAValue(new:)'}} {{10-11=.getAValue(}} {{23-24=)}} {{11-20=new}}
_ = self[argg1: 3, argg2: 3, argg3: 3] // expected-warning {{'subscript(argg1:argg2:argg3:)' is deprecated: renamed to 'subscript(arg1:arg2:arg3:)' [availability_deprecated]}} // expected-note {{use 'subscript(arg1:arg2:arg3:)' instead}} {{14-19=arg1}} {{24-29=arg2}} {{34-39=arg3}}
_ = x[argg1: 3, argg2: 3, argg3: 3] // expected-warning {{'subscript(argg1:argg2:argg3:)' is deprecated: renamed to 'subscript(arg1:arg2:arg3:)' [availability_deprecated]}} // expected-note {{use 'subscript(arg1:arg2:arg3:)' instead}} {{11-16=arg1}} {{21-26=arg2}} {{31-36=arg3}}
_ = self[argg1: 3, argg2: 3, argg3: 3] // expected-warning {{'subscript(argg1:argg2:argg3:)' is deprecated: renamed to 'subscript(arg1:arg2:arg3:)' [DeprecatedDeclaration]}} // expected-note {{use 'subscript(arg1:arg2:arg3:)' instead}} {{14-19=arg1}} {{24-29=arg2}} {{34-39=arg3}}
_ = x[argg1: 3, argg2: 3, argg3: 3] // expected-warning {{'subscript(argg1:argg2:argg3:)' is deprecated: renamed to 'subscript(arg1:arg2:arg3:)' [DeprecatedDeclaration]}} // expected-note {{use 'subscript(arg1:arg2:arg3:)' instead}} {{11-16=arg1}} {{21-26=arg2}} {{31-36=arg3}}
// Different number of parameters emit no fixit
_ = self[only1: 3, only2: 3] // expected-warning {{'subscript(only1:only2:)' is deprecated: renamed to 'subscript(arg1:arg2:arg3:)' [availability_deprecated]}} // expected-note {{use 'subscript(arg1:arg2:arg3:)' instead}} {{none}}
_ = self[only1: 3, only2: 3] // expected-warning {{'subscript(only1:only2:)' is deprecated: renamed to 'subscript(arg1:arg2:arg3:)' [DeprecatedDeclaration]}} // expected-note {{use 'subscript(arg1:arg2:arg3:)' instead}} {{none}}
_ = self[3, 3, 3] // expected-error {{'subscript(_:_:_:)' has been renamed to 'subscript(arg1:arg2:arg3:)'}} {{14-14=arg1: }} {{17-17=arg2: }} {{20-20=arg3: }}
_ = x[3, 3, 3] // expected-error {{'subscript(_:_:_:)' has been renamed to 'subscript(arg1:arg2:arg3:)'}} {{11-11=arg1: }} {{14-14=arg2: }} {{17-17=arg3: }}
_ = self[to: 3] // expected-warning {{'subscript(to:)' is deprecated: renamed to 'subscriptTo(_:)' [availability_deprecated]}} // expected-note {{use 'subscriptTo(_:)' instead}} {{13-14=.subscriptTo(}} {{19-20=)}} {{14-18=}}
_ = x[to: 3] // expected-warning {{'subscript(to:)' is deprecated: renamed to 'subscriptTo(_:)' [availability_deprecated]}} // expected-note {{use 'subscriptTo(_:)' instead}} {{10-11=.subscriptTo(}} {{16-17=)}} {{11-15=}}
_ = self[to: 3] // expected-warning {{'subscript(to:)' is deprecated: renamed to 'subscriptTo(_:)' [DeprecatedDeclaration]}} // expected-note {{use 'subscriptTo(_:)' instead}} {{13-14=.subscriptTo(}} {{19-20=)}} {{14-18=}}
_ = x[to: 3] // expected-warning {{'subscript(to:)' is deprecated: renamed to 'subscriptTo(_:)' [DeprecatedDeclaration]}} // expected-note {{use 'subscriptTo(_:)' instead}} {{10-11=.subscriptTo(}} {{16-17=)}} {{11-15=}}
}
}

View File

@@ -275,7 +275,7 @@ func asyncContext(t: HandlerTest) async {
// expected-warning@+1{{consider using asynchronous alternative function}}
defaultedParamsEnd4(arg: 1) { }
// expected-warning@+2{{consider using asynchronous alternative function}}
// expected-warning@+1{{'manyAttrs(completionHandler:)' is deprecated [availability_deprecated]}}
// expected-warning@+1{{'manyAttrs(completionHandler:)' is deprecated [DeprecatedDeclaration]}}
manyAttrs() { }
// expected-warning@+1{{consider using asynchronous alternative function}}
platformOnly() { }

View File

@@ -6,36 +6,36 @@
class D {}
protocol P<T1> {
associatedtype T1 = D // expected-warning {{'D' is deprecated [availability_deprecated]}}
associatedtype T2: P where T2: D // expected-warning {{'D' is deprecated [availability_deprecated]}}
associatedtype T1 = D // expected-warning {{'D' is deprecated [DeprecatedDeclaration]}}
associatedtype T2: P where T2: D // expected-warning {{'D' is deprecated [DeprecatedDeclaration]}}
}
class C<T1>: D { // expected-warning {{'D' is deprecated [availability_deprecated]}}
class C<T1>: D { // expected-warning {{'D' is deprecated [DeprecatedDeclaration]}}
struct Nested<T2> {
let d: D // expected-warning {{'D' is deprecated [availability_deprecated]}}
let d: D // expected-warning {{'D' is deprecated [DeprecatedDeclaration]}}
}
}
extension C<D> {} // expected-warning {{'D' is deprecated [availability_deprecated]}}
extension C<D> {} // expected-warning {{'D' is deprecated [DeprecatedDeclaration]}}
func f<each T>(
_: (
D, // expected-warning {{'D' is deprecated [availability_deprecated]}}
(D), // expected-warning {{'D' is deprecated [availability_deprecated]}}
C<D> // expected-warning {{'D' is deprecated [availability_deprecated]}}
.Nested<D>, // expected-warning {{'D' is deprecated [availability_deprecated]}}
() -> D, // expected-warning {{'D' is deprecated [availability_deprecated]}}
(inout D) -> Void, // expected-warning {{'D' is deprecated [availability_deprecated]}}
(D...) -> Void, // expected-warning {{'D' is deprecated [availability_deprecated]}}
D?, // expected-warning {{'D' is deprecated [availability_deprecated]}}
[D], // expected-warning {{'D' is deprecated [availability_deprecated]}}
[Int : D], // expected-warning {{'D' is deprecated [availability_deprecated]}}
D, // expected-warning {{'D' is deprecated [DeprecatedDeclaration]}}
(D), // expected-warning {{'D' is deprecated [DeprecatedDeclaration]}}
C<D> // expected-warning {{'D' is deprecated [DeprecatedDeclaration]}}
.Nested<D>, // expected-warning {{'D' is deprecated [DeprecatedDeclaration]}}
() -> D, // expected-warning {{'D' is deprecated [DeprecatedDeclaration]}}
(inout D) -> Void, // expected-warning {{'D' is deprecated [DeprecatedDeclaration]}}
(D...) -> Void, // expected-warning {{'D' is deprecated [DeprecatedDeclaration]}}
D?, // expected-warning {{'D' is deprecated [DeprecatedDeclaration]}}
[D], // expected-warning {{'D' is deprecated [DeprecatedDeclaration]}}
[Int : D], // expected-warning {{'D' is deprecated [DeprecatedDeclaration]}}
// FIXME: Emitted twice.
some P<D>, // expected-warning 2 {{'D' is deprecated [availability_deprecated]}}
any P<D>, // expected-warning {{'D' is deprecated [availability_deprecated]}}
any C<D> & P, // expected-warning {{'D' is deprecated [availability_deprecated]}}
D.Type, // expected-warning {{'D' is deprecated [availability_deprecated]}}
repeat (D, each T) // expected-warning {{'D' is deprecated [availability_deprecated]}}
some P<D>, // expected-warning 2 {{'D' is deprecated [DeprecatedDeclaration]}}
any P<D>, // expected-warning {{'D' is deprecated [DeprecatedDeclaration]}}
any C<D> & P, // expected-warning {{'D' is deprecated [DeprecatedDeclaration]}}
D.Type, // expected-warning {{'D' is deprecated [DeprecatedDeclaration]}}
repeat (D, each T) // expected-warning {{'D' is deprecated [DeprecatedDeclaration]}}
),
_: @escaping (D) -> Void // expected-warning {{'D' is deprecated [availability_deprecated]}}
_: @escaping (D) -> Void // expected-warning {{'D' is deprecated [DeprecatedDeclaration]}}
)
where repeat each T: D {} // expected-warning {{'D' is deprecated [availability_deprecated]}}
where repeat each T: D {} // expected-warning {{'D' is deprecated [DeprecatedDeclaration]}}

View File

@@ -1,4 +1,4 @@
// RUN: %target-typecheck-verify-swift
// RUN: %target-typecheck-verify-swift -print-diagnostic-groups
// REQUIRES: concurrency
@available(SwiftStdlib 5.1, *)
@@ -9,7 +9,7 @@ actor A1: Hashable {
@available(SwiftStdlib 5.1, *)
actor A2: Hashable {
nonisolated var hashValue: Int { 0 } // expected-warning{{'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'A2' to 'Hashable' by implementing 'hash(into:)' instead}}
nonisolated var hashValue: Int { 0 } // expected-warning{{'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'A2' to 'Hashable' by implementing 'hash(into:)' instead [DeprecatedDeclaration]}}
static func ==(lhs: A2, rhs: A2) -> Bool { true }
}
@@ -24,7 +24,7 @@ class C1: Hashable {
@available(SwiftStdlib 5.1, *)
@MainActor
class C2: Hashable {
nonisolated var hashValue: Int { 0 } // expected-warning{{'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'C2' to 'Hashable' by implementing 'hash(into:)' instead}}
nonisolated var hashValue: Int { 0 } // expected-warning{{'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'C2' to 'Hashable' by implementing 'hash(into:)' instead [DeprecatedDeclaration]}}
nonisolated static func ==(lhs: C2, rhs: C2) -> Bool { true }
}

View File

@@ -1,4 +1,4 @@
// RUN: %target-typecheck-verify-swift
// RUN: %target-typecheck-verify-swift -print-diagnostic-groups
protocol DeprecatedRequirement {
@available(*, deprecated)
@@ -22,7 +22,7 @@ extension DeprecatedDefault {
func f() {} // expected-note {{'f()' declared here}}
}
// expected-warning@+1 {{deprecated default implementation is used to satisfy instance method 'f()' required by protocol 'DeprecatedDefault'}}
// expected-warning@+1 {{deprecated default implementation is used to satisfy instance method 'f()' required by protocol 'DeprecatedDefault' [DeprecatedDeclaration]}}
struct S2: DeprecatedDefault {}
// No warning if the conformance itself is deprecated
@@ -56,5 +56,5 @@ extension DeprecatedDefaultWithMessage {
}
// expected-warning@+1 {{deprecated default implementation is used to satisfy instance method 'f()' required by protocol 'DeprecatedDefaultWithMessage': write it yourself}}
// expected-warning@+1 {{deprecated default implementation is used to satisfy instance method 'f()' required by protocol 'DeprecatedDefaultWithMessage': write it yourself [DeprecatedDeclaration]}}
struct S6: DeprecatedDefaultWithMessage {}

View File

@@ -9,7 +9,7 @@
func bar() {
}
// CHECK: warning: 'bar()' is deprecated: renamed to 'bar2' [availability_deprecated]{{$}}
// CHECK: warning: 'bar()' is deprecated: renamed to 'bar2' [DeprecatedDeclaration]{{$}}
bar()

View File

@@ -1,10 +1,7 @@
// RUN: not %target-swift-frontend -typecheck -diagnostic-style llvm -warnings-as-errors %s 2>&1 | %FileCheck %s --check-prefix=CHECK-WAE
// RUN: not %target-swift-frontend -typecheck -diagnostic-style llvm -Werror availability_deprecated %s 2>&1 | %FileCheck %s --check-prefix=CHECK-WE-GROUP
// RUN: not %target-swift-frontend -typecheck -diagnostic-style llvm -Werror deprecated %s 2>&1 | %FileCheck %s --check-prefix=CHECK-WE-SUPERGROUP
// RUN: not %target-swift-frontend -typecheck -diagnostic-style llvm -Werror DeprecatedDeclaration %s 2>&1 | %FileCheck %s --check-prefix=CHECK-WE-GROUP
// RUN: %target-swift-frontend -typecheck -diagnostic-style llvm -warnings-as-errors -no-warnings-as-errors %s 2>&1 | %FileCheck %s --check-prefix=CHECK-WAE-NWAE
// RUN: %target-swift-frontend -typecheck -diagnostic-style llvm -warnings-as-errors -Wwarning availability_deprecated %s 2>&1 | %FileCheck %s --check-prefix=CHECK-WAE-WW-GROUP
// RUN: %target-swift-frontend -typecheck -diagnostic-style llvm -warnings-as-errors -Wwarning deprecated %s 2>&1 | %FileCheck %s --check-prefix=CHECK-WAE-WW-SUPERGROUP
// RUN: %target-swift-frontend -typecheck -diagnostic-style llvm -Werror deprecated -Wwarning availability_deprecated %s 2>&1 | %FileCheck %s --check-prefix=CHECK-WE-SUPERGROUP-WW-GROUP
// RUN: %target-swift-frontend -typecheck -diagnostic-style llvm -warnings-as-errors -Wwarning DeprecatedDeclaration %s 2>&1 | %FileCheck %s --check-prefix=CHECK-WAE-WW-GROUP
// This test verifies that the warning control flags apply with respect to
// the order they are specified in the cmd line.
@@ -30,16 +27,10 @@ func bar() {
// CHECK-WAE-NOT: warning: 'foo()' is deprecated
// CHECK-WE-GROUP: error: 'foo()' is deprecated
// CHECK-WE-GROUP-NOT: warning: 'foo()' is deprecated
// CHECK-WE-SUPERGROUP: error: 'foo()' is deprecated
// CHECK-WE-SUPERGROUP-NOT: warning: 'foo()' is deprecated
// CHECK-WAE-NWAE: warning: 'foo()' is deprecated
// CHECK-WAE-NWAE-NOT: error: 'foo()' is deprecated
// CHECK-WAE-WW-GROUP: warning: 'foo()' is deprecated
// CHECK-WAE-WW-GROUP-NOT: error: 'foo()' is deprecated
// CHECK-WAE-WW-SUPERGROUP: warning: 'foo()' is deprecated
// CHECK-WAE-WW-SUPERGROUP-NOT: error: 'foo()' is deprecated
// CHECK-WE-SUPERGROUP-WW-GROUP: warning: 'foo()' is deprecated
// CHECK-WE-SUPERGROUP-WW-GROUP-NOT: error: 'foo()' is deprecated
foo()
@@ -47,14 +38,8 @@ foo()
// CHECK-WAE-NOT: warning: 'bar()' is deprecated: renamed to 'bar2'
// CHECK-WE-GROUP: error: 'bar()' is deprecated: renamed to 'bar2'
// CHECK-WE-GROUP-NOT: warning: 'bar()' is deprecated: renamed to 'bar2'
// CHECK-WE-SUPERGROUP: error: 'bar()' is deprecated: renamed to 'bar2'
// CHECK-WE-SUPERGROUP-NOT: warning: 'bar()' is deprecated: renamed to 'bar2'
// CHECK-WAE-NWAE: warning: 'bar()' is deprecated: renamed to 'bar2'
// CHECK-WAE-NWAE-NOT: error: 'bar()' is deprecated: renamed to 'bar2'
// CHECK-WAE-WW-GROUP: warning: 'bar()' is deprecated: renamed to 'bar2'
// CHECK-WAE-WW-GROUP-NOT: error: 'bar()' is deprecated: renamed to 'bar2'
// CHECK-WAE-WW-SUPERGROUP: warning: 'bar()' is deprecated: renamed to 'bar2'
// CHECK-WAE-WW-SUPERGROUP-NOT: error: 'bar()' is deprecated: renamed to 'bar2'
// CHECK-WE-SUPERGROUP-WW-GROUP: warning: 'bar()' is deprecated: renamed to 'bar2'
// CHECK-WE-SUPERGROUP-WW-GROUP-NOT: error: 'bar()' is deprecated: renamed to 'bar2'
bar()

View File

@@ -8,7 +8,7 @@ import _Concurrency
// short-term source compatibility)
@available(SwiftStdlib 5.1, *)
extension PartialAsyncTask {
// expected-warning@-1 {{'PartialAsyncTask' is deprecated: renamed to 'UnownedJob' [availability_deprecated]}}
// expected-warning@-1 {{'PartialAsyncTask' is deprecated: renamed to 'UnownedJob' [DeprecatedDeclaration]}}
// expected-note@-2 {{use 'UnownedJob' instead}}
}
@available(SwiftStdlib 5.1, *)

View File

@@ -3,30 +3,30 @@
func flatMapOnSequence<
S : Sequence
>(xs: S, f: (S.Element) -> S.Element?) {
_ = xs.flatMap(f) // expected-warning {{'flatMap' is deprecated: Please use compactMap(_:) for the case where closure returns an optional value [availability_deprecated]}} expected-note {{compactMap}}
_ = xs.flatMap(f) // expected-warning {{'flatMap' is deprecated: Please use compactMap(_:) for the case where closure returns an optional value [DeprecatedDeclaration]}} expected-note {{compactMap}}
}
func flatMapOnLazySequence<
S : LazySequenceProtocol
>(xs: S, f: (S.Element) -> S.Element?) {
_ = xs.flatMap(f) // expected-warning {{'flatMap' is deprecated: Please use compactMap(_:) for the case where closure returns an optional value [availability_deprecated]}} expected-note {{compactMap}}
_ = xs.flatMap(f) // expected-warning {{'flatMap' is deprecated: Please use compactMap(_:) for the case where closure returns an optional value [DeprecatedDeclaration]}} expected-note {{compactMap}}
}
func flatMapOnLazyCollection<
C : LazyCollectionProtocol
>(xs: C, f: (C.Element) -> C.Element?) {
_ = xs.flatMap(f) // expected-warning {{'flatMap' is deprecated: Please use compactMap(_:) for the case where closure returns an optional value [availability_deprecated]}} expected-note {{compactMap}}
_ = xs.flatMap(f) // expected-warning {{'flatMap' is deprecated: Please use compactMap(_:) for the case where closure returns an optional value [DeprecatedDeclaration]}} expected-note {{compactMap}}
}
func flatMapOnLazyBidirectionalCollection<
C : LazyCollectionProtocol & BidirectionalCollection
>(xs: C, f: (C.Element) -> C.Element?)
where C.Elements : BidirectionalCollection {
_ = xs.flatMap(f) // expected-warning {{'flatMap' is deprecated: Please use compactMap(_:) for the case where closure returns an optional value [availability_deprecated]}} expected-note {{compactMap}}
_ = xs.flatMap(f) // expected-warning {{'flatMap' is deprecated: Please use compactMap(_:) for the case where closure returns an optional value [DeprecatedDeclaration]}} expected-note {{compactMap}}
}
func flatMapOnCollectionOfStrings<
C : Collection
>(xs: C, f: (C.Element) -> String?) {
_ = xs.flatMap(f) // expected-warning {{'flatMap' is deprecated: Please use compactMap(_:) for the case where closure returns an optional value [availability_deprecated]}} expected-note {{compactMap}}
_ = xs.flatMap(f) // expected-warning {{'flatMap' is deprecated: Please use compactMap(_:) for the case where closure returns an optional value [DeprecatedDeclaration]}} expected-note {{compactMap}}
}

View File

@@ -14,20 +14,20 @@
#error("Unsupported platform")
#endif
_ = FLT_RADIX // expected-warning {{is deprecated: Please use 'T.radix' to get the radix of a FloatingPoint type 'T'. [availability_deprecated]}}
_ = FLT_RADIX // expected-warning {{is deprecated: Please use 'T.radix' to get the radix of a FloatingPoint type 'T'. [DeprecatedDeclaration]}}
_ = FLT_MANT_DIG // expected-warning {{is deprecated: Please use 'Float.significandBitCount + 1'. [availability_deprecated]}}
_ = FLT_MIN_EXP // expected-warning {{is deprecated: Please use 'Float.leastNormalMagnitude.exponent + 1'. [availability_deprecated]}}
_ = FLT_MAX_EXP // expected-warning {{is deprecated: Please use 'Float.greatestFiniteMagnitude.exponent + 1'. [availability_deprecated]}}
_ = FLT_MAX // expected-warning {{is deprecated: Please use 'Float.greatestFiniteMagnitude' or '.greatestFiniteMagnitude'. [availability_deprecated]}}
_ = FLT_EPSILON // expected-warning {{is deprecated: Please use 'Float.ulpOfOne' or '.ulpOfOne'. [availability_deprecated]}}
_ = FLT_MIN // expected-warning {{is deprecated: Please use 'Float.leastNormalMagnitude' or '.leastNormalMagnitude'. [availability_deprecated]}}
_ = FLT_TRUE_MIN // expected-warning {{is deprecated: Please use 'Float.leastNonzeroMagnitude' or '.leastNonzeroMagnitude'. [availability_deprecated]}}
_ = FLT_MANT_DIG // expected-warning {{is deprecated: Please use 'Float.significandBitCount + 1'. [DeprecatedDeclaration]}}
_ = FLT_MIN_EXP // expected-warning {{is deprecated: Please use 'Float.leastNormalMagnitude.exponent + 1'. [DeprecatedDeclaration]}}
_ = FLT_MAX_EXP // expected-warning {{is deprecated: Please use 'Float.greatestFiniteMagnitude.exponent + 1'. [DeprecatedDeclaration]}}
_ = FLT_MAX // expected-warning {{is deprecated: Please use 'Float.greatestFiniteMagnitude' or '.greatestFiniteMagnitude'. [DeprecatedDeclaration]}}
_ = FLT_EPSILON // expected-warning {{is deprecated: Please use 'Float.ulpOfOne' or '.ulpOfOne'. [DeprecatedDeclaration]}}
_ = FLT_MIN // expected-warning {{is deprecated: Please use 'Float.leastNormalMagnitude' or '.leastNormalMagnitude'. [DeprecatedDeclaration]}}
_ = FLT_TRUE_MIN // expected-warning {{is deprecated: Please use 'Float.leastNonzeroMagnitude' or '.leastNonzeroMagnitude'. [DeprecatedDeclaration]}}
_ = DBL_MANT_DIG // expected-warning {{is deprecated: Please use 'Double.significandBitCount + 1'. [availability_deprecated]}}
_ = DBL_MIN_EXP // expected-warning {{is deprecated: Please use 'Double.leastNormalMagnitude.exponent + 1'. [availability_deprecated]}}
_ = DBL_MAX_EXP // expected-warning {{is deprecated: Please use 'Double.greatestFiniteMagnitude.exponent + 1'. [availability_deprecated]}}
_ = DBL_MAX // expected-warning {{is deprecated: Please use 'Double.greatestFiniteMagnitude' or '.greatestFiniteMagnitude'. [availability_deprecated]}}
_ = DBL_EPSILON // expected-warning {{is deprecated: Please use 'Double.ulpOfOne' or '.ulpOfOne'. [availability_deprecated]}}
_ = DBL_MIN // expected-warning {{is deprecated: Please use 'Double.leastNormalMagnitude' or '.leastNormalMagnitude'. [availability_deprecated]}}
_ = DBL_TRUE_MIN // expected-warning {{is deprecated: Please use 'Double.leastNonzeroMagnitude' or '.leastNonzeroMagnitude'. [availability_deprecated]}}
_ = DBL_MANT_DIG // expected-warning {{is deprecated: Please use 'Double.significandBitCount + 1'. [DeprecatedDeclaration]}}
_ = DBL_MIN_EXP // expected-warning {{is deprecated: Please use 'Double.leastNormalMagnitude.exponent + 1'. [DeprecatedDeclaration]}}
_ = DBL_MAX_EXP // expected-warning {{is deprecated: Please use 'Double.greatestFiniteMagnitude.exponent + 1'. [DeprecatedDeclaration]}}
_ = DBL_MAX // expected-warning {{is deprecated: Please use 'Double.greatestFiniteMagnitude' or '.greatestFiniteMagnitude'. [DeprecatedDeclaration]}}
_ = DBL_EPSILON // expected-warning {{is deprecated: Please use 'Double.ulpOfOne' or '.ulpOfOne'. [DeprecatedDeclaration]}}
_ = DBL_MIN // expected-warning {{is deprecated: Please use 'Double.leastNormalMagnitude' or '.leastNormalMagnitude'. [DeprecatedDeclaration]}}
_ = DBL_TRUE_MIN // expected-warning {{is deprecated: Please use 'Double.leastNonzeroMagnitude' or '.leastNonzeroMagnitude'. [DeprecatedDeclaration]}}

View File

@@ -16,7 +16,7 @@ struct Int64Distance<Element>: Collection {
let c = Int64Distance(_storage: [1,2,3])
let i64: Int64 = 2
_ = c.index(c.startIndex, offsetBy: i64) // expected-warning {{'index(_:offsetBy:)' is deprecated: all index distances are now of type Int [availability_deprecated]}}
_ = c.index(c.startIndex, offsetBy: i64) // expected-warning {{'index(_:offsetBy:)' is deprecated: all index distances are now of type Int [DeprecatedDeclaration]}}
let _: Int64 = c.distance(from: c.startIndex, to: c.endIndex) // expected-warning {{distance(from:to:)' is deprecated: all index distances are now of type Int [availability_deprecated]}}
let _: Int64 = c.distance(from: c.startIndex, to: c.endIndex) // expected-warning {{distance(from:to:)' is deprecated: all index distances are now of type Int [DeprecatedDeclaration]}}

View File

@@ -2,7 +2,7 @@
let a = [10, 20, 30, 40, 50, 60]
_ = a.index(of: 30) // expected-warning {{'index(of:)' is deprecated: renamed to 'firstIndex(of:)' [availability_deprecated]}} expected-note {{use 'firstIndex(of:)' instead}}
_ = a.index(of: 30) // expected-warning {{'index(of:)' is deprecated: renamed to 'firstIndex(of:)' [DeprecatedDeclaration]}} expected-note {{use 'firstIndex(of:)' instead}}
_ = a.firstIndex(of: 30)
_ = a.index(where: { $0 > 30 }) // expected-warning {{'index(where:)' is deprecated: renamed to 'firstIndex(where:)' [availability_deprecated]}} expected-note {{use 'firstIndex(where:)' instead}}
_ = a.index(where: { $0 > 30 }) // expected-warning {{'index(where:)' is deprecated: renamed to 'firstIndex(where:)' [DeprecatedDeclaration]}} expected-note {{use 'firstIndex(where:)' instead}}
_ = a.firstIndex(where: { $0 > 30 })

View File

@@ -14,9 +14,9 @@
#error("Unsupported platform")
#endif
_ = M_PI // expected-warning {{is deprecated: Please use 'Double.pi' or '.pi' to get the value of correct type and avoid casting. [availability_deprecated]}}
_ = M_PI_2 // expected-warning {{is deprecated: Please use 'Double.pi / 2' or '.pi / 2' to get the value of correct type and avoid casting. [availability_deprecated]}}
_ = M_PI_4 // expected-warning {{is deprecated: Please use 'Double.pi / 4' or '.pi / 4' to get the value of correct type and avoid casting. [availability_deprecated]}}
_ = M_PI // expected-warning {{is deprecated: Please use 'Double.pi' or '.pi' to get the value of correct type and avoid casting. [DeprecatedDeclaration]}}
_ = M_PI_2 // expected-warning {{is deprecated: Please use 'Double.pi / 2' or '.pi / 2' to get the value of correct type and avoid casting. [DeprecatedDeclaration]}}
_ = M_PI_4 // expected-warning {{is deprecated: Please use 'Double.pi / 4' or '.pi / 4' to get the value of correct type and avoid casting. [DeprecatedDeclaration]}}
_ = M_SQRT2 // expected-warning {{is deprecated: Please use '2.squareRoot()'. [availability_deprecated]}}
_ = M_SQRT1_2 // expected-warning {{is deprecated: Please use '0.5.squareRoot()'. [availability_deprecated]}}
_ = M_SQRT2 // expected-warning {{is deprecated: Please use '2.squareRoot()'. [DeprecatedDeclaration]}}
_ = M_SQRT1_2 // expected-warning {{is deprecated: Please use '0.5.squareRoot()'. [DeprecatedDeclaration]}}

View File

@@ -4,34 +4,34 @@ import StdlibUnittest
func checkStringOverloadCompilationDiagnostics() {
_ = String(cString: "string") // expected-warning {{'init(cString:)' is deprecated: Use a copy of the String argument [availability_deprecated]}}
_ = String(cString: "string") // expected-warning {{'init(cString:)' is deprecated: Use a copy of the String argument [DeprecatedDeclaration]}}
_ = String(validatingUTF8: "string") // expected-warning {{init(validatingUTF8:)' is deprecated: Use a copy of the String argument [availability_deprecated]}}
_ = String(validatingUTF8: "string") // expected-warning {{init(validatingUTF8:)' is deprecated: Use a copy of the String argument [DeprecatedDeclaration]}}
_ = String(validatingCString: "string") // expected-warning {{'init(validatingCString:)' is deprecated: Use a copy of the String argument [availability_deprecated]}}
_ = String(validatingCString: "string") // expected-warning {{'init(validatingCString:)' is deprecated: Use a copy of the String argument [DeprecatedDeclaration]}}
_ = String.decodeCString("string", as: Unicode.UTF8.self) // expected-warning {{'decodeCString(_:as:repairingInvalidCodeUnits:)' is deprecated: Use a copy of the String argument [availability_deprecated]}}
_ = String.decodeCString("string", as: Unicode.UTF8.self) // expected-warning {{'decodeCString(_:as:repairingInvalidCodeUnits:)' is deprecated: Use a copy of the String argument [DeprecatedDeclaration]}}
_ = String(decodingCString: "string", as: Unicode.UTF8.self) // expected-warning {{'init(decodingCString:as:)' is deprecated: Use a copy of the String argument [availability_deprecated]}}
_ = String(decodingCString: "string", as: Unicode.UTF8.self) // expected-warning {{'init(decodingCString:as:)' is deprecated: Use a copy of the String argument [DeprecatedDeclaration]}}
}
func checkInoutConversionOverloadCompilationDiagnostics() {
var i = UInt8.zero
_ = String(cString: &i) // expected-warning {{'init(cString:)' is deprecated: Use String(_ scalar: Unicode.Scalar) [availability_deprecated]}}
_ = String(cString: &i) // expected-warning {{'init(cString:)' is deprecated: Use String(_ scalar: Unicode.Scalar) [DeprecatedDeclaration]}}
var c = CChar.zero
_ = String(cString: &c) // expected-warning {{'init(cString:)' is deprecated: Use String(_ scalar: Unicode.Scalar) [availability_deprecated]}}
_ = String(cString: &c) // expected-warning {{'init(cString:)' is deprecated: Use String(_ scalar: Unicode.Scalar) [DeprecatedDeclaration]}}
_ = String(validatingUTF8: &c) // expected-warning {{init(validatingUTF8:)' is deprecated: Use String(_ scalar: Unicode.Scalar) [availability_deprecated]}}
_ = String(validatingUTF8: &c) // expected-warning {{init(validatingUTF8:)' is deprecated: Use String(_ scalar: Unicode.Scalar) [DeprecatedDeclaration]}}
_ = String(validatingCString: &c) // expected-warning {{'init(validatingCString:)' is deprecated: Use String(_ scalar: Unicode.Scalar) [availability_deprecated]}}
_ = String(validatingCString: &c) // expected-warning {{'init(validatingCString:)' is deprecated: Use String(_ scalar: Unicode.Scalar) [DeprecatedDeclaration]}}
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) [availability_deprecated]}}
_ = String.decodeCString(&u, as: Unicode.UTF8.self) // expected-warning {{'decodeCString(_:as:repairingInvalidCodeUnits:)' is deprecated: Use String(_ scalar: Unicode.Scalar) [DeprecatedDeclaration]}}
_ = String(decodingCString: &u, as: Unicode.UTF8.self) // expected-warning {{'init(decodingCString:as:)' is deprecated: Use String(_ scalar: Unicode.Scalar) [availability_deprecated]}}
_ = String(decodingCString: &u, as: Unicode.UTF8.self) // expected-warning {{'init(decodingCString:as:)' is deprecated: Use String(_ scalar: Unicode.Scalar) [DeprecatedDeclaration]}}
}

View File

@@ -2,17 +2,17 @@
func testPopFirst() {
let str = "abc"
var charView: String.CharacterView // expected-warning{{'CharacterView' is deprecated: Please use String directly [availability_deprecated]}}
charView = str.characters // expected-warning{{'characters' is deprecated: Please use String directly [availability_deprecated]}}
var charView: String.CharacterView // expected-warning{{'CharacterView' is deprecated: Please use String directly [DeprecatedDeclaration]}}
charView = str.characters // expected-warning{{'characters' is deprecated: Please use String directly [DeprecatedDeclaration]}}
dump(charView)
var substr = str[...]
_ = substr.popFirst() // ok
_ = substr.characters.popFirst() // expected-warning{{'characters' is deprecated: Please use Substring directly [availability_deprecated]}}
_ = substr.characters.popFirst() // expected-warning{{'characters' is deprecated: Please use Substring directly [DeprecatedDeclaration]}}
_ = substr.unicodeScalars.popFirst() // ok
var charSubView: Substring.CharacterView // expected-warning{{'CharacterView' is deprecated: Please use Substring directly [availability_deprecated]}}
charSubView = substr.characters // expected-warning{{'characters' is deprecated: Please use Substring directly [availability_deprecated]}}
var charSubView: Substring.CharacterView // expected-warning{{'CharacterView' is deprecated: Please use Substring directly [DeprecatedDeclaration]}}
charSubView = substr.characters // expected-warning{{'characters' is deprecated: Please use Substring directly [DeprecatedDeclaration]}}
dump(charSubView)
var _ = String(str.utf8) ?? "" // expected-warning{{left side of nil coalescing operator '??' has non-optional type 'String', so the right side is never used}}

View File

@@ -36,19 +36,19 @@ func foo() async throws {
_ = tg.addTaskUnlessCancelled { return 1 } // ok
_ = await tg.add(priority: .low) { return 1 } // expected-error{{Unavailable in task-to-thread concurrency model}}
_ = await tg.add { return 1 } // expected-warning{{'add(operation:)' is deprecated: renamed to 'addTaskUnlessCancelled(operation:)' [availability_deprecated]}}
_ = await tg.add { return 1 } // expected-warning{{'add(operation:)' is deprecated: renamed to 'addTaskUnlessCancelled(operation:)' [DeprecatedDeclaration]}}
// expected-note@-1{{use 'addTaskUnlessCancelled(operation:)' instead}}
tg.spawn(priority: .low) { return 1 } // expected-error{{Unavailable in task-to-thread concurrency model}}
tg.spawn { return 1 } // expected-warning{{'spawn(operation:)' is deprecated: renamed to 'addTask(operation:)' [availability_deprecated]}}
tg.spawn { return 1 } // expected-warning{{'spawn(operation:)' is deprecated: renamed to 'addTask(operation:)' [DeprecatedDeclaration]}}
// expected-note@-1{{use 'addTask(operation:)' instead}}
_ = tg.spawnUnlessCancelled(priority: .low) { return 1 } // expected-error{{Unavailable in task-to-thread concurrency model}}
_ = tg.spawnUnlessCancelled { return 1 } // expected-warning{{'spawnUnlessCancelled(operation:)' is deprecated: renamed to 'addTaskUnlessCancelled(operation:)' [availability_deprecated]}}
_ = tg.spawnUnlessCancelled { return 1 } // expected-warning{{'spawnUnlessCancelled(operation:)' is deprecated: renamed to 'addTaskUnlessCancelled(operation:)' [DeprecatedDeclaration]}}
// expected-note@-1{{use 'addTaskUnlessCancelled(operation:)' instead}}
tg.async(priority: .low) { return 1 } // expected-error{{Unavailable in task-to-thread concurrency model}}
tg.async { return 1 } // expected-warning{{'async(operation:)' is deprecated: renamed to 'addTask(operation:)' [availability_deprecated]}}
tg.async { return 1 } // expected-warning{{'async(operation:)' is deprecated: renamed to 'addTask(operation:)' [DeprecatedDeclaration]}}
// expected-note@-1{{use 'addTask(operation:)' instead}}
_ = tg.asyncUnlessCancelled(priority: .low) { return 1 } // expected-error{{Unavailable in task-to-thread concurrency model}}
_ = tg.asyncUnlessCancelled { return 1 } // expected-warning{{'asyncUnlessCancelled(operation:)' is deprecated: renamed to 'addTaskUnlessCancelled(operation:)' [availability_deprecated]}}
_ = tg.asyncUnlessCancelled { return 1 } // expected-warning{{'asyncUnlessCancelled(operation:)' is deprecated: renamed to 'addTaskUnlessCancelled(operation:)' [DeprecatedDeclaration]}}
// expected-note@-1{{use 'addTaskUnlessCancelled(operation:)' instead}}
}
func withThrowingTaskGroup(_ tg: inout ThrowingTaskGroup<Int, Error>) async throws {
@@ -58,19 +58,19 @@ func foo() async throws {
_ = tg.addTaskUnlessCancelled { return 1 } // ok
_ = await tg.add(priority: .low) { return 1 } // expected-error{{Unavailable in task-to-thread concurrency model}}
_ = await tg.add { return 1 } // expected-warning{{'add(operation:)' is deprecated: renamed to 'addTaskUnlessCancelled(operation:)' [availability_deprecated]}}
_ = await tg.add { return 1 } // expected-warning{{'add(operation:)' is deprecated: renamed to 'addTaskUnlessCancelled(operation:)' [DeprecatedDeclaration]}}
// expected-note@-1{{use 'addTaskUnlessCancelled(operation:)' instead}}
tg.spawn(priority: .low) { return 1 } // expected-error{{Unavailable in task-to-thread concurrency model}}
tg.spawn { return 1 } // expected-warning{{'spawn(operation:)' is deprecated: renamed to 'addTask(operation:)' [availability_deprecated]}}
tg.spawn { return 1 } // expected-warning{{'spawn(operation:)' is deprecated: renamed to 'addTask(operation:)' [DeprecatedDeclaration]}}
// expected-note@-1{{use 'addTask(operation:)' instead}}
_ = tg.spawnUnlessCancelled(priority: .low) { return 1 } // expected-error{{Unavailable in task-to-thread concurrency model}}
_ = tg.spawnUnlessCancelled { return 1 } // expected-warning{{'spawnUnlessCancelled(operation:)' is deprecated: renamed to 'addTaskUnlessCancelled(operation:)' [availability_deprecated]}}
_ = tg.spawnUnlessCancelled { return 1 } // expected-warning{{'spawnUnlessCancelled(operation:)' is deprecated: renamed to 'addTaskUnlessCancelled(operation:)' [DeprecatedDeclaration]}}
// expected-note@-1{{use 'addTaskUnlessCancelled(operation:)' instead}}
tg.async(priority: .low) { return 1 } // expected-error{{Unavailable in task-to-thread concurrency model}}
tg.async { return 1 } // expected-warning{{'async(operation:)' is deprecated: renamed to 'addTask(operation:)' [availability_deprecated]}}
tg.async { return 1 } // expected-warning{{'async(operation:)' is deprecated: renamed to 'addTask(operation:)' [DeprecatedDeclaration]}}
// expected-note@-1{{use 'addTask(operation:)' instead}}
_ = tg.asyncUnlessCancelled(priority: .low) { return 1 } // expected-error{{Unavailable in task-to-thread concurrency model}}
_ = tg.asyncUnlessCancelled { return 1 } // expected-warning{{'asyncUnlessCancelled(operation:)' is deprecated: renamed to 'addTaskUnlessCancelled(operation:)' [availability_deprecated]}}
_ = tg.asyncUnlessCancelled { return 1 } // expected-warning{{'asyncUnlessCancelled(operation:)' is deprecated: renamed to 'addTaskUnlessCancelled(operation:)' [DeprecatedDeclaration]}}
// expected-note@-1{{use 'addTaskUnlessCancelled(operation:)' instead}}
}
}

View File

@@ -0,0 +1,74 @@
# Deprecated Declaration Warnings (`DeprecatedDeclaration`)
This diagnostic group includes warnings related to deprecated APIs that may be removed in future versions and should be replaced with more current alternatives.
The `DeprecatedDeclaration` group covers the following warnings:
- Use of a function annotated with `@available(<platform>, deprecated: <version>)`
```swift
@available(iOS, deprecated: 10.0)
func oldFunction() {
// This function is deprecated and should not be used.
}
oldFunction() // 'oldFunction()' is deprecated
```
- Use of a function annotated with `@available(<platform>, deprecated: <version>, renamed: "<new name>")`
```swift
@available(iOS, deprecated: 10.0, renamed: "newFunction")
func oldFunction() {
// This function is deprecated and should not be used.
}
oldFunction() // 'oldFunction()' is deprecated: renamed to 'newFunction'
```
- Use of a type as an instance of a protocol when the type's conformance to the protocol is marked as deprecated
```swift
struct S {}
protocol P {}
@available(*, deprecated)
extension S: P {}
func f(_ p: some P) {}
func test() {
f(S()) // Conformance of 'S' to 'P' is deprecated
}
```
- When a protocol requirement has a default implementation marked as `deprecated` and the type conforming to the protocol doesn't provide that requirement
```swift
protocol P {
func f()
func g()
}
extension P {
@available(*, deprecated)
func f() {}
@available(*, deprecated, message: "write it yourself")
func g() {}
}
struct S: P {} // deprecated default implementation is used to satisfy instance method 'f()' required by protocol 'P'
// deprecated default implementation is used to satisfy instance method 'g()' required by protocol 'P': write it yourself
```
- When a protocol requirement has been deprecated
```swift
struct S: Hashable {
var hashValue: Int { // 'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'S' to 'Hashable' by implementing 'hash(into:)' instead
...
}
}
final class C: Executor {
func enqueue(_ job: __owned Job) {} // 'Executor.enqueue(Job)' is deprecated as a protocol requirement; conform type 'C' to 'Executor' by implementing 'func enqueue(ExecutorJob)' instead
}
```
## Usage Example
```sh
swiftc -Werror DeprecatedDeclaration file.swift
swiftc -warnings-as-errors -Wwarning DeprecatedDeclaration file.swift
```

View File

@@ -1,6 +1,6 @@
# Unknown "Warning Group" Warnings (`unknown_warning_group`)
# Unknown "Warning Group" Warnings (`UnknownWarningGroup`)
The `unknown_warning_group` diagnostic group addresses warnings related to the specification of unrecognized warning groups in compilation flags.
The `UnknownWarningGroup` diagnostic group addresses warnings related to the specification of unrecognized warning groups in compilation flags.
```sh
swiftc -Werror non_existing_group file.swift
@@ -10,6 +10,6 @@ swiftc -Werror non_existing_group file.swift
Such warnings are emitted after the behavior for all specified warning groups has been processed, which means their behavior can also be specified. For example:
```sh
swiftc -Werror unknown_warning_group -Werror non_existing_group file.swift
swiftc -Werror UnknownWarningGroup -Werror non_existing_group file.swift
<unknown>:0: error: unknown warning group: 'non_existing_group'
```

View File

@@ -1,30 +0,0 @@
# Availability Deprecation Warnings (`availability_deprecated`)
This diagnostic group includes warnings related to deprecated APIs that may be removed in future versions and should be replaced with more current alternatives.
The `availability_deprecated` group covers the following warnings:
- Use of a function annotated with `@available(<platform>, deprecated: <version>)`
```swift
@available(iOS, deprecated: 10.0)
func oldFunction() {
// This function is deprecated and should not be used.
}
oldFunction() // 'oldFunction()' is deprecated
```
- Use of a function annotated with `@available(<platform>, deprecated: <version>, renamed: "<new name>")`
```swift
@available(iOS, deprecated: 10.0, renamed: "newFunction")
func oldFunction() {
// This function is deprecated and should not be used.
}
oldFunction() // 'oldFunction()' is deprecated: renamed to 'newFunction'
```
## Usage Example
```sh
swiftc -Werror availability_deprecated file.swift
swiftc -warnings-as-errors -Wwarning availability_deprecated file.swift
```

View File

@@ -1,12 +0,0 @@
# Deprecation Warnings (`deprecated`)
The deprecated group is a supergroup designed to manage all kinds of warnings related to the use of deprecated elements. This group can include other diagnostic groups with similar meanings. The deprecated group includes the following groups:
- `availability_deprecated`: Includes warnings for APIs marked as deprecated.
## Usage Example
```sh
swiftc -Werror deprecated file.swift
swiftc -warnings-as-errors -Wwarning deprecated file.swift
```