8000 Rename `NoteMessage.fixItID` to `noteID` · swiftlang/swift-syntax@4d04480 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4d04480

Browse files
committed
Rename NoteMessage.fixItID to noteID
1 parent f8ea4db commit 4d04480

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

Release Notes/510.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@
4242

4343
## API-Incompatible Changes
4444

45+
- Note message Fix-It ID
46+
- Description: This was an error that it was named `fixItID` and should have been named `noteID` instead. The deprecation methods
47+
emit a warning that informs the developer that it have been renamed. If you previously conformed to `fixItID` it will not compile.
48+
- Issue: https://github.com/apple/swift-syntax/issues/2261
49+
- Pull Request: https://github.com/apple/swift-syntax/pull/2264
4550

4651
## Template
4752

Sources/SwiftDiagnostics/Note.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,14 @@ public protocol NoteMessage {
2020
var message: String { get }
2121

2222
/// See ``MessageID``.
23-
var fixItID: MessageID { get }
23+
var noteID: MessageID { get }
24+
}
25+
26+
extension NoteMessage {
27+
@available(*, deprecated, message: "Use noteID instead.", renamed: "noteID")
28+
public var fixItID: MessageID {
29+
return noteID
30+
}
2431
}
2532

2633
/// A note that points to another node that's relevant for a Diagnostic.

Sources/SwiftParserDiagnostics/ParserDiagnosticMessages.swift

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,21 @@ public extension ParserError {
3636
}
3737

3838
public protocol ParserNote: NoteMessage {
39-
var fixItID: MessageID { get }
39+
var noteID: MessageID { get }
4040
}
4141

4242
public extension ParserNote {
43+
@available(*, deprecated, message: "Use noteID instead.", renamed: "noteID")
4344
static var fixItID: MessageID {
45+
return Self.noteID
46+
}
47+
48+
static var noteID: MessageID {
4449
return MessageID(domain: diagnosticDomain, id: "\(self)")
4550
}
4651

47-
var fixItID: MessageID {
48-
return Self.fixItID
52+
var noteID: MessageID {
53+
return Self.noteID
4954
}
5055
}
5156

@@ -594,7 +599,7 @@ public struct StaticParserNote: NoteMessage {
594599
self.messageID = messageID
595600
}
596601

597-
public var fixItID: MessageID {
602+
public var noteID: MessageID {
598603
MessageID(domain: diagnosticDomain, id: "\(type(of: self)).\(messageID)")
599604
}
600605
}

0 commit comments

Comments
 (0)
0