Skip to content

[5.5][Diagnostics] Correct the insert location of missing return type fix-it. #38144

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
Jun 29, 2021

Conversation

hborla
Copy link
Member

@hborla hborla commented Jun 29, 2021

Cherry-pick of #38112

  • Explanation: In 5.5, a new fix-it was added to automatically insert a return type placeholder for a function that mistakenly returns a non-Void result from a Void function. This fix-it is always inserted after the parameter list, which isn't correct for functions with effects like throws and async. This change moves the fix-it location to after the effects if they exist.
  • Scope: This change only affects invalid code that returns a non-Void result from a Void function.
  • Risk: Very low.
  • Testing: Added a handful of diagnostics tests that check the fix-it location.
  • Reviewer: @xedin @theblixguy

Resolves: rdar://79345188

after any effects specifiers like async, throws, rethrows, etc.
@hborla hborla requested a review from a team as a code owner June 29, 2021 00:51
@hborla hborla added the r5.5 label Jun 29, 2021
@hborla
Copy link
Member Author

hborla commented Jun 29, 2021

@swift-ci please test

@hborla
Copy link
Member Author

hborla commented Jun 29, 2021

@swift-ci please test Windows platform

@hborla hborla merged commit 66710b0 into swiftlang:release/5.5 Jun 29, 2021
@hborla hborla deleted the 5.5-return-type-fixit-loc branch June 29, 2021 18:01
@AnthonyLatsis AnthonyLatsis added 🍒 release cherry pick Flag: Release branch cherry picks swift 5.5 labels Jan 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks swift 5.5
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants