Skip to content

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Jun 9, 2024

Linked to swiftlang/swift-syntax#2678 and swiftlang/sourcekit-lsp#1471


We treated enum case parameters the same way as function parameters and weren’t considering that they can be unlabeled. That caused us to insert eg. _ in front of the case’s type, producing case myCase(_ String), which is invalid. When we are inside an enum case parameter and the parameter label is empty, treat it the same as a function call, which will leave the label untouched if it isn’t modified and insert a label including a colon if a new label is introduced.

swiftlang/sourcekit-lsp#1228

@ahoppen
Copy link
Member Author

ahoppen commented Jun 9, 2024

We treated enum case parameters the same way as function parameters and weren’t considering that they can be unlabeled. That caused us to insert eg. `_ ` in front of the case’s type, producing `case myCase(_ String)`, which is invalid. When we are inside an enum case parameter and the parameter label is empty, treat it the same as a function call, which will leave the label untouched if it isn’t modified and insert a label including a colon if a new label is introduced.

swiftlang/sourcekit-lsp#1228
@ahoppen ahoppen force-pushed the enum-case-rename branch from 8058abc to 155773c Compare June 12, 2024 02:19
@ahoppen
Copy link
Member Author

ahoppen commented Jun 12, 2024

@ahoppen ahoppen merged commit f5d15f4 into swiftlang:main Jun 12, 2024
@ahoppen ahoppen deleted the enum-case-rename branch August 4, 2025 10:47
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