Skip to content

Commit d83d046

Browse files
authored
Merge pull request #72002 from hborla/adjust-language-mode-warning
[Diagnostics] Clarify the wording of `error_in_future_swift_version`.
2 parents e5f80d1 + 466a021 commit d83d046

File tree

76 files changed

+360
-347
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+360
-347
lines changed

include/swift/AST/DiagnosticsCommon.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ NOTE(brace_stmt_suggest_do,none,
4545
"did you mean to use a 'do' statement?", ())
4646

4747
WARNING(error_in_future_swift_version,none,
48-
"%0; this is an error in Swift %1",
48+
"%0; this is an error in the Swift %1 language mode",
4949
(DiagnosticInfo *, unsigned))
5050

5151
// Generic disambiguation

include/swift/AST/DiagnosticsSema.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6812,7 +6812,7 @@ WARNING(inlinable_decl_ref_from_hidden_module_warn,
68126812
none, "%kind0 cannot be used in " FRAGILE_FUNC_KIND "1 "
68136813
"because %select{<<ERROR>>|<<ERROR>>|<<ERROR>>|<<ERROR>>|"
68146814
"%2 was not imported by this file}3"
6815-
"; this is an error in Swift 6",
6815+
"; this is an error in the Swift 6 language mode",
68166816
(const ValueDecl *, unsigned, Identifier, unsigned))
68176817

68186818
ERROR(inlinable_typealias_desugars_to_type_from_hidden_module,

include/swift/AST/EducationalNotes.def

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,5 +86,8 @@ EDUCATIONAL_NOTES(result_builder_missing_build_array,
8686

8787
EDUCATIONAL_NOTES(multiple_inheritance,
8888
"multiple-inheritance.md")
89-
89+
90+
EDUCATIONAL_NOTES(error_in_future_swift_version,
91+
"error-in-future-swift-version.md")
92+
9093
#undef EDUCATIONAL_NOTES

test/ClangImporter/objc_async.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ class BarFrame: PictureFrame {
298298
@available(SwiftStdlib 5.5, *)
299299
@SomeGlobalActor
300300
class BazFrame: NotIsolatedPictureFrame {
301-
// expected-warning@-1 {{global actor 'SomeGlobalActor'-isolated class 'BazFrame' has different actor isolation from nonisolated superclass 'NotIsolatedPictureFrame'; this is an error in Swift 6}}
301+
// 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}}
302302
init() {
303303
super.init(size: 0)
304304
}
@@ -365,7 +365,7 @@ func testSender(
365365

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

370370
sender.sendGeneric(sendableGeneric) // no warning
371371

@@ -393,7 +393,7 @@ extension SomeWrapper: Sendable where T: Sendable {}
393393
func makeCall(slowServer: SlowServer) {
394394
slowServer.doSomethingSlow("churn butter") { (_ : Int) in
395395
let _ = self.isolatedThing
396-
// expected-warning@-1 {{main actor-isolated property 'isolatedThing' can not be referenced from a Sendable closure; this is an error in Swift 6}}
396+
// 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}}
397397
}
398398
}
399399
}

test/ClangImporter/objc_async_conformance.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class SelectorBothAsync2: NSObject, SelectorBothAsyncProto {
8787
func hello() async -> Bool // expected-note {{method 'hello()' declared here}}
8888

8989
@objc(helloWithCompletion:)
90-
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}}
90+
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}}
9191
}
9292

9393
// additional coverage for situation like C4, where the method names don't

test/ClangImporter/objc_bridging_custom.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ protocol TestProto {
161161

162162
@objc optional subscript(a a: Refrigerator) -> Refrigerator? { get } // expected-note 2 {{here}} {{none}}
163163
@objc optional subscript(generic a: ManufacturerInfo<NSString>) -> ManufacturerInfo<NSString>? { get } // expected-note {{here}} {{none}}
164-
// 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}}
164+
// 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}}
165165

166166
@objc optional var prop: Refrigerator? { get } // expected-note {{here}} {{none}}
167167
@objc optional var propGeneric: ManufacturerInfo<NSString>? { get } // expected-note {{here}} {{none}}

test/Compatibility/attr_usableFromInline_protocol.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ public protocol PublicProtoWithReqs {
77
}
88

99
@usableFromInline struct UFIAdopter<T> : PublicProtoWithReqs {}
10-
// 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}}
11-
// 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}}
10+
// 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}}
11+
// 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}}
1212
extension UFIAdopter {
1313
typealias Assoc = Int
1414
// expected-note@-1 {{'Assoc' declared here}}
@@ -18,9 +18,9 @@ extension UFIAdopter {
1818

1919
@usableFromInline struct UFIAdopterAllInOne<T> : PublicProtoWithReqs {
2020
typealias Assoc = Int
21-
// 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}}
21+
// 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}}
2222
func foo() {}
23-
// 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}}
23+
// 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}}
2424
}
2525

2626
internal struct InternalAdopter<T> : PublicProtoWithReqs {}
@@ -36,8 +36,8 @@ extension InternalAdopter {
3636
}
3737

3838
public struct PublicAdopter<T> : UFIProtoWithReqs {}
39-
// 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}}
40-
// 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}}
39+
// 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}}
40+
// 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}}
4141
extension PublicAdopter {
4242
typealias Assoc = Int
4343
// expected-note@-1 {{'Assoc' declared here}}

test/Compatibility/ownership_protocol.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
class SomeClass {}
55

66
protocol P {
7-
// expected-warning@+1 {{'weak' cannot be applied to a property declaration in a protocol; this is an error in Swift 5}}
7+
// expected-warning@+1 {{'weak' cannot be applied to a property declaration in a protocol; this is an error in the Swift 5 language mode}}
88
weak var foo: SomeClass? { get set }
9-
// expected-warning@+1 {{'unowned' cannot be applied to a property declaration in a protocol; this is an error in Swift 5}}
9+
// expected-warning@+1 {{'unowned' cannot be applied to a property declaration in a protocol; this is an error in the Swift 5 language mode}}
1010
unowned var foo2: SomeClass { get set }
11-
// expected-warning@+2 {{'weak' cannot be applied to a property declaration in a protocol; this is an error in Swift 5}}
11+
// expected-warning@+2 {{'weak' cannot be applied to a property declaration in a protocol; this is an error in the Swift 5 language mode}}
1212
// expected-error@+1 {{'weak' may only be applied to class and class-bound protocol types, not 'Int'}}
1313
weak var foo3: Int? { get set }
14-
// expected-warning@+2 {{'unowned' cannot be applied to a property declaration in a protocol; this is an error in Swift 5}}
14+
// expected-warning@+2 {{'unowned' cannot be applied to a property declaration in a protocol; this is an error in the Swift 5 language mode}}
1515
// expected-error@+1 {{'unowned' may only be applied to class and class-bound protocol types, not 'Int'}}
1616
unowned var foo4: Int { get set }
1717
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
struct Foo {
2-
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}}
2+
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}}
33
}

test/Concurrency/actor_inout_isolation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ actor ProtectDictionary {
318318

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

0 commit comments

Comments
 (0)