Skip to content

[Diagnostics] Fix and adjust FixIt application #2941

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 1 commit into from
Jan 22, 2025

Conversation

rintaro
Copy link
Member

@rintaro rintaro commented Jan 16, 2025

  • Fix mismatch on FixIt.Change.replace between several application implementations. Specifically .replace should includes the trivia.
  • Ignore no-op FixIt.Change.replace{Leading|Trailing}Triviia.

@rintaro
Copy link
Member Author

rintaro commented Jan 16, 2025

swiftlang/swift#78670
@swift-ci Please test

@rintaro rintaro force-pushed the swiftdiags-replace-trivia branch 2 times, most recently from 122e9bc to 6cb2779 Compare January 16, 2025 00:41
@@ -36,6 +36,7 @@ public enum FixItApplier {
) -> String {
let messages = messages ?? diagnostics.compactMap { $0.fixIts.first?.message.message }

// FIXME: This assumes every fix-it is applied to a node in the 'tree', which is not guaranteed.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we check this and ignore Fix-Its that apply to different trees? Although I do worry that macro authors will have made Fix-Its that apply to modified trees and that we might break them with this…

@rintaro
Copy link
Member Author

rintaro commented Jan 16, 2025

swiftlang/swift#78670
@swift-ci Please test

@rintaro
Copy link
Member Author

rintaro commented Jan 16, 2025

swiftlang/swift#78670
@swift-ci Please test Windows

@rintaro
Copy link
Member Author

rintaro commented Jan 16, 2025

* Fix mismatch on 'FixIt.Change.replace' between several application
  implementations. Specifically '.replace' should includes the trivia.
* Ignore no-op 'FixIt.Change.replace{Leading|Trailing}Triviia'.
@rintaro rintaro force-pushed the swiftdiags-replace-trivia branch from 6cb2779 to edde9b6 Compare January 21, 2025 17:54
@rintaro
Copy link
Member Author

rintaro commented Jan 21, 2025

@rintaro rintaro merged commit a84f21d into swiftlang:main Jan 22, 2025
3 checks passed
@rintaro rintaro deleted the swiftdiags-replace-trivia branch January 22, 2025 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants