Skip to content

[Parser] Improve FixIt for function parameter with missing type (name1 Name2) #1679

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

Conversation

TiagoMaiaL
Copy link
Contributor

Goal

To solve issue #1608.

Notes

There are some TODOs in the code I want to solve but I didn't know how. Any help is appreciated. Thank you.

@TiagoMaiaL TiagoMaiaL requested a review from ahoppen as a code owner May 19, 2023 03:38
@TiagoMaiaL TiagoMaiaL force-pushed the fix-colon-fixit-for-function-signature branch from ae274fa to 73a3a6c Compare May 19, 2023 22:23
@TiagoMaiaL TiagoMaiaL requested a review from ahoppen May 19, 2023 22:23
If the `node.secondName` starts with a capital letter, we now assume the user
wanted it to be the type of the parameter.

This commit makes the following changes to the FixIt of `name1 Name2`:
- from `name1 Name2: TypeText`
- to `name1: Name2`
@TiagoMaiaL TiagoMaiaL force-pushed the fix-colon-fixit-for-function-signature branch from 73a3a6c to b4396f9 Compare May 19, 2023 22:24
@TiagoMaiaL
Copy link
Contributor Author

Do we need the comment in InvalidTests.testInvalid13?

  func testInvalid13() {
    // https://github.com/apple/swift/issues/43190
    // Crash with invalid parameter declaration

Copy link
Member

@ahoppen ahoppen left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution @TiagoMaiaL. This looks very good to me!

@ahoppen
Copy link
Member

ahoppen commented May 19, 2023

@swift-ci Please test

@ahoppen ahoppen enabled auto-merge May 19, 2023 23:38
@ahoppen ahoppen merged commit b3d0d88 into swiftlang:main May 20, 2023
@kimdv kimdv linked an issue May 21, 2023 that may be closed by this pull request
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.

: is not applied in the correct place for function signature Fix-It
2 participants