Skip to content

Commit df6600d

Browse files
authored
Merge pull request swiftlang#2264 from kimdv/kimdv/2261-rename-notemessagefixitid-to-noteid
Rename `NoteMessage.fixItID` to `noteID`
2 parents e695b37 + 43c0388 commit df6600d

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

Release Notes/510.md

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

4343
## API-Incompatible Changes
4444

45+
- `NoteMessage.fixItID` renamed to `noteID`
46+
- Description: This was an error that it was named `fixItID` and should have been named `noteID` instead. Accesses to `fixItID` are deprecated and forward to `noteID`. Any types that conform `NoteMessage` it will need to be updated to provide a `noteID` instead of a `fixItID`.
47+
- Issue: https://github.com/apple/swift-syntax/issues/2261
48+
- Pull Request: https://github.com/apple/swift-syntax/pull/2264
4549

4650
## Template
4751

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)