Skip to content

[Diagnostics] Fix range of fix-its in verify mode #30501

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
Mar 24, 2020

Conversation

omochi
Copy link
Contributor

@omochi omochi commented Mar 19, 2020

This PR fix fix-its range of fix-its range in verify mode.

Current:

$ swift -frontend -typecheck -verify a.swift
a.swift:2:89: error: expected no fix-its; actual fix-it seen: {{14-14=else }}
  guard true { return } // unexpected-error {{expected 'else' after 'guard' condition}} {{none}}
                                                                                        ^~~~~~~
                                                                                        {{14-14=else }}

A range of fix-its is {{none}.

Patched:

$ swift -frontend -typecheck -verify a.swift
a.swift:2:89: error: expected no fix-its; actual fix-it seen: {{14-14=else }}
  guard true { return } // unexpected-error {{expected 'else' after 'guard' condition}} {{none}}
                                                                                        ^~~~~~~~
                                                                                        {{14-14=else }}

A range of fix-its is {{none}}.

This error is small for human.
But it's important when we use -verify-apply-fixes.

I also added test case for -verify-apply-fixes.
I couldn't find one already exists.

@gregomni @jrose-apple Please review this.
Original code is introduced in #674 .

@rintaro
Copy link
Member

rintaro commented Mar 23, 2020

@swift-ci Please smoke test

@omochi
Copy link
Contributor Author

omochi commented Mar 24, 2020

@rintaro Thank you for review!

@omochi omochi merged commit e1cb1a2 into swiftlang:master Mar 24, 2020
@omochi omochi deleted the fix-verify-range branch March 24, 2020 02:25
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