Skip to content

[Diagnostics] Clarify the wording of error_in_future_swift_version. #72002

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/swift/AST/DiagnosticsCommon.def
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ NOTE(brace_stmt_suggest_do,none,
"did you mean to use a 'do' statement?", ())

WARNING(error_in_future_swift_version,none,
"%0; this is an error in Swift %1",
"%0; this is an error in the Swift %1 language mode",
(DiagnosticInfo *, unsigned))

// Generic disambiguation
Expand Down
2 changes: 1 addition & 1 deletion include/swift/AST/DiagnosticsSema.def
Original file line number Diff line number Diff line change
Expand Up @@ -6807,7 +6807,7 @@ WARNING(inlinable_decl_ref_from_hidden_module_warn,
none, "%kind0 cannot be used in " FRAGILE_FUNC_KIND "1 "
"because %select{<<ERROR>>|<<ERROR>>|<<ERROR>>|<<ERROR>>|"
"%2 was not imported by this file}3"
"; this is an error in Swift 6",
"; this is an error in the Swift 6 language mode",
(const ValueDecl *, unsigned, Identifier, unsigned))

ERROR(inlinable_typealias_desugars_to_type_from_hidden_module,
Expand Down
5 changes: 4 additions & 1 deletion include/swift/AST/EducationalNotes.def
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,8 @@ EDUCATIONAL_NOTES(result_builder_missing_build_array,

EDUCATIONAL_NOTES(multiple_inheritance,
"multiple-inheritance.md")


EDUCATIONAL_NOTES(error_in_future_swift_version,
"error-in-future-swift-version.md")

#undef EDUCATIONAL_NOTES
6 changes: 3 additions & 3 deletions test/ClangImporter/objc_async.swift
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ class BarFrame: PictureFrame {
@available(SwiftStdlib 5.5, *)
@SomeGlobalActor
class BazFrame: NotIsolatedPictureFrame {
// expected-warning@-1 {{global actor 'SomeGlobalActor'-isolated class 'BazFrame' has different actor isolation from nonisolated superclass 'NotIsolatedPictureFrame'; this is an error in Swift 6}}
// expected-warning@-1 {{global actor 'SomeGlobalActor'-isolated class 'BazFrame' has different actor isolation from nonisolated superclass 'NotIsolatedPictureFrame'; this is an error in the Swift 6 language mode}}
init() {
super.init(size: 0)
}
Expand Down Expand Up @@ -365,7 +365,7 @@ func testSender(

sender.sendAnyArray([sendableObject])
sender.sendAnyArray([nonSendableObject])
// expected-warning@-1 {{conformance of 'NonSendableClass' to 'Sendable' is unavailable; this is an error in Swift 6}}
// expected-warning@-1 {{conformance of 'NonSendableClass' to 'Sendable' is unavailable; this is an error in the Swift 6 language mode}}

sender.sendGeneric(sendableGeneric) // no warning

Expand Down Expand Up @@ -393,7 +393,7 @@ extension SomeWrapper: Sendable where T: Sendable {}
func makeCall(slowServer: SlowServer) {
slowServer.doSomethingSlow("churn butter") { (_ : Int) in
let _ = self.isolatedThing
// expected-warning@-1 {{main actor-isolated property 'isolatedThing' can not be referenced from a Sendable closure; this is an error in Swift 6}}
// expected-warning@-1 {{main actor-isolated property 'isolatedThing' can not be referenced from a Sendable closure; this is an error in the Swift 6 language mode}}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/ClangImporter/objc_async_conformance.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class SelectorBothAsync2: NSObject, SelectorBothAsyncProto {
func hello() async -> Bool // expected-note {{method 'hello()' declared here}}

@objc(helloWithCompletion:)
func hello(completion: @escaping (Bool) -> Void) // expected-warning {{method 'hello(completion:)' with Objective-C selector 'helloWithCompletion:' conflicts with method 'hello()' with the same Objective-C selector; this is an error in Swift 6}}
func hello(completion: @escaping (Bool) -> Void) // expected-warning {{method 'hello(completion:)' with Objective-C selector 'helloWithCompletion:' conflicts with method 'hello()' with the same Objective-C selector; this is an error in the Swift 6 language mode}}
}

// additional coverage for situation like C4, where the method names don't
Expand Down
2 changes: 1 addition & 1 deletion test/ClangImporter/objc_bridging_custom.swift
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ protocol TestProto {

@objc optional subscript(a a: Refrigerator) -> Refrigerator? { get } // expected-note 2 {{here}} {{none}}
@objc optional subscript(generic a: ManufacturerInfo<NSString>) -> ManufacturerInfo<NSString>? { get } // expected-note {{here}} {{none}}
// expected-warning@-1 {{subscript getter with Objective-C selector 'objectForKeyedSubscript:' conflicts with previous declaration with the same Objective-C selector; this is an error in Swift 6}}
// expected-warning@-1 {{subscript getter with Objective-C selector 'objectForKeyedSubscript:' conflicts with previous declaration with the same Objective-C selector; this is an error in the Swift 6 language mode}}

@objc optional var prop: Refrigerator? { get } // expected-note {{here}} {{none}}
@objc optional var propGeneric: ManufacturerInfo<NSString>? { get } // expected-note {{here}} {{none}}
Expand Down
12 changes: 6 additions & 6 deletions test/Compatibility/attr_usableFromInline_protocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ public protocol PublicProtoWithReqs {
}

@usableFromInline struct UFIAdopter<T> : PublicProtoWithReqs {}
// expected-warning@-1 {{type alias 'Assoc' must be declared '@usableFromInline' because it matches a requirement in protocol 'PublicProtoWithReqs'; this is an error in Swift 5}} {{none}}
// expected-warning@-2 {{instance method 'foo()' must be declared '@usableFromInline' because it matches a requirement in protocol 'PublicProtoWithReqs'; this is an error in Swift 5}} {{none}}
// expected-warning@-1 {{type alias 'Assoc' must be declared '@usableFromInline' because it matches a requirement in protocol 'PublicProtoWithReqs'; this is an error in the Swift 5 language mode}} {{none}}
// expected-warning@-2 {{instance method 'foo()' must be declared '@usableFromInline' because it matches a requirement in protocol 'PublicProtoWithReqs'; this is an error in the Swift 5 language mode}} {{none}}
extension UFIAdopter {
typealias Assoc = Int
// expected-note@-1 {{'Assoc' declared here}}
Expand All @@ -18,9 +18,9 @@ extension UFIAdopter {

@usableFromInline struct UFIAdopterAllInOne<T> : PublicProtoWithReqs {
typealias Assoc = Int
// expected-warning@-1 {{type alias 'Assoc' must be declared '@usableFromInline' because it matches a requirement in protocol 'PublicProtoWithReqs'; this is an error in Swift 5}} {{none}}
// expected-warning@-1 {{type alias 'Assoc' must be declared '@usableFromInline' because it matches a requirement in protocol 'PublicProtoWithReqs'; this is an error in the Swift 5 language mode}} {{none}}
func foo() {}
// expected-warning@-1 {{instance method 'foo()' must be declared '@usableFromInline' because it matches a requirement in protocol 'PublicProtoWithReqs'; this is an error in Swift 5}} {{none}}
// expected-warning@-1 {{instance method 'foo()' must be declared '@usableFromInline' because it matches a requirement in protocol 'PublicProtoWithReqs'; this is an error in the Swift 5 language mode}} {{none}}
}

internal struct InternalAdopter<T> : PublicProtoWithReqs {}
Expand All @@ -36,8 +36,8 @@ extension InternalAdopter {
}

public struct PublicAdopter<T> : UFIProtoWithReqs {}
// expected-warning@-1 {{type alias 'Assoc' must be declared '@usableFromInline' because it matches a requirement in protocol 'UFIProtoWithReqs'; this is an error in Swift 5}} {{none}}
// expected-warning@-2 {{instance method 'foo()' must be declared '@usableFromInline' because it matches a requirement in protocol 'UFIProtoWithReqs'; this is an error in Swift 5}} {{none}}
// expected-warning@-1 {{type alias 'Assoc' must be declared '@usableFromInline' because it matches a requirement in protocol 'UFIProtoWithReqs'; this is an error in the Swift 5 language mode}} {{none}}
// expected-warning@-2 {{instance method 'foo()' must be declared '@usableFromInline' because it matches a requirement in protocol 'UFIProtoWithReqs'; this is an error in the Swift 5 language mode}} {{none}}
extension PublicAdopter {
typealias Assoc = Int
// expected-note@-1 {{'Assoc' declared here}}
Expand Down
8 changes: 4 additions & 4 deletions test/Compatibility/ownership_protocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
class SomeClass {}

protocol P {
// expected-warning@+1 {{'weak' cannot be applied to a property declaration in a protocol; this is an error in Swift 5}}
// expected-warning@+1 {{'weak' cannot be applied to a property declaration in a protocol; this is an error in the Swift 5 language mode}}
weak var foo: SomeClass? { get set }
// expected-warning@+1 {{'unowned' cannot be applied to a property declaration in a protocol; this is an error in Swift 5}}
// expected-warning@+1 {{'unowned' cannot be applied to a property declaration in a protocol; this is an error in the Swift 5 language mode}}
unowned var foo2: SomeClass { get set }
// expected-warning@+2 {{'weak' cannot be applied to a property declaration in a protocol; this is an error in Swift 5}}
// expected-warning@+2 {{'weak' cannot be applied to a property declaration in a protocol; this is an error in the Swift 5 language mode}}
// expected-error@+1 {{'weak' may only be applied to class and class-bound protocol types, not 'Int'}}
weak var foo3: Int? { get set }
// expected-warning@+2 {{'unowned' cannot be applied to a property declaration in a protocol; this is an error in Swift 5}}
// expected-warning@+2 {{'unowned' cannot be applied to a property declaration in a protocol; this is an error in the Swift 5 language mode}}
// expected-error@+1 {{'unowned' may only be applied to class and class-bound protocol types, not 'Int'}}
unowned var foo4: Int { get set }
}
Expand Down
2 changes: 1 addition & 1 deletion test/Concurrency/Inputs/sendable_cycle_other.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
struct Foo {
static let member = Bar() // expected-complete-warning {{static property 'member' is not concurrency-safe because it is not either conforming to 'Sendable' or isolated to a global actor; this is an error in Swift 6}}
static let member = Bar() // expected-complete-warning {{static property 'member' is not concurrency-safe because it is not either conforming to 'Sendable' or isolated to a global actor; this is an error in the Swift 6 language mode}}
}
2 changes: 1 addition & 1 deletion test/Concurrency/actor_inout_isolation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ actor ProtectDictionary {

func invalid() async {
await dict[0].mutate()
// expected-warning@-1 {{cannot call mutating async function 'mutate()' on actor-isolated property 'dict'; this is an error in Swift 6}}
// expected-warning@-1 {{cannot call mutating async function 'mutate()' on actor-isolated property 'dict'; this is an error in the Swift 6 language mode}}
// expected-targeted-complete-warning@-2 {{passing argument of non-sendable type 'inout Optional<Int>' outside of actor-isolated context may introduce data races}}
}
}
Loading