mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Print diagnostic group names by default
Print diagnostic groups as part of the LLVM printer in the same manner as the
Swift one does, always. Make `-print-diagnostic-groups` an inert option, since we
always print diagnostic group names with the `[#GroupName]` syntax.
As part of this, we no longer render the diagnostic group name as part
of the diagnostic *text*, instead leaving it up to the diagnostic
renderer to handle the category appropriately. Update all of the tests
that were depending on `-print-diagnostic-groups` putting it into the
text to instead use the `{{documentation-file=<file name>}}`
diagnostic verification syntax.
This commit is contained in:
@@ -1618,6 +1618,7 @@ DiagnosticEngine::getFormatStringForDiagnostic(const Diagnostic &diagnostic,
|
||||
};
|
||||
switch (printDiagnosticNamesMode) {
|
||||
case PrintDiagnosticNamesMode::None:
|
||||
case PrintDiagnosticNamesMode::Group:
|
||||
break;
|
||||
case PrintDiagnosticNamesMode::Identifier: {
|
||||
// If this diagnostic is a wrapper for another diagnostic, use the ID of
|
||||
@@ -1632,13 +1633,6 @@ DiagnosticEngine::getFormatStringForDiagnostic(const Diagnostic &diagnostic,
|
||||
message = formatMessageWithName(message, diagnosticIDStringFor(diagID));
|
||||
break;
|
||||
}
|
||||
case PrintDiagnosticNamesMode::Group:
|
||||
auto groupID = diagnostic.getGroupID();
|
||||
if (groupID != DiagGroupID::no_group) {
|
||||
message =
|
||||
formatMessageWithName(message, getDiagGroupInfoByID(groupID).name);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return message;
|
||||
|
||||
@@ -2559,8 +2559,6 @@ static bool ParseDiagnosticArgs(DiagnosticOptions &Opts, ArgList &Args,
|
||||
}
|
||||
if (Args.hasArg(OPT_debug_diagnostic_names)) {
|
||||
Opts.PrintDiagnosticNames = PrintDiagnosticNamesMode::Identifier;
|
||||
} else if (Args.hasArg(OPT_print_diagnostic_groups)) {
|
||||
Opts.PrintDiagnosticNames = PrintDiagnosticNamesMode::Group;
|
||||
}
|
||||
if (Arg *A = Args.getLastArg(OPT_diagnostic_documentation_path)) {
|
||||
Opts.DiagnosticDocumentationPath = A->getValue();
|
||||
|
||||
@@ -59,6 +59,8 @@ void PrintingDiagnosticConsumer::handleDiagnostic(SourceManager &SM,
|
||||
#endif
|
||||
|
||||
// Fall through when we don't have the new diagnostics renderer available.
|
||||
// This also happens if the location of the diagnostic is invalid, because
|
||||
// the new rendered cannot cope with that.
|
||||
LLVM_FALLTHROUGH;
|
||||
}
|
||||
|
||||
@@ -134,6 +136,9 @@ void PrintingDiagnosticConsumer::printDiagnostic(SourceManager &SM,
|
||||
llvm::raw_svector_ostream Out(Text);
|
||||
DiagnosticEngine::formatDiagnosticText(Out, Info.FormatString,
|
||||
Info.FormatArgs);
|
||||
|
||||
if (!Info.Category.empty())
|
||||
Out << " [#" << Info.Category << "]";
|
||||
}
|
||||
|
||||
auto Msg = SM.GetMessage(Info.Loc, SMKind, Text, Ranges, FixIts,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// RUN: %target-swift-frontend -print-diagnostic-groups -target %target-swift-5.1-abi-triple -enable-experimental-flow-sensitive-concurrent-captures -verify -emit-sil %s -o - >/dev/null
|
||||
// RUN: %target-swift-frontend -print-diagnostic-groups -target %target-swift-5.1-abi-triple -enable-experimental-flow-sensitive-concurrent-captures -verify -emit-sil %s -o - >/dev/null -strict-concurrency=targeted
|
||||
// RUN: %target-swift-frontend -print-diagnostic-groups -target %target-swift-5.1-abi-triple -enable-experimental-flow-sensitive-concurrent-captures -verify -emit-sil %s -o - >/dev/null -strict-concurrency=complete
|
||||
// RUN: %target-swift-frontend -print-diagnostic-groups -target %target-swift-5.1-abi-triple -enable-experimental-flow-sensitive-concurrent-captures -verify -emit-sil %s -o - >/dev/null -strict-concurrency=complete -enable-upcoming-feature RegionBasedIsolation
|
||||
// RUN: %target-swift-frontend -target %target-swift-5.1-abi-triple -enable-experimental-flow-sensitive-concurrent-captures -verify -emit-sil %s -o - >/dev/null
|
||||
// RUN: %target-swift-frontend -target %target-swift-5.1-abi-triple -enable-experimental-flow-sensitive-concurrent-captures -verify -emit-sil %s -o - >/dev/null -strict-concurrency=targeted
|
||||
// RUN: %target-swift-frontend -target %target-swift-5.1-abi-triple -enable-experimental-flow-sensitive-concurrent-captures -verify -emit-sil %s -o - >/dev/null -strict-concurrency=complete
|
||||
// RUN: %target-swift-frontend -target %target-swift-5.1-abi-triple -enable-experimental-flow-sensitive-concurrent-captures -verify -emit-sil %s -o - >/dev/null -strict-concurrency=complete -enable-upcoming-feature RegionBasedIsolation
|
||||
|
||||
// REQUIRES: concurrency
|
||||
// REQUIRES: swift_feature_RegionBasedIsolation
|
||||
@@ -90,7 +90,7 @@ func testCaseTrivialValue4() {
|
||||
// expected-note @-8 {{capturing use}}
|
||||
}
|
||||
|
||||
class Klass: UnsafeSendable { // expected-warning{{'UnsafeSendable' is deprecated: Use @unchecked Sendable instead [DeprecatedDeclaration]}}
|
||||
class Klass: UnsafeSendable { // expected-warning{{'UnsafeSendable' is deprecated: Use @unchecked Sendable instead}}{{documentation-file=deprecated-declaration}}
|
||||
var next: Klass? = nil
|
||||
}
|
||||
func inoutUserKlass(_ k: inout Klass) {}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// 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
|
||||
// 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
|
||||
|
||||
// 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 [DeprecatedDeclaration]}}
|
||||
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}}{{documentation-file=deprecated-declaration}}
|
||||
|
||||
func enqueue(_ job: consuming ExecutorJob) {}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// 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
|
||||
// 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
|
||||
|
||||
// REQUIRES: concurrency
|
||||
// REQUIRES: swift_feature_RegionBasedIsolation
|
||||
@@ -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 [DeprecatedDeclaration]}}
|
||||
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}}{{documentation-file=deprecated-declaration}}
|
||||
|
||||
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 [DeprecatedDeclaration]}}
|
||||
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}}{{documentation-file=deprecated-declaration}}
|
||||
|
||||
func asUnownedSerialExecutor() -> UnownedSerialExecutor {
|
||||
UnownedSerialExecutor(ordinary: self)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// RUN: %target-typecheck-verify-swift -swift-version 5 -print-diagnostic-groups
|
||||
// RUN: %target-typecheck-verify-swift -swift-version 5
|
||||
|
||||
// REQUIRES: OS=macosx
|
||||
|
||||
@@ -10,8 +10,8 @@ extension SLD: ExpressibleByStringLiteral {
|
||||
init(stringLiteral value: StringLiteralType) {}
|
||||
}
|
||||
|
||||
let _ = SLD(stringLiteral: "") // expected-warning{{'init(stringLiteral:)' is deprecated [DeprecatedDeclaration]}}
|
||||
let _: SLD = "" // expected-warning{{'init(stringLiteral:)' is deprecated [DeprecatedDeclaration]}}
|
||||
let _ = SLD(stringLiteral: "") // expected-warning{{'init(stringLiteral:)' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
let _: SLD = "" // expected-warning{{'init(stringLiteral:)' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
|
||||
|
||||
struct SLU {}
|
||||
@@ -30,8 +30,8 @@ extension ILD: ExpressibleByIntegerLiteral {
|
||||
init(integerLiteral value: IntegerLiteralType) {}
|
||||
}
|
||||
|
||||
let _ = ILD(integerLiteral: 1) // expected-warning{{'init(integerLiteral:)' is deprecated [DeprecatedDeclaration]}}
|
||||
let _: ILD = 1 // expected-warning{{'init(integerLiteral:)' is deprecated [DeprecatedDeclaration]}}
|
||||
let _ = ILD(integerLiteral: 1) // expected-warning{{'init(integerLiteral:)' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
let _: ILD = 1 // expected-warning{{'init(integerLiteral:)' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
|
||||
struct ILU {}
|
||||
|
||||
@@ -51,8 +51,8 @@ extension NLD: ExpressibleByNilLiteral {
|
||||
init(nilLiteral: ()) {}
|
||||
}
|
||||
|
||||
let _: NLD = .init(nilLiteral: ()) // expected-warning{{'init(nilLiteral:)' is deprecated [DeprecatedDeclaration]}}
|
||||
let _: NLD = nil // expected-warning{{'init(nilLiteral:)' is deprecated [DeprecatedDeclaration]}}
|
||||
let _: NLD = .init(nilLiteral: ()) // expected-warning{{'init(nilLiteral:)' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
let _: NLD = nil // expected-warning{{'init(nilLiteral:)' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
|
||||
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 [DeprecatedDeclaration]}}
|
||||
let _: BLD = false // expected-warning{{'init(booleanLiteral:)' is deprecated [DeprecatedDeclaration]}}
|
||||
let _: BLD = .init(booleanLiteral: false) // expected-warning{{'init(booleanLiteral:)' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
let _: BLD = false // expected-warning{{'init(booleanLiteral:)' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
|
||||
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 [DeprecatedDeclaration]}}
|
||||
let _: FLD = 0.1 // expected-warning{{'init(floatLiteral:)' is deprecated [DeprecatedDeclaration]}}
|
||||
let _: FLD = .init(floatLiteral: 0.1) // expected-warning{{'init(floatLiteral:)' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
let _: FLD = 0.1 // expected-warning{{'init(floatLiteral:)' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
|
||||
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 [DeprecatedDeclaration]}}
|
||||
let _: ALD = [1] // expected-warning{{'init(arrayLiteral:)' is deprecated [DeprecatedDeclaration]}}
|
||||
let _: ALD = .init(arrayLiteral: 1) // expected-warning{{'init(arrayLiteral:)' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
let _: ALD = [1] // expected-warning{{'init(arrayLiteral:)' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
|
||||
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 [DeprecatedDeclaration]}}
|
||||
let _: DLD = [1: 1] // expected-warning{{'init(dictionaryLiteral:)' is deprecated [DeprecatedDeclaration]}}
|
||||
let _: DLD = .init(dictionaryLiteral: (1,1)) // expected-warning{{'init(dictionaryLiteral:)' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
let _: DLD = [1: 1] // expected-warning{{'init(dictionaryLiteral:)' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
|
||||
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 [DeprecatedDeclaration]}}
|
||||
let _: USLD = "a" // expected-warning{{'init(unicodeScalarLiteral:)' is deprecated [DeprecatedDeclaration]}}
|
||||
let _: USLD = .init(unicodeScalarLiteral: "a") // expected-warning{{'init(unicodeScalarLiteral:)' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
let _: USLD = "a" // expected-warning{{'init(unicodeScalarLiteral:)' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
|
||||
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 [DeprecatedDeclaration]}}
|
||||
let _: GCLD = "🇧🇷" // expected-warning{{'init(extendedGraphemeClusterLiteral:)' is deprecated [DeprecatedDeclaration]}}
|
||||
let _: GCLD = .init(extendedGraphemeClusterLiteral: "🇧🇷") // expected-warning{{'init(extendedGraphemeClusterLiteral:)' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
let _: GCLD = "🇧🇷" // expected-warning{{'init(extendedGraphemeClusterLiteral:)' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
|
||||
struct GCLU {}
|
||||
@available(macOS 100, *)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
// RUN: %target-typecheck-verify-swift \
|
||||
// RUN: -disable-availability-checking \
|
||||
// RUN: -print-diagnostic-groups
|
||||
// RUN: -disable-availability-checking
|
||||
|
||||
struct S : _BitwiseCopyable {} // expected-warning {{'_BitwiseCopyable' is deprecated: Use BitwiseCopyable [DeprecatedDeclaration]}}
|
||||
struct S : _BitwiseCopyable {} // expected-warning {{'_BitwiseCopyable' is deprecated: Use BitwiseCopyable}}{{documentation-file=deprecated-declaration}}
|
||||
|
||||
func f<T : _BitwiseCopyable>(_ t: T) {} // expected-warning {{'_BitwiseCopyable' is deprecated: Use BitwiseCopyable [DeprecatedDeclaration]}}
|
||||
func f<T : _BitwiseCopyable>(_ t: T) {} // expected-warning {{'_BitwiseCopyable' is deprecated: Use BitwiseCopyable}}{{documentation-file=deprecated-declaration}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// RUN: %target-typecheck-verify-swift -print-diagnostic-groups -swift-version 6
|
||||
// RUN: %target-typecheck-verify-swift -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 [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]}}
|
||||
takesHorse(x) // expected-warning {{conformance of 'HasDeprecatedConformance1' to 'Horse' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
takesHorseExistential(x) // expected-warning {{conformance of 'HasDeprecatedConformance1' to 'Horse' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
x.giddyUp() // expected-warning {{conformance of 'HasDeprecatedConformance1' to 'Horse' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
_ = x.isGalloping // expected-warning {{conformance of 'HasDeprecatedConformance1' to 'Horse' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
_ = x[keyPath: \.isGalloping] // expected-warning {{conformance of 'HasDeprecatedConformance1' to 'Horse' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
_ = UsesHorse<HasDeprecatedConformance1>.self // expected-warning {{conformance of 'HasDeprecatedConformance1' to 'Horse' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
}
|
||||
|
||||
@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 [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]}}
|
||||
takesHorse(x) // expected-warning {{conformance of 'HasDeprecatedConformance2' to 'Horse' is deprecated: This conformance is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
takesHorseExistential(x) // expected-warning {{conformance of 'HasDeprecatedConformance2' to 'Horse' is deprecated: This conformance is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
x.giddyUp() // expected-warning {{conformance of 'HasDeprecatedConformance2' to 'Horse' is deprecated: This conformance is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
_ = x.isGalloping // expected-warning {{conformance of 'HasDeprecatedConformance2' to 'Horse' is deprecated: This conformance is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
_ = x[keyPath: \.isGalloping] // expected-warning {{conformance of 'HasDeprecatedConformance2' to 'Horse' is deprecated: This conformance is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
_ = UsesHorse<HasDeprecatedConformance2>.self // expected-warning {{conformance of 'HasDeprecatedConformance2' to 'Horse' is deprecated: This conformance is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
}
|
||||
|
||||
@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 [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]}}
|
||||
takesHorse(x) // expected-warning {{conformance of 'HasDeprecatedConformance3' to 'Horse' was deprecated in macOS 10.8}}{{documentation-file=deprecated-declaration}}
|
||||
takesHorseExistential(x) // expected-warning {{conformance of 'HasDeprecatedConformance3' to 'Horse' was deprecated in macOS 10.8}}{{documentation-file=deprecated-declaration}}
|
||||
x.giddyUp() // expected-warning {{conformance of 'HasDeprecatedConformance3' to 'Horse' was deprecated in macOS 10.8}}{{documentation-file=deprecated-declaration}}
|
||||
_ = x.isGalloping // expected-warning {{conformance of 'HasDeprecatedConformance3' to 'Horse' was deprecated in macOS 10.8}}{{documentation-file=deprecated-declaration}}
|
||||
_ = x[keyPath: \.isGalloping] // expected-warning {{conformance of 'HasDeprecatedConformance3' to 'Horse' was deprecated in macOS 10.8}}{{documentation-file=deprecated-declaration}}
|
||||
_ = UsesHorse<HasDeprecatedConformance3>.self // expected-warning {{conformance of 'HasDeprecatedConformance3' to 'Horse' was deprecated in macOS 10.8}}{{documentation-file=deprecated-declaration}}
|
||||
}
|
||||
|
||||
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 [DeprecatedDeclaration]}}
|
||||
// expected-warning@-1 {{conformance of 'HasDeprecatedConformance1' to 'Horse' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
// expected-note@-2 {{in associated type 'Self.H' (inferred as 'HasDeprecatedConformance1')}}
|
||||
typealias H = HasDeprecatedConformance1
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// RUN: %swift -typecheck -parse-as-library -print-diagnostic-groups -target %target-cpu-apple-macosx51 %clang-importer-sdk -I %S/Inputs/custom-modules %s -verify
|
||||
// RUN: %swift -typecheck -parse-as-library -print-diagnostic-groups -target %target-cpu-apple-macosx51 %clang-importer-sdk -I %S/Inputs/custom-modules %s 2>&1 | %FileCheck %s '--implicit-check-not=<unknown>:0'
|
||||
// RUN: %swift -typecheck -parse-as-library -target %target-cpu-apple-macosx51 %clang-importer-sdk -I %S/Inputs/custom-modules %s -verify
|
||||
// RUN: %swift -typecheck -parse-as-library -target %target-cpu-apple-macosx51 %clang-importer-sdk -I %S/Inputs/custom-modules %s 2>&1 | %FileCheck %s '--implicit-check-not=<unknown>:0'
|
||||
//
|
||||
// This test requires a target of OS X 51 or later to test deprecation
|
||||
// diagnostics because (1) we only emit deprecation warnings if a symbol is
|
||||
@@ -26,11 +26,11 @@ func useClassThatTriggersImportOfDeprecatedEnum() {
|
||||
}
|
||||
|
||||
func directUseShouldStillTriggerDeprecationWarning() {
|
||||
_ = 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]}}
|
||||
_ = NSDeprecatedOptions.first // expected-warning {{'NSDeprecatedOptions' was deprecated in macOS 51: Use a different API}}{{documentation-file=deprecated-declaration}}
|
||||
_ = NSDeprecatedEnum.first // expected-warning {{'NSDeprecatedEnum' was deprecated in macOS 51: Use a different API}}{{documentation-file=deprecated-declaration}}
|
||||
}
|
||||
|
||||
func useInSignature(options: NSDeprecatedOptions) { // expected-warning {{'NSDeprecatedOptions' 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}}{{documentation-file=deprecated-declaration}}
|
||||
}
|
||||
|
||||
|
||||
@@ -83,20 +83,20 @@ class ClassWithComputedPropertyDeprecatedIn51 {
|
||||
}
|
||||
}
|
||||
|
||||
var unannotatedPropertyDeprecatedIn51 : ClassDeprecatedIn51 { // expected-warning {{ClassDeprecatedIn51' was deprecated in macOS 51 [DeprecatedDeclaration]}}
|
||||
var unannotatedPropertyDeprecatedIn51 : ClassDeprecatedIn51 { // expected-warning {{ClassDeprecatedIn51' was deprecated in macOS 51}}{{documentation-file=deprecated-declaration}}
|
||||
get {
|
||||
return ClassDeprecatedIn51() // expected-warning {{ClassDeprecatedIn51' was deprecated in macOS 51 [DeprecatedDeclaration]}}
|
||||
return ClassDeprecatedIn51() // expected-warning {{ClassDeprecatedIn51' was deprecated in macOS 51}}{{documentation-file=deprecated-declaration}}
|
||||
}
|
||||
set(newValue) {
|
||||
_ = ClassDeprecatedIn51() // expected-warning {{ClassDeprecatedIn51' was deprecated in macOS 51 [DeprecatedDeclaration]}}
|
||||
_ = ClassDeprecatedIn51() // expected-warning {{ClassDeprecatedIn51' was deprecated in macOS 51}}{{documentation-file=deprecated-declaration}}
|
||||
}
|
||||
}
|
||||
|
||||
var unannotatedStoredPropertyOfTypeDeprecatedIn51 : ClassDeprecatedIn51? = nil // expected-warning {{ClassDeprecatedIn51' was deprecated in macOS 51 [DeprecatedDeclaration]}}
|
||||
var unannotatedStoredPropertyOfTypeDeprecatedIn51 : ClassDeprecatedIn51? = nil // expected-warning {{ClassDeprecatedIn51' was deprecated in macOS 51}}{{documentation-file=deprecated-declaration}}
|
||||
}
|
||||
|
||||
func usesFunctionDeprecatedIn51() {
|
||||
_ = ClassDeprecatedIn51() // expected-warning {{ClassDeprecatedIn51' was deprecated in macOS 51 [DeprecatedDeclaration]}}
|
||||
_ = ClassDeprecatedIn51() // expected-warning {{ClassDeprecatedIn51' was deprecated in macOS 51}}{{documentation-file=deprecated-declaration}}
|
||||
}
|
||||
|
||||
@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 [DeprecatedDeclaration]}}
|
||||
func hasParameterDeprecatedIn51(p: ClassDeprecatedIn51) { // expected-warning {{ClassDeprecatedIn51' was deprecated in macOS 51}}{{documentation-file=deprecated-declaration}}
|
||||
}
|
||||
|
||||
@available(OSX, introduced: 10.8, deprecated: 51)
|
||||
func annotatedHasParameterDeprecatedIn51(p: ClassDeprecatedIn51) {
|
||||
}
|
||||
|
||||
func hasReturnDeprecatedIn51() -> ClassDeprecatedIn51 { // expected-warning {{ClassDeprecatedIn51' was deprecated in macOS 51 [DeprecatedDeclaration]}}
|
||||
func hasReturnDeprecatedIn51() -> ClassDeprecatedIn51 { // expected-warning {{ClassDeprecatedIn51' was deprecated in macOS 51}}{{documentation-file=deprecated-declaration}}
|
||||
}
|
||||
|
||||
@available(OSX, introduced: 10.8, deprecated: 51)
|
||||
func annotatedHasReturnDeprecatedIn51() -> ClassDeprecatedIn51 {
|
||||
}
|
||||
|
||||
var globalWithDeprecatedType : ClassDeprecatedIn51? = nil // expected-warning {{ClassDeprecatedIn51' was deprecated in macOS 51 [DeprecatedDeclaration]}}
|
||||
var globalWithDeprecatedType : ClassDeprecatedIn51? = nil // expected-warning {{ClassDeprecatedIn51' was deprecated in macOS 51}}{{documentation-file=deprecated-declaration}}
|
||||
|
||||
@available(OSX, introduced: 10.8, deprecated: 51)
|
||||
var annotatedGlobalWithDeprecatedType : ClassDeprecatedIn51?
|
||||
|
||||
|
||||
enum EnumWithDeprecatedCasePayload {
|
||||
case WithDeprecatedPayload(p: ClassDeprecatedIn51) // expected-warning {{ClassDeprecatedIn51' was deprecated in macOS 51 [DeprecatedDeclaration]}}
|
||||
case WithDeprecatedPayload(p: ClassDeprecatedIn51) // expected-warning {{ClassDeprecatedIn51' was deprecated in macOS 51}}{{documentation-file=deprecated-declaration}}
|
||||
|
||||
@available(OSX, introduced: 10.8, deprecated: 51)
|
||||
case AnnotatedWithDeprecatedPayload(p: ClassDeprecatedIn51)
|
||||
}
|
||||
|
||||
extension ClassDeprecatedIn51 { // expected-warning {{'ClassDeprecatedIn51' was deprecated in macOS 51 [DeprecatedDeclaration]}}
|
||||
extension ClassDeprecatedIn51 { // expected-warning {{'ClassDeprecatedIn51' was deprecated in macOS 51}}{{documentation-file=deprecated-declaration}}
|
||||
|
||||
}
|
||||
|
||||
@@ -142,9 +142,9 @@ extension ClassDeprecatedIn51 {
|
||||
}
|
||||
|
||||
func callMethodInDeprecatedExtension() {
|
||||
let o = ClassDeprecatedIn51() // expected-warning {{'ClassDeprecatedIn51' was deprecated in macOS 51 [DeprecatedDeclaration]}}
|
||||
let o = ClassDeprecatedIn51() // expected-warning {{'ClassDeprecatedIn51' was deprecated in macOS 51}}{{documentation-file=deprecated-declaration}}
|
||||
|
||||
o.methodInExtensionOfClassDeprecatedIn51() // expected-warning {{'methodInExtensionOfClassDeprecatedIn51()' was deprecated in macOS 51 [DeprecatedDeclaration]}}
|
||||
o.methodInExtensionOfClassDeprecatedIn51() // expected-warning {{'methodInExtensionOfClassDeprecatedIn51()' was deprecated in macOS 51}}{{documentation-file=deprecated-declaration}}
|
||||
}
|
||||
|
||||
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:)' [DeprecatedDeclaration]}}
|
||||
self.method(a: "a", b: "b") // expected-warning{{'method(a:b:)' was deprecated in macOS 51: renamed to 'method(with:)'}}{{documentation-file=deprecated-declaration}}
|
||||
// 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:)' [DeprecatedDeclaration]}}
|
||||
self.method(a: "a", b: "b") // expected-warning{{'method(a:b:)' was deprecated in macOS 51: renamed to 'method(with:and:)'}}{{documentation-file=deprecated-declaration}}
|
||||
// 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:)' [DeprecatedDeclaration]}}
|
||||
I59843_A.configure(a: "a", b: "b") // expected-warning{{'configure(a:b:)' was deprecated in macOS 51: renamed to 'configure(with:)'}}{{documentation-file=deprecated-declaration}}
|
||||
// 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:)' [DeprecatedDeclaration]}}
|
||||
I59843_B.configure(a: "a", b: "b") // expected-warning{{'configure(a:b:)' was deprecated in macOS 51: renamed to 'configure(with:and:)'}}{{documentation-file=deprecated-declaration}}
|
||||
// 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:)' [DeprecatedDeclaration]}}
|
||||
I59843_B.context(a: "a", b: "b") // expected-warning{{'context(a:b:)' was deprecated in macOS 51: replaced by 'I59843_B.context(with:and:)'}}{{documentation-file=deprecated-declaration}}
|
||||
// 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:)' [DeprecatedDeclaration]}}
|
||||
I59843_B.contextDiff(a: "a", b: "b") // expected-warning{{'contextDiff(a:b:)' was deprecated in macOS 51: replaced by 'I59843_A.contextDiff(with:and:)'}}{{documentation-file=deprecated-declaration}}
|
||||
// expected-note@-1{{use 'I59843_A.contextDiff(with:and:)' instead}} {{3-23=I59843_A.contextDiff}} {{24-25=with}} {{32-33=and}}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// RUN: %target-typecheck-verify-swift -swift-version 5 -print-diagnostic-groups
|
||||
// RUN: %target-typecheck-verify-swift -swift-version 5
|
||||
|
||||
extension DefaultStringInterpolation {
|
||||
@available(*, deprecated) func appendInterpolation(deprecated: Int) {}
|
||||
@@ -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 [DeprecatedDeclaration]}}
|
||||
_ = "\(deprecated: 42)" // expected-warning@:7 {{'appendInterpolation(deprecated:)' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
|
||||
_ = "hello, world\(deprecated: 42)!!!" // expected-warning@:19 {{'appendInterpolation(deprecated:)' is deprecated [DeprecatedDeclaration]}}
|
||||
_ = "hello, world\(deprecated: 42)!!!" // expected-warning@:19 {{'appendInterpolation(deprecated:)' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
|
||||
_ = "\(42)\(deprecated: 42)test\(deprecated: 42)"
|
||||
// expected-warning@-1:12 {{'appendInterpolation(deprecated:)' is deprecated [DeprecatedDeclaration]}}
|
||||
// expected-warning@-2:33 {{'appendInterpolation(deprecated:)' is deprecated [DeprecatedDeclaration]}}
|
||||
// expected-warning@-1:12 {{'appendInterpolation(deprecated:)' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
// expected-warning@-2:33 {{'appendInterpolation(deprecated:)' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
_ = """
|
||||
This is a multiline literal with a deprecated interpolation:
|
||||
|
||||
\(deprecated: 42)
|
||||
"""
|
||||
// expected-warning@-2:2 {{'appendInterpolation(deprecated:)' is deprecated [DeprecatedDeclaration]}}
|
||||
// expected-warning@-2:2 {{'appendInterpolation(deprecated:)' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
|
||||
@@ -1,4 +1,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
|
||||
// RUN: %target-swift-frontend -typecheck -verify -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 [DeprecatedDeclaration]}}
|
||||
// expected-warning@-1{{'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'OldSchoolStruct' to 'Hashable' by implementing 'hash(into:)' instead}}{{documentation-file=deprecated-declaration}}
|
||||
}
|
||||
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 [DeprecatedDeclaration]}}
|
||||
// expected-warning@-1{{'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'OldSchoolEnum' to 'Hashable' by implementing 'hash(into:)' instead}}{{documentation-file=deprecated-declaration}}
|
||||
}
|
||||
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 [DeprecatedDeclaration]}}
|
||||
// expected-warning@-1{{'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'OldSchoolClass' to 'Hashable' by implementing 'hash(into:)' instead}}{{documentation-file=deprecated-declaration}}
|
||||
}
|
||||
|
||||
// However, it's okay to implement `hashValue` as long as `hash(into:)` is also
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// RUN: %target-typecheck-verify-swift -strict-memory-safety -print-diagnostic-groups
|
||||
// RUN: %target-typecheck-verify-swift -strict-memory-safety
|
||||
|
||||
// The feature flag should be enabled.
|
||||
#if !hasFeature(StrictMemorySafety)
|
||||
@@ -91,9 +91,9 @@ func testUnsafeAsSequenceForEach() {
|
||||
|
||||
// expected-warning@+1{{expression uses unsafe constructs but is not marked with 'unsafe'}}{{12-12=unsafe }}
|
||||
for _ in uas { } // expected-note{{conformance}}
|
||||
// expected-warning@-1{{for-in loop uses unsafe constructs but is not marked with 'unsafe' [StrictMemorySafety]}}{{7-7=unsafe }}
|
||||
// expected-warning@-1{{for-in loop uses unsafe constructs but is not marked with 'unsafe'}}{{documentation-file=strict-memory-safety}}{{7-7=unsafe }}
|
||||
|
||||
for _ in unsafe uas { } // expected-warning{{for-in loop uses unsafe constructs but is not marked with 'unsafe' [StrictMemorySafety]}}{{7-7=unsafe }}
|
||||
for _ in unsafe uas { } // expected-warning{{for-in loop uses unsafe constructs but is not marked with 'unsafe'}}{{documentation-file=strict-memory-safety}}{{7-7=unsafe }}
|
||||
|
||||
for unsafe _ in unsafe uas { } // okay
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// RUN: %target-typecheck-verify-swift -strict-memory-safety -print-diagnostic-groups
|
||||
// RUN: %target-typecheck-verify-swift -strict-memory-safety
|
||||
|
||||
@unsafe
|
||||
class NotSafe {
|
||||
@@ -36,7 +36,7 @@ class NotSafeSubclass: NotSafe {
|
||||
_ = NotSafe[ns]
|
||||
NotSafe.doStatically(NotSafe.self)
|
||||
|
||||
ns.stillUnsafe() // expected-warning{{expression uses unsafe constructs but is not marked with 'unsafe' [StrictMemorySafety]}}
|
||||
ns.stillUnsafe() // expected-warning{{expression uses unsafe constructs but is not marked with 'unsafe'}}{{documentation-file=strict-memory-safety}}
|
||||
// expected-note@-1{{reference to parameter 'ns' involves unsafe type 'NotSafe'}}
|
||||
// expected-note@-2{{reference to instance method 'stillUnsafe()' involves unsafe type 'NotSafe'}}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// RUN: %target-typecheck-verify-swift -strict-memory-safety -print-diagnostic-groups
|
||||
// RUN: %target-typecheck-verify-swift -strict-memory-safety
|
||||
|
||||
@unsafe
|
||||
func iAmUnsafe() { }
|
||||
@@ -21,7 +21,7 @@ class C {
|
||||
|
||||
class D1: C { // expected-note{{make class 'D1' @unsafe to allow unsafe overrides of safe superclass methods}}{{1-1=@unsafe }}
|
||||
@unsafe
|
||||
override func method() { } // expected-warning{{override of safe instance method with unsafe instance method [StrictMemorySafety]}}
|
||||
override func method() { } // expected-warning{{override of safe instance method with unsafe instance method}}{{documentation-file=strict-memory-safety}}
|
||||
}
|
||||
|
||||
@unsafe class D2: C {
|
||||
@@ -34,7 +34,7 @@ protocol P {
|
||||
}
|
||||
|
||||
struct S1: P {
|
||||
// expected-warning@-1{{conformance of 'S1' to protocol 'P' involves unsafe code; use '@unsafe' to indicate that the conformance is not memory-safe [StrictMemorySafety]}}{{12-12=@unsafe }}
|
||||
// expected-warning@-1{{conformance of 'S1' to protocol 'P' involves unsafe code; use '@unsafe' to indicate that the conformance is not memory-safe}}{{documentation-file=strict-memory-safety}}{{12-12=@unsafe }}
|
||||
@unsafe
|
||||
func protoMethod() { } // expected-note{{unsafe instance method 'protoMethod()' cannot satisfy safe requirement}}
|
||||
}
|
||||
@@ -48,7 +48,7 @@ struct S2: P {
|
||||
struct S3 { }
|
||||
|
||||
extension S3: P {
|
||||
// expected-warning@-1{{conformance of 'S3' to protocol 'P' involves unsafe code; use '@unsafe' to indicate that the conformance is not memory-safe [StrictMemorySafety]}}{{15-15=@unsafe }}
|
||||
// expected-warning@-1{{conformance of 'S3' to protocol 'P' involves unsafe code; use '@unsafe' to indicate that the conformance is not memory-safe}}{{documentation-file=strict-memory-safety}}{{15-15=@unsafe }}
|
||||
@unsafe
|
||||
func protoMethod() { } // expected-note{{unsafe instance method 'protoMethod()' cannot satisfy safe requirement}}
|
||||
}
|
||||
@@ -116,12 +116,12 @@ extension UnsafeOuter {
|
||||
var yieldUnsafe: Int {
|
||||
_read {
|
||||
@unsafe let x = 5
|
||||
yield x // expected-warning{{expression uses unsafe constructs but is not marked with 'unsafe' [StrictMemorySafety]}}
|
||||
yield x // expected-warning{{expression uses unsafe constructs but is not marked with 'unsafe'}}{{documentation-file=strict-memory-safety}}
|
||||
// expected-note@-1{{reference to unsafe let 'x'}}
|
||||
}
|
||||
_modify {
|
||||
@unsafe var x = 5
|
||||
yield &x // expected-warning{{expression uses unsafe constructs but is not marked with 'unsafe' [StrictMemorySafety]}}
|
||||
yield &x // expected-warning{{expression uses unsafe constructs but is not marked with 'unsafe'}}{{documentation-file=strict-memory-safety}}
|
||||
// expected-note@-1{{reference to unsafe var 'x'}}
|
||||
}
|
||||
}
|
||||
@@ -142,9 +142,9 @@ struct UnsafeSequence: @unsafe IteratorProtocol, @unsafe Sequence {
|
||||
}
|
||||
|
||||
func forEachLoop(us: UnsafeSequence) {
|
||||
for _ in us { } // expected-warning{{expression uses unsafe constructs but is not marked with 'unsafe' [StrictMemorySafety]}}{{12-12=unsafe }}
|
||||
for _ in us { } // expected-warning{{expression uses unsafe constructs but is not marked with 'unsafe'}}{{documentation-file=strict-memory-safety}}{{12-12=unsafe }}
|
||||
// expected-note@-1{{@unsafe conformance of 'UnsafeSequence' to protocol 'Sequence' involves unsafe code}}
|
||||
// expected-warning@-2{{for-in loop uses unsafe constructs but is not marked with 'unsafe' [StrictMemorySafety]}}
|
||||
// expected-warning@-2{{for-in loop uses unsafe constructs but is not marked with 'unsafe'}}{{documentation-file=strict-memory-safety}}
|
||||
for _ in unsafe us { }
|
||||
// expected-warning@-1{{for-in loop uses unsafe constructs but is not marked with 'unsafe' [StrictMemorySafety]}}
|
||||
// expected-warning@-1{{for-in loop uses unsafe constructs but is not marked with 'unsafe'}}{{documentation-file=strict-memory-safety}}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// RUN: %empty-directory(%t)
|
||||
// RUN: %target-swift-frontend -emit-module-path %t/unsafe_swift_decls.swiftmodule %S/Inputs/unsafe_swift_decls.swift
|
||||
|
||||
// RUN: %target-typecheck-verify-swift -strict-memory-safety -I %t -print-diagnostic-groups
|
||||
// RUN: %target-typecheck-verify-swift -strict-memory-safety -I %t
|
||||
|
||||
// Make sure everything compiles without error when unsafe code is allowed.
|
||||
// RUN: %target-swift-frontend -typecheck %s -I %t
|
||||
@@ -16,7 +16,7 @@ protocol P {
|
||||
@unsafe func g()
|
||||
}
|
||||
|
||||
struct XP: P { // expected-warning{{conformance of 'XP' to protocol 'P' involves unsafe code; use '@unsafe' to indicate that the conformance is not memory-safe [StrictMemorySafety]}}{{12-12=@unsafe }}
|
||||
struct XP: P { // expected-warning{{conformance of 'XP' to protocol 'P' involves unsafe code; use '@unsafe' to indicate that the conformance is not memory-safe}}{{documentation-file=strict-memory-safety}}{{12-12=@unsafe }}
|
||||
@unsafe func f() { } // expected-note{{unsafe instance method 'f()' cannot satisfy safe requirement}}
|
||||
@unsafe func g() { }
|
||||
}
|
||||
@@ -30,7 +30,7 @@ protocol Ptrable2 {
|
||||
}
|
||||
|
||||
extension HasAPointerType: Ptrable2 { } // expected-note{{unsafe type 'HasAPointerType.Ptr' (aka 'PointerType') cannot satisfy safe associated type 'Ptr'}}
|
||||
// expected-warning@-1{{conformance of 'HasAPointerType' to protocol 'Ptrable2' involves unsafe code; use '@unsafe' to indicate that the conformance is not memory-safe [StrictMemorySafety]}}{{28-28=@unsafe }}
|
||||
// expected-warning@-1{{conformance of 'HasAPointerType' to protocol 'Ptrable2' involves unsafe code; use '@unsafe' to indicate that the conformance is not memory-safe}}{{documentation-file=strict-memory-safety}}{{28-28=@unsafe }}
|
||||
|
||||
struct UnsafeXP: @unsafe P {
|
||||
@unsafe func f() { }
|
||||
@@ -44,7 +44,7 @@ protocol MultiP {
|
||||
|
||||
struct ConformsToMultiP { }
|
||||
|
||||
// expected-warning@+1{{conformance of 'ConformsToMultiP' to protocol 'MultiP' involves unsafe code; use '@unsafe' to indicate that the conformance is not memory-safe [StrictMemorySafety]}}{{29-29=@unsafe }}
|
||||
// expected-warning@+1{{conformance of 'ConformsToMultiP' to protocol 'MultiP' involves unsafe code; use '@unsafe' to indicate that the conformance is not memory-safe}}{{documentation-file=strict-memory-safety}}{{29-29=@unsafe }}
|
||||
extension ConformsToMultiP: MultiP {
|
||||
// expected-note@-1{{unsafe type 'UnsafeSuper' cannot satisfy safe associated type 'Ptr'}}
|
||||
@unsafe func f() -> UnsafeSuper {
|
||||
@@ -74,7 +74,7 @@ class Super {
|
||||
}
|
||||
|
||||
class Sub: Super { // expected-note{{make class 'Sub' @unsafe to allow unsafe overrides of safe superclass methods}}{{1-1=@unsafe }}
|
||||
@unsafe override func f() { } // expected-warning{{override of safe instance method with unsafe instance method [StrictMemorySafety]}}
|
||||
@unsafe override func f() { } // expected-warning{{override of safe instance method with unsafe instance method}}{{documentation-file=strict-memory-safety}}
|
||||
@unsafe override func g() { }
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ class ExclusivityChecking {
|
||||
func f() { }
|
||||
};
|
||||
|
||||
// expected-warning@+1{{class 'UnsafeSub' has superclass involving unsafe type 'UnsafeSuper' [StrictMemorySafety]}}{{1-1=@unsafe }}
|
||||
// expected-warning@+1{{class 'UnsafeSub' has superclass involving unsafe type 'UnsafeSuper'}}{{documentation-file=strict-memory-safety}}{{1-1=@unsafe }}
|
||||
class UnsafeSub: UnsafeSuper { }
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
@@ -129,13 +129,13 @@ struct BufferThingy<T> {
|
||||
}
|
||||
|
||||
func testConstruction() {
|
||||
let _ = BufferThingy<Int>(count: 17) // expected-warning{{expression uses unsafe constructs but is not marked with 'unsafe' [StrictMemorySafety]}}{{11-11=unsafe }}
|
||||
let _ = BufferThingy<Int>(count: 17) // expected-warning{{expression uses unsafe constructs but is not marked with 'unsafe'}}{{documentation-file=strict-memory-safety}}{{11-11=unsafe }}
|
||||
// expected-note@-1{{reference to unsafe initializer 'init(count:)'}}
|
||||
}
|
||||
|
||||
func testRHS(b: Bool, x: Int) {
|
||||
@unsafe let limit = 17
|
||||
if b && x > limit { // expected-warning{{expression uses unsafe constructs but is not marked with 'unsafe' [StrictMemorySafety]}}{{6-6=unsafe }}
|
||||
if b && x > limit { // expected-warning{{expression uses unsafe constructs but is not marked with 'unsafe'}}{{documentation-file=strict-memory-safety}}{{6-6=unsafe }}
|
||||
// expected-note@-1{{reference to unsafe let 'limit'}}
|
||||
}
|
||||
}
|
||||
@@ -171,7 +171,7 @@ typealias SuperUnsafe = UnsafeSuper
|
||||
|
||||
@unsafe typealias SuperUnsafe2 = UnsafeSuper
|
||||
|
||||
// expected-warning@+3{{enum 'HasUnsafeThings' has storage involving unsafe types [StrictMemorySafety]}}
|
||||
// expected-warning@+3{{enum 'HasUnsafeThings' has storage involving unsafe types}}{{documentation-file=strict-memory-safety}}
|
||||
// expected-note@+2{{add '@unsafe' if this type is also unsafe to use}}{{1-1=@unsafe }}
|
||||
// expected-note@+1{{add '@safe' if this type encapsulates the unsafe storage in a safe interface}}{{1-1=@safe }}
|
||||
enum HasUnsafeThings {
|
||||
@@ -181,7 +181,7 @@ case one(UnsafeSuper) // expected-note{{enum case 'one' involves unsafe type 'Un
|
||||
case two(UnsafeSuper) // expected-note{{enum case 'two' involves unsafe type 'UnsafeSuper'}}
|
||||
}
|
||||
|
||||
// expected-warning@+3{{class 'ClassWithUnsafeStorage' has storage involving unsafe types [StrictMemorySafety]}}
|
||||
// expected-warning@+3{{class 'ClassWithUnsafeStorage' has storage involving unsafe types}}{{documentation-file=strict-memory-safety}}
|
||||
// expected-note@+2{{add '@unsafe' if this type is also unsafe to use}}{{1-1=@unsafe }}
|
||||
// expected-note@+1{{add '@safe' if this type encapsulates the unsafe storage in a safe interface}}{{1-1=@safe }}
|
||||
class ClassWithUnsafeStorage {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// RUN: %target-typecheck-verify-swift -print-diagnostic-groups
|
||||
// RUN: %target-typecheck-verify-swift
|
||||
|
||||
protocol P { }
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// RUN: %target-typecheck-verify-swift -print-diagnostic-groups
|
||||
// RUN: %target-typecheck-verify-swift
|
||||
|
||||
@unsafe func unsafeFunc() { }
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// RUN: %target-typecheck-verify-swift -module-name Test -print-diagnostic-groups
|
||||
// RUN: %target-typecheck-verify-swift -module-name Test
|
||||
|
||||
@available(*, unavailable)
|
||||
func unavailable_func() {}
|
||||
@@ -197,8 +197,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\" [DeprecatedDeclaration]}}
|
||||
var _: DeprecatedTypeWithMessage // expected-warning{{'DeprecatedTypeWithMessage' is deprecated: Pandas \u{1F43C} are cute [DeprecatedDeclaration]}}
|
||||
deprecated_func_with_message() // expected-warning{{'deprecated_func_with_message()' is deprecated: Say \"Hi\"}}{{documentation-file=deprecated-declaration}}
|
||||
var _: DeprecatedTypeWithMessage // expected-warning{{'DeprecatedTypeWithMessage' is deprecated: Pandas \u{1F43C} are cute}}{{documentation-file=deprecated-declaration}}
|
||||
}
|
||||
|
||||
@available(*, deprecated, message: "message")
|
||||
@@ -216,16 +216,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' [DeprecatedDeclaration]}}
|
||||
deprecated_func_with_renamed() // expected-warning{{'deprecated_func_with_renamed()' is deprecated: renamed to 'blarg'}}{{documentation-file=deprecated-declaration}}
|
||||
// expected-note@-1{{use 'blarg'}}{{3-31=blarg}}
|
||||
|
||||
Test.deprecated_func_with_renamed() // expected-warning{{'deprecated_func_with_renamed()' is deprecated: renamed to 'blarg' [DeprecatedDeclaration]}}
|
||||
Test.deprecated_func_with_renamed() // expected-warning{{'deprecated_func_with_renamed()' is deprecated: renamed to 'blarg'}}{{documentation-file=deprecated-declaration}}
|
||||
// expected-note@-1{{use 'blarg' instead}}
|
||||
|
||||
deprecated_func_with_message_renamed() //expected-warning{{'deprecated_func_with_message_renamed()' is deprecated: blarg is your friend [DeprecatedDeclaration]}}
|
||||
deprecated_func_with_message_renamed() //expected-warning{{'deprecated_func_with_message_renamed()' is deprecated: blarg is your friend}}{{documentation-file=deprecated-declaration}}
|
||||
// expected-note@-1{{use 'blarg'}}{{3-39=blarg}}
|
||||
|
||||
var _: DeprecatedTypeWithRename // expected-warning{{'DeprecatedTypeWithRename' is deprecated: renamed to 'wobble' [DeprecatedDeclaration]}}
|
||||
var _: DeprecatedTypeWithRename // expected-warning{{'DeprecatedTypeWithRename' is deprecated: renamed to 'wobble'}}{{documentation-file=deprecated-declaration}}
|
||||
// expected-note@-1{{use 'wobble'}}{{10-34=wobble}}
|
||||
}
|
||||
|
||||
@@ -315,7 +315,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 '&-' [DeprecatedDeclaration]}} expected-note {{use '&-' instead}} {{5-6=&-}}
|
||||
x - y // expected-warning {{'-' is deprecated: renamed to '&-'}}{{documentation-file=deprecated-declaration}} expected-note {{use '&-' instead}} {{5-6=&-}}
|
||||
}
|
||||
|
||||
@available(*, unavailable, renamed: "DummyType.foo")
|
||||
@@ -332,11 +332,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' [DeprecatedDeclaration]}} expected-note {{use 'DummyType.bar' instead}} {{3-19=DummyType.bar}}
|
||||
deprecatedMember() // expected-warning {{'deprecatedMember()' is deprecated: renamed to 'DummyType.bar'}}{{documentation-file=deprecated-declaration}} 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' [DeprecatedDeclaration]}} expected-note {{use 'DummyType.Bar' instead}} {{10-24=DummyType.Bar}}
|
||||
let y: DeprecatedType? = nil // expected-warning {{'DeprecatedType' is deprecated: renamed to 'DummyType.Bar'}}{{documentation-file=deprecated-declaration}} expected-note {{use 'DummyType.Bar' instead}} {{10-24=DummyType.Bar}}
|
||||
_ = y
|
||||
}
|
||||
|
||||
@@ -385,13 +385,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:)' [DeprecatedDeclaration]}} 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:)'}}{{documentation-file=deprecated-declaration}} 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:)' [DeprecatedDeclaration]}} 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:)'}}{{documentation-file=deprecated-declaration}} 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 [DeprecatedDeclaration]}} expected-note {{use 'DummyType.moreShinyLabeledArguments(example:)' instead}} {{3-30=DummyType.moreShinyLabeledArguments}} {{31-32=example}}
|
||||
deprecatedMemberArgNamesMsg(b: 1) // expected-warning {{'deprecatedMemberArgNamesMsg(b:)' is deprecated: ha}}{{documentation-file=deprecated-declaration}} 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}}
|
||||
@@ -463,8 +463,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()' [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=}}
|
||||
deprecatedInstance(a: 0) // expected-warning{{'deprecatedInstance(a:)' is deprecated: replaced by instance method 'Int.foo()'}}{{documentation-file=deprecated-declaration}} expected-note{{use 'Int.foo()' instead}} {{3-21=0.foo}} {{22-26=}}
|
||||
deprecatedInstanceMessage(a: 0) // expected-warning{{'deprecatedInstanceMessage(a:)' is deprecated: blah}}{{documentation-file=deprecated-declaration}} 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=}}
|
||||
}
|
||||
@@ -530,13 +530,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' [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=}}
|
||||
deprecatedInstanceProperty(a: 1) // expected-warning {{'deprecatedInstanceProperty(a:)' is deprecated: replaced by property 'Int.prop'}}{{documentation-file=deprecated-declaration}} expected-note{{use 'Int.prop' instead}} {{3-29=1.prop}} {{29-35=}}
|
||||
deprecatedClassProperty() // expected-warning {{'deprecatedClassProperty()' is deprecated: replaced by property 'Int.prop'}}{{documentation-file=deprecated-declaration}} expected-note{{use 'Int.prop' instead}} {{3-26=Int.prop}} {{26-28=}}
|
||||
deprecatedGlobalProperty() // expected-warning {{'deprecatedGlobalProperty()' is deprecated: replaced by 'global'}}{{documentation-file=deprecated-declaration}} expected-note{{use 'global' instead}} {{3-27=global}} {{27-29=}}
|
||||
|
||||
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=}}
|
||||
deprecatedInstancePropertyMessage(a: 1) // expected-warning {{'deprecatedInstancePropertyMessage(a:)' is deprecated: blah}}{{documentation-file=deprecated-declaration}} expected-note{{use 'Int.prop' instead}} {{3-36=1.prop}} {{36-42=}}
|
||||
deprecatedClassPropertyMessage() // expected-warning {{'deprecatedClassPropertyMessage()' is deprecated: blah}}{{documentation-file=deprecated-declaration}} expected-note{{use 'Int.prop' instead}} {{3-33=Int.prop}} {{33-35=}}
|
||||
deprecatedGlobalPropertyMessage() // expected-warning {{'deprecatedGlobalPropertyMessage()' is deprecated: blah}}{{documentation-file=deprecated-declaration}} expected-note{{use 'global' instead}} {{3-34=global}} {{34-36=}}
|
||||
}
|
||||
|
||||
@available(*, unavailable, renamed: "setter:Int.prop(self:_:)")
|
||||
@@ -647,7 +647,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:)' [DeprecatedDeclaration]}} expected-note {{use 'init(new:)' instead}} {{15-18=new}}
|
||||
self.init(old: testSelf) // expected-warning {{'init(old:)' is deprecated: replaced by 'init(new:)'}}{{documentation-file=deprecated-declaration}} expected-note {{use 'init(new:)' instead}} {{15-18=new}}
|
||||
}
|
||||
|
||||
init(testSuper: Int) {}
|
||||
@@ -666,32 +666,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:)' [DeprecatedDeclaration]}} expected-note {{use 'init(new:)' instead}} {{16-19=new}}
|
||||
super.init(old: testSuper) // expected-warning {{'init(old:)' is deprecated: replaced by 'init(new:)'}}{{documentation-file=deprecated-declaration}} 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:)' [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(old: 0) // expected-warning {{'init(old:)' is deprecated: replaced by 'init(new:)'}}{{documentation-file=deprecated-declaration}} expected-note {{use 'init(new:)' instead}} {{24-27=new}}
|
||||
_ = DeprecatedInitBase.init(old: 0) // expected-warning {{'init(old:)' is deprecated: replaced by 'init(new:)'}}{{documentation-file=deprecated-declaration}} expected-note {{use 'init(new:)' instead}} {{29-32=new}}
|
||||
let _: DeprecatedInitBase = .init(old: 0) // expected-warning {{'init(old:)' is deprecated: replaced by 'init(new:)'}}{{documentation-file=deprecated-declaration}} expected-note {{use 'init(new:)' instead}} {{35-38=new}}
|
||||
_ = DeprecatedInitSub2(old: 0) // expected-warning {{'init(old:)' is deprecated: replaced by 'init(new:)'}}{{documentation-file=deprecated-declaration}} expected-note {{use 'init(new:)' instead}} {{24-27=new}}
|
||||
_ = DeprecatedInitSub2.init(old: 0) // expected-warning {{'init(old:)' is deprecated: replaced by 'init(new:)'}}{{documentation-file=deprecated-declaration}} expected-note {{use 'init(new:)' instead}} {{29-32=new}}
|
||||
let _: DeprecatedInitSub2 = .init(old: 0) // expected-warning {{'init(old:)' is deprecated: replaced by 'init(new:)'}}{{documentation-file=deprecated-declaration}} expected-note {{use 'init(new:)' instead}} {{35-38=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(multipleEqualAvailabilityAttributes: 0) // expected-warning {{'init(multipleEqualAvailabilityAttributes:)' is deprecated: replaced by 'init(new:)'}}{{documentation-file=deprecated-declaration}} expected-note {{use 'init(new:)' instead}} {{24-59=new}}
|
||||
_ = DeprecatedInitBase.init(multipleEqualAvailabilityAttributes: 0) // expected-warning {{'init(multipleEqualAvailabilityAttributes:)' is deprecated: replaced by 'init(new:)'}}{{documentation-file=deprecated-declaration}} expected-note {{use 'init(new:)' instead}} {{29-64=new}}
|
||||
let _: DeprecatedInitBase = .init(multipleEqualAvailabilityAttributes: 0) // expected-warning {{'init(multipleEqualAvailabilityAttributes:)' is deprecated: replaced by 'init(new:)'}}{{documentation-file=deprecated-declaration}} expected-note {{use 'init(new:)' instead}} {{35-70=new}}
|
||||
_ = DeprecatedInitSub2(multipleEqualAvailabilityAttributes: 0) // expected-warning {{'init(multipleEqualAvailabilityAttributes:)' is deprecated: replaced by 'init(new:)'}}{{documentation-file=deprecated-declaration}} expected-note {{use 'init(new:)' instead}} {{24-59=new}}
|
||||
_ = DeprecatedInitSub2.init(multipleEqualAvailabilityAttributes: 0) // expected-warning {{'init(multipleEqualAvailabilityAttributes:)' is deprecated: replaced by 'init(new:)'}}{{documentation-file=deprecated-declaration}} expected-note {{use 'init(new:)' instead}} {{29-64=new}}
|
||||
let _: DeprecatedInitSub2 = .init(multipleEqualAvailabilityAttributes: 0) // expected-warning {{'init(multipleEqualAvailabilityAttributes:)' is deprecated: replaced by 'init(new:)'}}{{documentation-file=deprecated-declaration}} expected-note {{use 'init(new:)' instead}} {{35-70=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}}
|
||||
_ = DeprecatedInitBase(multipleUnequalAvailabilityAttributes: 0) // expected-warning {{'init(multipleUnequalAvailabilityAttributes:)' is deprecated: replaced by 'init(new:)'}}{{documentation-file=deprecated-declaration}} expected-note {{use 'init(new:)' instead}} {{24-61=new}}
|
||||
_ = DeprecatedInitBase.init(multipleUnequalAvailabilityAttributes: 0) // expected-warning {{'init(multipleUnequalAvailabilityAttributes:)' is deprecated: replaced by 'init(new:)'}}{{documentation-file=deprecated-declaration}} expected-note {{use 'init(new:)' instead}} {{29-66=new}}
|
||||
let _: DeprecatedInitBase = .init(multipleUnequalAvailabilityAttributes: 0) // expected-warning {{'init(multipleUnequalAvailabilityAttributes:)' is deprecated: replaced by 'init(new:)'}}{{documentation-file=deprecated-declaration}} expected-note {{use 'init(new:)' instead}} {{35-72=new}}
|
||||
_ = DeprecatedInitSub2(multipleUnequalAvailabilityAttributes: 0) // expected-warning {{'init(multipleUnequalAvailabilityAttributes:)' is deprecated: replaced by 'init(new:)'}}{{documentation-file=deprecated-declaration}} expected-note {{use 'init(new:)' instead}} {{24-61=new}}
|
||||
_ = DeprecatedInitSub2.init(multipleUnequalAvailabilityAttributes: 0) // expected-warning {{'init(multipleUnequalAvailabilityAttributes:)' is deprecated: replaced by 'init(new:)'}}{{documentation-file=deprecated-declaration}} expected-note {{use 'init(new:)' instead}} {{29-66=new}}
|
||||
let _: DeprecatedInitSub2 = .init(multipleUnequalAvailabilityAttributes: 0) // expected-warning {{'init(multipleUnequalAvailabilityAttributes:)' is deprecated: replaced by 'init(new:)'}}{{documentation-file=deprecated-declaration}} expected-note {{use 'init(new:)' instead}} {{35-72=new}}
|
||||
|
||||
|
||||
class Base {
|
||||
@@ -961,31 +961,31 @@ var deprecatedProperty: Int {
|
||||
@available(*, deprecated, message: "bad setter") set {}
|
||||
}
|
||||
|
||||
_ = deprecatedGetter // expected-warning {{getter for 'deprecatedGetter' is deprecated [DeprecatedDeclaration]}} {{none}}
|
||||
_ = deprecatedGetter // expected-warning {{getter for 'deprecatedGetter' is deprecated}}{{documentation-file=deprecated-declaration}} {{none}}
|
||||
deprecatedGetter = 0
|
||||
deprecatedGetter += 1 // expected-warning {{getter for 'deprecatedGetter' is deprecated [DeprecatedDeclaration]}} {{none}}
|
||||
deprecatedGetter += 1 // expected-warning {{getter for 'deprecatedGetter' is deprecated}}{{documentation-file=deprecated-declaration}} {{none}}
|
||||
|
||||
_ = deprecatedGetterOnly // expected-warning {{getter for 'deprecatedGetterOnly' is deprecated [DeprecatedDeclaration]}} {{none}}
|
||||
_ = deprecatedGetterOnly // expected-warning {{getter for 'deprecatedGetterOnly' is deprecated}}{{documentation-file=deprecated-declaration}} {{none}}
|
||||
|
||||
_ = deprecatedSetter
|
||||
deprecatedSetter = 0 // expected-warning {{setter for 'deprecatedSetter' is deprecated [DeprecatedDeclaration]}} {{none}}
|
||||
deprecatedSetter += 1 // expected-warning {{setter for 'deprecatedSetter' is deprecated [DeprecatedDeclaration]}} {{none}}
|
||||
deprecatedSetter = 0 // expected-warning {{setter for 'deprecatedSetter' is deprecated}}{{documentation-file=deprecated-declaration}} {{none}}
|
||||
deprecatedSetter += 1 // expected-warning {{setter for 'deprecatedSetter' is deprecated}}{{documentation-file=deprecated-declaration}} {{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}}
|
||||
_ = deprecatedBoth // expected-warning {{getter for 'deprecatedBoth' is deprecated}}{{documentation-file=deprecated-declaration}} {{none}}
|
||||
deprecatedBoth = 0 // expected-warning {{setter for 'deprecatedBoth' is deprecated}}{{documentation-file=deprecated-declaration}} {{none}}
|
||||
deprecatedBoth += 1 // expected-warning {{getter for 'deprecatedBoth' is deprecated}}{{documentation-file=deprecated-declaration}} {{none}} expected-warning {{setter for 'deprecatedBoth' is deprecated}}{{documentation-file=deprecated-declaration}} {{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}}
|
||||
_ = deprecatedMessage // expected-warning {{getter for 'deprecatedMessage' is deprecated: bad getter}}{{documentation-file=deprecated-declaration}} {{none}}
|
||||
deprecatedMessage = 0 // expected-warning {{setter for 'deprecatedMessage' is deprecated: bad setter}}{{documentation-file=deprecated-declaration}} {{none}}
|
||||
deprecatedMessage += 1 // expected-warning {{getter for 'deprecatedMessage' is deprecated: bad getter}}{{documentation-file=deprecated-declaration}} {{none}} expected-warning {{setter for 'deprecatedMessage' is deprecated: bad setter}}{{documentation-file=deprecated-declaration}} {{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}}
|
||||
_ = deprecatedRename // expected-warning {{getter for 'deprecatedRename' is deprecated: renamed to 'betterThing()'}}{{documentation-file=deprecated-declaration}} {{none}}
|
||||
deprecatedRename = 0 // expected-warning {{setter for 'deprecatedRename' is deprecated: renamed to 'setBetterThing(_:)'}}{{documentation-file=deprecated-declaration}} {{none}}
|
||||
deprecatedRename += 1 // expected-warning {{getter for 'deprecatedRename' is deprecated: renamed to 'betterThing()'}}{{documentation-file=deprecated-declaration}} {{none}} expected-warning {{setter for 'deprecatedRename' is deprecated: renamed to 'setBetterThing(_:)'}}{{documentation-file=deprecated-declaration}} {{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}}
|
||||
_ = deprecatedProperty // expected-warning {{'deprecatedProperty' is deprecated: bad variable}}{{documentation-file=deprecated-declaration}} {{none}}
|
||||
deprecatedProperty = 0 // expected-warning {{'deprecatedProperty' is deprecated: bad variable}}{{documentation-file=deprecated-declaration}} {{none}}
|
||||
deprecatedProperty += 1 // expected-warning {{'deprecatedProperty' is deprecated: bad variable}}{{documentation-file=deprecated-declaration}} {{none}}
|
||||
|
||||
var unavailableGetter: Int {
|
||||
@available(*, unavailable) get { return 0 } // expected-note * {{here}}
|
||||
@@ -1071,29 +1071,29 @@ struct DeprecatedAccessors {
|
||||
}
|
||||
|
||||
mutating func testAccessors(other: inout DeprecatedAccessors) {
|
||||
_ = 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}}
|
||||
_ = deprecatedMessage // expected-warning {{getter for 'deprecatedMessage' is deprecated: bad getter}}{{documentation-file=deprecated-declaration}} {{none}}
|
||||
deprecatedMessage = 0 // expected-warning {{setter for 'deprecatedMessage' is deprecated: bad setter}}{{documentation-file=deprecated-declaration}} {{none}}
|
||||
deprecatedMessage += 1 // expected-warning {{getter for 'deprecatedMessage' is deprecated: bad getter}}{{documentation-file=deprecated-declaration}} {{none}} expected-warning {{setter for 'deprecatedMessage' is deprecated: bad setter}}{{documentation-file=deprecated-declaration}} {{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.deprecatedMessage // expected-warning {{getter for 'deprecatedMessage' is deprecated: bad getter}}{{documentation-file=deprecated-declaration}} {{none}}
|
||||
other.deprecatedMessage = 0 // expected-warning {{setter for 'deprecatedMessage' is deprecated: bad setter}}{{documentation-file=deprecated-declaration}} {{none}}
|
||||
other.deprecatedMessage += 1 // expected-warning {{getter for 'deprecatedMessage' is deprecated: bad getter}}{{documentation-file=deprecated-declaration}} {{none}} expected-warning {{setter for 'deprecatedMessage' is deprecated: bad setter}}{{documentation-file=deprecated-declaration}} {{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}}
|
||||
_ = other.deprecatedProperty // expected-warning {{'deprecatedProperty' is deprecated: bad property}}{{documentation-file=deprecated-declaration}} {{none}}
|
||||
other.deprecatedProperty = 0 // expected-warning {{'deprecatedProperty' is deprecated: bad property}}{{documentation-file=deprecated-declaration}} {{none}}
|
||||
other.deprecatedProperty += 1 // expected-warning {{'deprecatedProperty' is deprecated: bad property}}{{documentation-file=deprecated-declaration}} {{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}}
|
||||
_ = DeprecatedAccessors.staticDeprecated // expected-warning {{getter for 'staticDeprecated' is deprecated: bad getter}}{{documentation-file=deprecated-declaration}} {{none}}
|
||||
DeprecatedAccessors.staticDeprecated = 0 // expected-warning {{setter for 'staticDeprecated' is deprecated: bad setter}}{{documentation-file=deprecated-declaration}} {{none}}
|
||||
DeprecatedAccessors.staticDeprecated += 1 // expected-warning {{getter for 'staticDeprecated' is deprecated: bad getter}}{{documentation-file=deprecated-declaration}} {{none}} expected-warning {{setter for 'staticDeprecated' is deprecated: bad setter}}{{documentation-file=deprecated-declaration}} {{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[0] // expected-warning {{getter for 'subscript(_:)' is deprecated: bad subscript getter}}{{documentation-file=deprecated-declaration}} {{none}}
|
||||
other[0] = 0 // expected-warning {{setter for 'subscript(_:)' is deprecated: bad subscript setter}}{{documentation-file=deprecated-declaration}} {{none}}
|
||||
other[0] += 1 // expected-warning {{getter for 'subscript(_:)' is deprecated: bad subscript getter}}{{documentation-file=deprecated-declaration}} {{none}} expected-warning {{setter for 'subscript(_:)' is deprecated: bad subscript setter}}{{documentation-file=deprecated-declaration}} {{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}}
|
||||
_ = other[alsoDeprecated: 0] // expected-warning {{'subscript(alsoDeprecated:)' is deprecated: bad subscript!}}{{documentation-file=deprecated-declaration}} {{none}}
|
||||
other[alsoDeprecated: 0] = 0 // expected-warning {{'subscript(alsoDeprecated:)' is deprecated: bad subscript!}}{{documentation-file=deprecated-declaration}} {{none}}
|
||||
other[alsoDeprecated: 0] += 1 // expected-warning {{'subscript(alsoDeprecated:)' is deprecated: bad subscript!}}{{documentation-file=deprecated-declaration}} {{none}}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1209,7 +1209,7 @@ struct BadRename {
|
||||
}
|
||||
|
||||
func testBadRename() {
|
||||
_ = BadRename(from: 5, to: 17) // expected-warning{{'init(from:to:step:)' is deprecated: replaced by 'init(range:step:)' [DeprecatedDeclaration]}}
|
||||
_ = BadRename(from: 5, to: 17) // expected-warning{{'init(from:to:step:)' is deprecated: replaced by 'init(range:step:)'}}{{documentation-file=deprecated-declaration}}
|
||||
// expected-note@-1{{use 'init(range:step:)' instead}}
|
||||
}
|
||||
|
||||
@@ -1242,27 +1242,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:)' [DeprecatedDeclaration]}}
|
||||
twoTrailingClosures(x) {} b: {} // expected-warning {{'twoTrailingClosures(_:a:b:)' is deprecated: replaced by instance method 'TypeWithTrailingClosures.twoTrailingClosures(a:b:)'}}{{documentation-file=deprecated-declaration}}
|
||||
// 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:)' [DeprecatedDeclaration]}}
|
||||
twoTrailingClosuresWithDefaults(x: x) {} b: {} // expected-warning {{'twoTrailingClosuresWithDefaults(x:y:z:a:b:)' is deprecated: replaced by instance method 'TypeWithTrailingClosures.twoTrailingClosures(a:b:)'}}{{documentation-file=deprecated-declaration}}
|
||||
// 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:)' [DeprecatedDeclaration]}}
|
||||
threeTrailingClosures(x, a: {}) {} c: {} // expected-warning {{'threeTrailingClosures(_:a:b:c:)' is deprecated: replaced by instance method 'TypeWithTrailingClosures.threeTrailingClosures(a:b:c:)'}}{{documentation-file=deprecated-declaration}}
|
||||
// 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:)' [DeprecatedDeclaration]}}
|
||||
threeTrailingClosuresDiffLabels(x, x: {}) {} z: {} // expected-warning {{'threeTrailingClosuresDiffLabels(_:x:y:z:)' is deprecated: replaced by instance method 'TypeWithTrailingClosures.threeTrailingClosures(a:b:c:)'}}{{documentation-file=deprecated-declaration}}
|
||||
// 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(_:_:_:)' [DeprecatedDeclaration]}}
|
||||
threeTrailingClosuresRemoveLabels(x, a: {}) {} c: {} // expected-warning {{'threeTrailingClosuresRemoveLabels(_:a:b:c:)' is deprecated: replaced by instance method 'TypeWithTrailingClosures.threeUnlabeledTrailingClosures(_:_:_:)'}}{{documentation-file=deprecated-declaration}}
|
||||
// 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:)' [DeprecatedDeclaration]}}
|
||||
variadicTrailingClosures(x) {} _: {} _: {} // expected-warning {{'variadicTrailingClosures(_:a:)' is deprecated: replaced by instance method 'TypeWithTrailingClosures.variadicTrailingClosures(a:b:c:)'}}{{documentation-file=deprecated-declaration}}
|
||||
// expected-note@-1 {{use 'TypeWithTrailingClosures.variadicTrailingClosures(a:b:c:)' instead}} {{3-27=x.variadicTrailingClosures}} {{28-29=}} {{none}}
|
||||
x.variadicTrailingClosures() {} _: {} _: {}
|
||||
}
|
||||
@@ -1305,16 +1305,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:)' [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}}
|
||||
_ = self[argg1: 3, argg2: 3, argg3: 3] // expected-warning {{'subscript(argg1:argg2:argg3:)' is deprecated: renamed to 'subscript(arg1:arg2:arg3:)'}}{{documentation-file=deprecated-declaration}} // 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:)'}}{{documentation-file=deprecated-declaration}} // 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:)' [DeprecatedDeclaration]}} // 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:)'}}{{documentation-file=deprecated-declaration}} // 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(_:)' [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=}}
|
||||
_ = self[to: 3] // expected-warning {{'subscript(to:)' is deprecated: renamed to 'subscriptTo(_:)'}}{{documentation-file=deprecated-declaration}} // expected-note {{use 'subscriptTo(_:)' instead}} {{13-14=.subscriptTo(}} {{19-20=)}} {{14-18=}}
|
||||
_ = x[to: 3] // expected-warning {{'subscript(to:)' is deprecated: renamed to 'subscriptTo(_:)'}}{{documentation-file=deprecated-declaration}} // expected-note {{use 'subscriptTo(_:)' instead}} {{10-11=.subscriptTo(}} {{16-17=)}} {{11-15=}}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// REQUIRES: concurrency
|
||||
// REQUIRES: objc_interop
|
||||
|
||||
// RUN: %target-typecheck-verify-swift -verify-ignore-unknown -print-diagnostic-groups -I %S/Inputs/custom-modules
|
||||
// RUN: %target-typecheck-verify-swift -verify-ignore-unknown -print-diagnostic-groups -parse-as-library -I %S/Inputs/custom-modules
|
||||
// RUN: %target-typecheck-verify-swift -verify-ignore-unknown -I %S/Inputs/custom-modules
|
||||
// RUN: %target-typecheck-verify-swift -verify-ignore-unknown -parse-as-library -I %S/Inputs/custom-modules
|
||||
|
||||
import ObjcAsync
|
||||
|
||||
@@ -286,7 +286,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 [DeprecatedDeclaration]}}
|
||||
// expected-warning@+1{{'manyAttrs(completionHandler:)' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
manyAttrs() { }
|
||||
// expected-warning@+1{{consider using asynchronous alternative function}}
|
||||
macOSOnly() { }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// RUN: %target-typecheck-verify-swift -print-diagnostic-groups
|
||||
// RUN: %target-typecheck-verify-swift
|
||||
|
||||
// Test that availability analysis traverses our type representations.
|
||||
|
||||
@@ -6,36 +6,36 @@
|
||||
class D {}
|
||||
|
||||
protocol P<T1> {
|
||||
associatedtype T1 = D // expected-warning {{'D' is deprecated [DeprecatedDeclaration]}}
|
||||
associatedtype T2: P where T2: D // expected-warning {{'D' is deprecated [DeprecatedDeclaration]}}
|
||||
associatedtype T1 = D // expected-warning {{'D' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
associatedtype T2: P where T2: D // expected-warning {{'D' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
}
|
||||
|
||||
class C<T1>: D { // expected-warning {{'D' is deprecated [DeprecatedDeclaration]}}
|
||||
class C<T1>: D { // expected-warning {{'D' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
struct Nested<T2> {
|
||||
let d: D // expected-warning {{'D' is deprecated [DeprecatedDeclaration]}}
|
||||
let d: D // expected-warning {{'D' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
}
|
||||
}
|
||||
extension C<D> {} // expected-warning {{'D' is deprecated [DeprecatedDeclaration]}}
|
||||
extension C<D> {} // expected-warning {{'D' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
|
||||
func f<each T>(
|
||||
_: (
|
||||
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]}}
|
||||
D, // expected-warning {{'D' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
(D), // expected-warning {{'D' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
C<D> // expected-warning {{'D' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
.Nested<D>, // expected-warning {{'D' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
() -> D, // expected-warning {{'D' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
(inout D) -> Void, // expected-warning {{'D' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
(D...) -> Void, // expected-warning {{'D' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
D?, // expected-warning {{'D' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
[D], // expected-warning {{'D' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
[Int : D], // expected-warning {{'D' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
// FIXME: Emitted twice.
|
||||
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]}}
|
||||
some P<D>, // expected-warning 2 {{'D' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
any P<D>, // expected-warning {{'D' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
any C<D> & P, // expected-warning {{'D' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
D.Type, // expected-warning {{'D' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
repeat (D, each T) // expected-warning {{'D' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
),
|
||||
_: @escaping (D) -> Void // expected-warning {{'D' is deprecated [DeprecatedDeclaration]}}
|
||||
_: @escaping (D) -> Void // expected-warning {{'D' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
)
|
||||
where repeat each T: D {} // expected-warning {{'D' is deprecated [DeprecatedDeclaration]}}
|
||||
where repeat each T: D {} // expected-warning {{'D' is deprecated}}{{documentation-file=deprecated-declaration}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// RUN: %target-typecheck-verify-swift -print-diagnostic-groups
|
||||
// RUN: %target-typecheck-verify-swift
|
||||
// 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 [DeprecatedDeclaration]}}
|
||||
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}}{{documentation-file=deprecated-declaration}}
|
||||
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 [DeprecatedDeclaration]}}
|
||||
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}}{{documentation-file=deprecated-declaration}}
|
||||
nonisolated static func ==(lhs: C2, rhs: C2) -> Bool { true }
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// RUN: %target-typecheck-verify-swift -print-diagnostic-groups
|
||||
// RUN: %target-typecheck-verify-swift
|
||||
|
||||
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' [DeprecatedDeclaration]}}
|
||||
// expected-warning@+1 {{deprecated default implementation is used to satisfy instance method 'f()' required by protocol 'DeprecatedDefault'}}{{documentation-file=deprecated-declaration}}
|
||||
struct S2: DeprecatedDefault {}
|
||||
|
||||
// No warning if the conformance itself is deprecated
|
||||
@@ -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 [DeprecatedDeclaration]}}
|
||||
// expected-warning@+1 {{deprecated default implementation is used to satisfy instance method 'f()' required by protocol 'DeprecatedDefaultWithMessage': write it yourself}}{{documentation-file=deprecated-declaration}}
|
||||
struct S6: DeprecatedDefaultWithMessage {}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// %target-swift-frontend -no-color-diagnostics -print-diagnostic-groups -diagnostic-documentation-path %S/test-docs/ -typecheck %s -strict-memory-safety
|
||||
// %target-swift-frontend -no-color-diagnostics -diagnostic-documentation-path %S/test-docs/ -typecheck %s -strict-memory-safety
|
||||
|
||||
// RUN: %empty-directory(%t)
|
||||
// RUN: %target-swift-frontend -typecheck -no-color-diagnostics -print-diagnostic-groups -diagnostic-documentation-path %S/test-docs/ -serialize-diagnostics-path %t/serialized.dia %s -strict-memory-safety
|
||||
// RUN: %target-swift-frontend -typecheck -no-color-diagnostics -diagnostic-documentation-path %S/test-docs/ -serialize-diagnostics-path %t/serialized.dia %s -strict-memory-safety
|
||||
// RUN: c-index-test -read-diagnostics %t/serialized.dia > %t/serialized.txt 2>&1
|
||||
// RUN: %FileCheck %s < %t/serialized.txt
|
||||
|
||||
@@ -10,7 +10,7 @@ func f() { }
|
||||
|
||||
func g() {
|
||||
f()
|
||||
// CHECK: [[@LINE-1]]:3: warning: 'f()' is deprecated: please do not use [DeprecatedDeclaration] [-W{{.*}}deprecated-declaration.md] [DeprecatedDeclaration]
|
||||
// CHECK: [[@LINE-1]]:3: warning: 'f()' is deprecated: please do not use [-W{{.*}}deprecated-declaration.md] [DeprecatedDeclaration]
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ func beCareful() { }
|
||||
|
||||
func test() {
|
||||
beCareful()
|
||||
// CHECK: [[@LINE-1]]:3: warning: expression uses unsafe constructs but is not marked with 'unsafe' [StrictMemorySafety] [-W{{.*}}strict-memory-safety.md] [StrictMemorySafety]
|
||||
// CHECK: [[@LINE-1]]:3: warning: expression uses unsafe constructs but is not marked with 'unsafe' [-W{{.*}}strict-memory-safety.md] [StrictMemorySafety]
|
||||
}
|
||||
|
||||
// CHECK: [StrictMemorySafety]: <{{.*}}strict-memory-safety.md>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// RUN: %target-typecheck-verify-swift -print-diagnostic-groups
|
||||
// RUN: %target-typecheck-verify-swift
|
||||
// REQUIRES: concurrency
|
||||
|
||||
// Make sure the import succeeds
|
||||
@@ -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' [DeprecatedDeclaration]}}
|
||||
// expected-warning@-1 {{'PartialAsyncTask' is deprecated: renamed to 'UnownedJob'}}{{documentation-file=deprecated-declaration}}
|
||||
// expected-note@-2 {{use 'UnownedJob' instead}}
|
||||
}
|
||||
@available(SwiftStdlib 5.1, *)
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
// RUN: %target-typecheck-verify-swift -swift-version 4 -print-diagnostic-groups
|
||||
// RUN: %target-typecheck-verify-swift -swift-version 4
|
||||
|
||||
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 [DeprecatedDeclaration]}} expected-note {{compactMap}}
|
||||
_ = xs.flatMap(f) // expected-warning {{'flatMap' is deprecated: Please use compactMap(_:) for the case where closure returns an optional value}}{{documentation-file=deprecated-declaration}} 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 [DeprecatedDeclaration]}} expected-note {{compactMap}}
|
||||
_ = xs.flatMap(f) // expected-warning {{'flatMap' is deprecated: Please use compactMap(_:) for the case where closure returns an optional value}}{{documentation-file=deprecated-declaration}} 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 [DeprecatedDeclaration]}} expected-note {{compactMap}}
|
||||
_ = xs.flatMap(f) // expected-warning {{'flatMap' is deprecated: Please use compactMap(_:) for the case where closure returns an optional value}}{{documentation-file=deprecated-declaration}} 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 [DeprecatedDeclaration]}} expected-note {{compactMap}}
|
||||
_ = xs.flatMap(f) // expected-warning {{'flatMap' is deprecated: Please use compactMap(_:) for the case where closure returns an optional value}}{{documentation-file=deprecated-declaration}} 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 [DeprecatedDeclaration]}} expected-note {{compactMap}}
|
||||
_ = xs.flatMap(f) // expected-warning {{'flatMap' is deprecated: Please use compactMap(_:) for the case where closure returns an optional value}}{{documentation-file=deprecated-declaration}} expected-note {{compactMap}}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// RUN: %target-typecheck-verify-swift -print-diagnostic-groups
|
||||
// RUN: %target-typecheck-verify-swift
|
||||
|
||||
#if canImport(Darwin)
|
||||
import Darwin
|
||||
@@ -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'. [DeprecatedDeclaration]}}
|
||||
_ = FLT_RADIX // expected-warning {{is deprecated: Please use 'T.radix' to get the radix of a FloatingPoint type 'T'.}}{{documentation-file=deprecated-declaration}}
|
||||
|
||||
_ = 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]}}
|
||||
_ = FLT_MANT_DIG // expected-warning {{is deprecated: Please use 'Float.significandBitCount + 1'.}}{{documentation-file=deprecated-declaration}}
|
||||
_ = FLT_MIN_EXP // expected-warning {{is deprecated: Please use 'Float.leastNormalMagnitude.exponent + 1'.}}{{documentation-file=deprecated-declaration}}
|
||||
_ = FLT_MAX_EXP // expected-warning {{is deprecated: Please use 'Float.greatestFiniteMagnitude.exponent + 1'.}}{{documentation-file=deprecated-declaration}}
|
||||
_ = FLT_MAX // expected-warning {{is deprecated: Please use 'Float.greatestFiniteMagnitude' or '.greatestFiniteMagnitude'.}}{{documentation-file=deprecated-declaration}}
|
||||
_ = FLT_EPSILON // expected-warning {{is deprecated: Please use 'Float.ulpOfOne' or '.ulpOfOne'.}}{{documentation-file=deprecated-declaration}}
|
||||
_ = FLT_MIN // expected-warning {{is deprecated: Please use 'Float.leastNormalMagnitude' or '.leastNormalMagnitude'.}}{{documentation-file=deprecated-declaration}}
|
||||
_ = FLT_TRUE_MIN // expected-warning {{is deprecated: Please use 'Float.leastNonzeroMagnitude' or '.leastNonzeroMagnitude'.}}{{documentation-file=deprecated-declaration}}
|
||||
|
||||
_ = 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]}}
|
||||
_ = DBL_MANT_DIG // expected-warning {{is deprecated: Please use 'Double.significandBitCount + 1'.}}{{documentation-file=deprecated-declaration}}
|
||||
_ = DBL_MIN_EXP // expected-warning {{is deprecated: Please use 'Double.leastNormalMagnitude.exponent + 1'.}}{{documentation-file=deprecated-declaration}}
|
||||
_ = DBL_MAX_EXP // expected-warning {{is deprecated: Please use 'Double.greatestFiniteMagnitude.exponent + 1'.}}{{documentation-file=deprecated-declaration}}
|
||||
_ = DBL_MAX // expected-warning {{is deprecated: Please use 'Double.greatestFiniteMagnitude' or '.greatestFiniteMagnitude'.}}{{documentation-file=deprecated-declaration}}
|
||||
_ = DBL_EPSILON // expected-warning {{is deprecated: Please use 'Double.ulpOfOne' or '.ulpOfOne'.}}{{documentation-file=deprecated-declaration}}
|
||||
_ = DBL_MIN // expected-warning {{is deprecated: Please use 'Double.leastNormalMagnitude' or '.leastNormalMagnitude'.}}{{documentation-file=deprecated-declaration}}
|
||||
_ = DBL_TRUE_MIN // expected-warning {{is deprecated: Please use 'Double.leastNonzeroMagnitude' or '.leastNonzeroMagnitude'.}}{{documentation-file=deprecated-declaration}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// RUN: %target-typecheck-verify-swift -swift-version 4 -print-diagnostic-groups
|
||||
// RUN: %target-typecheck-verify-swift -swift-version 4
|
||||
|
||||
struct Int64Distance<Element>: Collection {
|
||||
let _storage: [Element]
|
||||
@@ -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 [DeprecatedDeclaration]}}
|
||||
_ = c.index(c.startIndex, offsetBy: i64) // expected-warning {{'index(_:offsetBy:)' is deprecated: all index distances are now of type Int}}{{documentation-file=deprecated-declaration}}
|
||||
|
||||
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]}}
|
||||
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}}{{documentation-file=deprecated-declaration}}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// RUN: %target-typecheck-verify-swift -swift-version 5 -print-diagnostic-groups
|
||||
// RUN: %target-typecheck-verify-swift -swift-version 5
|
||||
|
||||
let a = [10, 20, 30, 40, 50, 60]
|
||||
|
||||
_ = a.index(of: 30) // expected-warning {{'index(of:)' is deprecated: renamed to 'firstIndex(of:)' [DeprecatedDeclaration]}} expected-note {{use 'firstIndex(of:)' instead}}
|
||||
_ = a.index(of: 30) // expected-warning {{'index(of:)' is deprecated: renamed to 'firstIndex(of:)'}}{{documentation-file=deprecated-declaration}} 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:)' [DeprecatedDeclaration]}} expected-note {{use 'firstIndex(where:)' instead}}
|
||||
_ = a.index(where: { $0 > 30 }) // expected-warning {{'index(where:)' is deprecated: renamed to 'firstIndex(where:)'}}{{documentation-file=deprecated-declaration}} expected-note {{use 'firstIndex(where:)' instead}}
|
||||
_ = a.firstIndex(where: { $0 > 30 })
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// RUN: %target-typecheck-verify-swift -print-diagnostic-groups
|
||||
// RUN: %target-typecheck-verify-swift
|
||||
|
||||
#if canImport(Darwin)
|
||||
import Darwin
|
||||
@@ -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. [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_PI // expected-warning {{is deprecated: Please use 'Double.pi' or '.pi' to get the value of correct type and avoid casting.}}{{documentation-file=deprecated-declaration}}
|
||||
_ = 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.}}{{documentation-file=deprecated-declaration}}
|
||||
_ = 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.}}{{documentation-file=deprecated-declaration}}
|
||||
|
||||
_ = M_SQRT2 // expected-warning {{is deprecated: Please use '2.squareRoot()'. [DeprecatedDeclaration]}}
|
||||
_ = M_SQRT1_2 // expected-warning {{is deprecated: Please use '0.5.squareRoot()'. [DeprecatedDeclaration]}}
|
||||
_ = M_SQRT2 // expected-warning {{is deprecated: Please use '2.squareRoot()'.}}{{documentation-file=deprecated-declaration}}
|
||||
_ = M_SQRT1_2 // expected-warning {{is deprecated: Please use '0.5.squareRoot()'.}}{{documentation-file=deprecated-declaration}}
|
||||
|
||||
@@ -1,37 +1,37 @@
|
||||
// RUN: %target-typecheck-verify-swift -verify-ignore-unknown -print-diagnostic-groups
|
||||
// RUN: %target-typecheck-verify-swift -verify-ignore-unknown
|
||||
|
||||
import StdlibUnittest
|
||||
|
||||
func checkStringOverloadCompilationDiagnostics() {
|
||||
|
||||
_ = String(cString: "string") // expected-warning {{'init(cString:)' is deprecated: Use a copy of the String argument [DeprecatedDeclaration]}}
|
||||
_ = String(cString: "string") // expected-warning {{'init(cString:)' is deprecated: Use a copy of the String argument}}{{documentation-file=deprecated-declaration}}
|
||||
|
||||
_ = String(validatingUTF8: "string") // expected-warning {{init(validatingUTF8:)' is deprecated: Use a copy of the String argument [DeprecatedDeclaration]}}
|
||||
_ = String(validatingUTF8: "string") // expected-warning {{init(validatingUTF8:)' is deprecated: Use a copy of the String argument}}{{documentation-file=deprecated-declaration}}
|
||||
|
||||
_ = String(validatingCString: "string") // expected-warning {{'init(validatingCString:)' is deprecated: Use a copy of the String argument [DeprecatedDeclaration]}}
|
||||
_ = String(validatingCString: "string") // expected-warning {{'init(validatingCString:)' is deprecated: Use a copy of the String argument}}{{documentation-file=deprecated-declaration}}
|
||||
|
||||
_ = String.decodeCString("string", as: Unicode.UTF8.self) // expected-warning {{'decodeCString(_:as:repairingInvalidCodeUnits:)' is deprecated: Use a copy of the String argument [DeprecatedDeclaration]}}
|
||||
_ = String.decodeCString("string", as: Unicode.UTF8.self) // expected-warning {{'decodeCString(_:as:repairingInvalidCodeUnits:)' is deprecated: Use a copy of the String argument}}{{documentation-file=deprecated-declaration}}
|
||||
|
||||
_ = String(decodingCString: "string", as: Unicode.UTF8.self) // expected-warning {{'init(decodingCString:as:)' is deprecated: Use a copy of the String argument [DeprecatedDeclaration]}}
|
||||
_ = String(decodingCString: "string", as: Unicode.UTF8.self) // expected-warning {{'init(decodingCString:as:)' is deprecated: Use a copy of the String argument}}{{documentation-file=deprecated-declaration}}
|
||||
}
|
||||
|
||||
func checkInoutConversionOverloadCompilationDiagnostics() {
|
||||
|
||||
var i = UInt8.zero
|
||||
|
||||
_ = String(cString: &i) // expected-warning {{'init(cString:)' is deprecated: Use String(_ scalar: Unicode.Scalar) [DeprecatedDeclaration]}}
|
||||
_ = String(cString: &i) // expected-warning {{'init(cString:)' is deprecated: Use String(_ scalar: Unicode.Scalar)}}{{documentation-file=deprecated-declaration}}
|
||||
|
||||
var c = CChar.zero
|
||||
|
||||
_ = String(cString: &c) // expected-warning {{'init(cString:)' is deprecated: Use String(_ scalar: Unicode.Scalar) [DeprecatedDeclaration]}}
|
||||
_ = String(cString: &c) // expected-warning {{'init(cString:)' is deprecated: Use String(_ scalar: Unicode.Scalar)}}{{documentation-file=deprecated-declaration}}
|
||||
|
||||
_ = String(validatingUTF8: &c) // expected-warning {{init(validatingUTF8:)' is deprecated: Use String(_ scalar: Unicode.Scalar) [DeprecatedDeclaration]}}
|
||||
_ = String(validatingUTF8: &c) // expected-warning {{init(validatingUTF8:)' is deprecated: Use String(_ scalar: Unicode.Scalar)}}{{documentation-file=deprecated-declaration}}
|
||||
|
||||
_ = String(validatingCString: &c) // expected-warning {{'init(validatingCString:)' is deprecated: Use String(_ scalar: Unicode.Scalar) [DeprecatedDeclaration]}}
|
||||
_ = String(validatingCString: &c) // expected-warning {{'init(validatingCString:)' is deprecated: Use String(_ scalar: Unicode.Scalar)}}{{documentation-file=deprecated-declaration}}
|
||||
|
||||
var u = Unicode.UTF8.CodeUnit.zero
|
||||
|
||||
_ = String.decodeCString(&u, as: Unicode.UTF8.self) // expected-warning {{'decodeCString(_:as:repairingInvalidCodeUnits:)' is deprecated: Use String(_ scalar: Unicode.Scalar) [DeprecatedDeclaration]}}
|
||||
_ = String.decodeCString(&u, as: Unicode.UTF8.self) // expected-warning {{'decodeCString(_:as:repairingInvalidCodeUnits:)' is deprecated: Use String(_ scalar: Unicode.Scalar)}}{{documentation-file=deprecated-declaration}}
|
||||
|
||||
_ = String(decodingCString: &u, as: Unicode.UTF8.self) // expected-warning {{'init(decodingCString:as:)' is deprecated: Use String(_ scalar: Unicode.Scalar) [DeprecatedDeclaration]}}
|
||||
_ = String(decodingCString: &u, as: Unicode.UTF8.self) // expected-warning {{'init(decodingCString:as:)' is deprecated: Use String(_ scalar: Unicode.Scalar)}}{{documentation-file=deprecated-declaration}}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
// RUN: %target-swift-frontend -typecheck -print-diagnostic-groups -swift-version 4 %s -verify
|
||||
// RUN: %target-swift-frontend -typecheck -swift-version 4 %s -verify
|
||||
|
||||
func testPopFirst() {
|
||||
let str = "abc"
|
||||
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]}}
|
||||
var charView: String.CharacterView // expected-warning{{'CharacterView' is deprecated: Please use String directly}}{{documentation-file=deprecated-declaration}}
|
||||
charView = str.characters // expected-warning{{'characters' is deprecated: Please use String directly}}{{documentation-file=deprecated-declaration}}
|
||||
dump(charView)
|
||||
|
||||
var substr = str[...]
|
||||
_ = substr.popFirst() // ok
|
||||
_ = substr.characters.popFirst() // expected-warning{{'characters' is deprecated: Please use Substring directly [DeprecatedDeclaration]}}
|
||||
_ = substr.characters.popFirst() // expected-warning{{'characters' is deprecated: Please use Substring directly}}{{documentation-file=deprecated-declaration}}
|
||||
_ = substr.unicodeScalars.popFirst() // ok
|
||||
|
||||
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]}}
|
||||
var charSubView: Substring.CharacterView // expected-warning{{'CharacterView' is deprecated: Please use Substring directly}}{{documentation-file=deprecated-declaration}}
|
||||
charSubView = substr.characters // expected-warning{{'characters' is deprecated: Please use Substring directly}}{{documentation-file=deprecated-declaration}}
|
||||
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}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// RUN: %target-typecheck-verify-swift -concurrency-model=task-to-thread -print-diagnostic-groups
|
||||
// RUN: %target-typecheck-verify-swift -concurrency-model=task-to-thread
|
||||
|
||||
// REQUIRES: freestanding
|
||||
|
||||
@@ -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:)' [DeprecatedDeclaration]}}
|
||||
_ = await tg.add { return 1 } // expected-warning{{'add(operation:)' is deprecated: renamed to 'addTaskUnlessCancelled(operation:)'}}{{documentation-file=deprecated-declaration}}
|
||||
// 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:)' [DeprecatedDeclaration]}}
|
||||
tg.spawn { return 1 } // expected-warning{{'spawn(operation:)' is deprecated: renamed to 'addTask(operation:)'}}{{documentation-file=deprecated-declaration}}
|
||||
// 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:)' [DeprecatedDeclaration]}}
|
||||
_ = tg.spawnUnlessCancelled { return 1 } // expected-warning{{'spawnUnlessCancelled(operation:)' is deprecated: renamed to 'addTaskUnlessCancelled(operation:)'}}{{documentation-file=deprecated-declaration}}
|
||||
// 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:)' [DeprecatedDeclaration]}}
|
||||
tg.async { return 1 } // expected-warning{{'async(operation:)' is deprecated: renamed to 'addTask(operation:)'}}{{documentation-file=deprecated-declaration}}
|
||||
// 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:)' [DeprecatedDeclaration]}}
|
||||
_ = tg.asyncUnlessCancelled { return 1 } // expected-warning{{'asyncUnlessCancelled(operation:)' is deprecated: renamed to 'addTaskUnlessCancelled(operation:)'}}{{documentation-file=deprecated-declaration}}
|
||||
// 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:)' [DeprecatedDeclaration]}}
|
||||
_ = await tg.add { return 1 } // expected-warning{{'add(operation:)' is deprecated: renamed to 'addTaskUnlessCancelled(operation:)'}}{{documentation-file=deprecated-declaration}}
|
||||
// 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:)' [DeprecatedDeclaration]}}
|
||||
tg.spawn { return 1 } // expected-warning{{'spawn(operation:)' is deprecated: renamed to 'addTask(operation:)'}}{{documentation-file=deprecated-declaration}}
|
||||
// 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:)' [DeprecatedDeclaration]}}
|
||||
_ = tg.spawnUnlessCancelled { return 1 } // expected-warning{{'spawnUnlessCancelled(operation:)' is deprecated: renamed to 'addTaskUnlessCancelled(operation:)'}}{{documentation-file=deprecated-declaration}}
|
||||
// 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:)' [DeprecatedDeclaration]}}
|
||||
tg.async { return 1 } // expected-warning{{'async(operation:)' is deprecated: renamed to 'addTask(operation:)'}}{{documentation-file=deprecated-declaration}}
|
||||
// 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:)' [DeprecatedDeclaration]}}
|
||||
_ = tg.asyncUnlessCancelled { return 1 } // expected-warning{{'asyncUnlessCancelled(operation:)' is deprecated: renamed to 'addTaskUnlessCancelled(operation:)'}}{{documentation-file=deprecated-declaration}}
|
||||
// expected-note@-1{{use 'addTaskUnlessCancelled(operation:)' instead}}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
// RUN: %target-typecheck-verify-swift -enable-upcoming-feature ExistentialAny:adoption \
|
||||
// To verify that the message is not followed by
|
||||
// "; this will be an error ...".
|
||||
// RUN: -print-diagnostic-groups \
|
||||
// RUN: -verify-additional-prefix default-swift-mode- \
|
||||
// RUN: -verify-additional-prefix explicit-any-adopt-
|
||||
|
||||
@@ -32,10 +31,10 @@ protocol Bar {
|
||||
class Bistro {
|
||||
convenience init(_: Bar){ self.init()}
|
||||
// expected-explicit-any-warning@-1 {{use of protocol 'Bar' as a type must be written 'any Bar'; this will be an error in a future Swift language mode}}{{23-26=any Bar}}
|
||||
// expected-explicit-any-adopt-warning@-2 {{use of protocol 'Bar' as a type must be written 'any Bar' [ExistentialAny]}}{{23-26=any Bar}}
|
||||
// expected-explicit-any-adopt-warning@-2 {{use of protocol 'Bar' as a type must be written 'any Bar'}}{{documentation-file=existential-any}}{{23-26=any Bar}}
|
||||
class func returnBar() -> Bar {}
|
||||
// expected-explicit-any-warning@-1 {{use of protocol 'Bar' as a type must be written 'any Bar'; this will be an error in a future Swift language mode}}{{29-32=any Bar}}
|
||||
// expected-explicit-any-adopt-warning@-2 {{use of protocol 'Bar' as a type must be written 'any Bar' [ExistentialAny]}}{{29-32=any Bar}}
|
||||
// expected-explicit-any-adopt-warning@-2 {{use of protocol 'Bar' as a type must be written 'any Bar'}}{{documentation-file=existential-any}}{{29-32=any Bar}}
|
||||
}
|
||||
|
||||
func useBarAsType(_ x: any Bar) {}
|
||||
@@ -235,7 +234,7 @@ enum E1: RawRepresentable {
|
||||
|
||||
var rawValue: P1 {
|
||||
// expected-explicit-any-warning@-1 {{use of protocol 'P1' as a type must be written 'any P1'; this will be an error in a future Swift language mode}}{{17-19=any P1}}
|
||||
// expected-explicit-any-adopt-warning@-2 {{use of protocol 'P1' as a type must be written 'any P1' [ExistentialAny]}}{{17-19=any P1}}
|
||||
// expected-explicit-any-adopt-warning@-2 {{use of protocol 'P1' as a type must be written 'any P1'}}{{documentation-file=existential-any}}{{17-19=any P1}}
|
||||
return ConcreteComposition()
|
||||
}
|
||||
}
|
||||
@@ -333,10 +332,10 @@ enum EE : Equatable, any Empty { // expected-error {{raw type 'any Empty' is not
|
||||
|
||||
// Protocols from a serialized module (the standard library).
|
||||
do {
|
||||
// expected-explicit-any-adopt-warning@+2 {{use of protocol 'Decodable' as a type must be written 'any Decodable' [ExistentialAny]}}
|
||||
// expected-explicit-any-adopt-warning@+2 {{use of protocol 'Decodable' as a type must be written 'any Decodable'}}{{documentation-file=existential-any}}
|
||||
// expected-explicit-any-warning@+1 {{use of protocol 'Decodable' as a type must be written 'any Decodable'; this will be an error in a future Swift language mode}}
|
||||
let _: Decodable
|
||||
// expected-explicit-any-adopt-warning@+2 {{use of 'Codable' (aka 'Decodable & Encodable') as a type must be written 'any Codable' (aka 'any Decodable & Encodable') [ExistentialAny]}}
|
||||
// expected-explicit-any-adopt-warning@+2 {{use of 'Codable' (aka 'Decodable & Encodable') as a type must be written 'any Codable' (aka 'any Decodable & Encodable')}}{{documentation-file=existential-any}}
|
||||
// expected-explicit-any-warning@+1 {{use of 'Codable' (aka 'Decodable & Encodable') as a type must be written 'any Codable' (aka 'any Decodable & Encodable'); this will be an error in a future Swift language mode}}
|
||||
let _: Codable
|
||||
}
|
||||
@@ -566,7 +565,7 @@ func testEnumAssociatedValue() {
|
||||
case c1((any HasAssoc) -> Void)
|
||||
// expected-warning@+1 {{use of protocol 'HasAssoc' as a type must be written 'any HasAssoc'}}
|
||||
case c2((HasAssoc) -> Void)
|
||||
// expected-explicit-any-adopt-warning@+2 {{use of protocol 'P' as a type must be written 'any P' [ExistentialAny]}}
|
||||
// expected-explicit-any-adopt-warning@+2 {{use of protocol 'P' as a type must be written 'any P'}}{{documentation-file=existential-any}}
|
||||
// expected-explicit-any-warning@+1 {{use of protocol 'P' as a type must be written 'any P'; this will be an error in a future Swift language mode}}
|
||||
case c3((P) -> Void)
|
||||
}
|
||||
@@ -594,7 +593,7 @@ func f(_ x: Objectlike) {}
|
||||
typealias Copy = Copyable
|
||||
func h(_ z1: Copy,
|
||||
// expected-explicit-any-warning@-1 {{use of 'Copy' (aka 'Copyable') as a type must be written 'any Copy' (aka 'any Copyable'); this will be an error in a future Swift language mode}}
|
||||
// expected-explicit-any-adopt-warning@-2 {{use of 'Copy' (aka 'Copyable') as a type must be written 'any Copy' (aka 'any Copyable') [ExistentialAny]}}
|
||||
// expected-explicit-any-adopt-warning@-2 {{use of 'Copy' (aka 'Copyable') as a type must be written 'any Copy' (aka 'any Copyable')}}{{documentation-file=existential-any}}
|
||||
_ z2: Copyable) {}
|
||||
// expected-explicit-any-warning@-1 {{use of protocol 'Copyable' as a type must be written 'any Copyable'; this will be an error in a future Swift language mode}}
|
||||
// expected-explicit-any-adopt-warning@-2 {{use of protocol 'Copyable' as a type must be written 'any Copyable' [ExistentialAny]}}
|
||||
// expected-explicit-any-adopt-warning@-2 {{use of protocol 'Copyable' as a type must be written 'any Copyable'}}{{documentation-file=existential-any}}
|
||||
|
||||
Reference in New Issue
Block a user