Skip to content

Rename NoteMessage.fixItID to noteID #2264

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
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
4 changes: 4 additions & 0 deletions Release Notes/510.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@

## API-Incompatible Changes

- `NoteMessage.fixItID` renamed to `noteID`
- 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`.
- Issue: https://github.com/apple/swift-syntax/issues/2261
- Pull Request: https://github.com/apple/swift-syntax/pull/2264

## Template

Expand Down
9 changes: 8 additions & 1 deletion Sources/SwiftDiagnostics/Note.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,14 @@ public protocol NoteMessage {
var message: String { get }

/// See ``MessageID``.
var fixItID: MessageID { get }
var noteID: MessageID { get }
}

extension NoteMessage {
@available(*, deprecated, message: "Use noteID instead.", renamed: "noteID")
public var fixItID: MessageID {
return noteID
}
}

/// A note that points to another node that's relevant for a Diagnostic.
Expand Down
13 changes: 9 additions & 4 deletions Sources/SwiftParserDiagnostics/ParserDiagnosticMessages.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,21 @@ public extension ParserError {
}

public protocol ParserNote: NoteMessage {
var fixItID: MessageID { get }
var noteID: MessageID { get }
}

public extension ParserNote {
@available(*, deprecated, message: "Use noteID instead.", renamed: "noteID")
static var fixItID: MessageID {
return Self.noteID
}

static var noteID: MessageID {
return MessageID(domain: diagnosticDomain, id: "\(self)")
}

var fixItID: MessageID {
return Self.fixItID
var noteID: MessageID {
return Self.noteID
}
}

Expand Down Expand Up @@ -594,7 +599,7 @@ public struct StaticParserNote: NoteMessage {
self.messageID = messageID
}

public var fixItID: MessageID {
public var noteID: MessageID {
MessageID(domain: diagnosticDomain, id: "\(type(of: self)).\(messageID)")
}
}
Expand Down