Skip to content

Fix whitespace in convertStoredPropertyToComputed #3326

Merged
ahoppen merged 2 commits into
swiftlang:mainfrom
Padmashree06:Convert-stored-property-to-computed-refactoring
May 8, 2026
Merged

Fix whitespace in convertStoredPropertyToComputed #3326
ahoppen merged 2 commits into
swiftlang:mainfrom
Padmashree06:Convert-stored-property-to-computed-refactoring

Conversation

@Padmashree06
Copy link
Copy Markdown
Contributor

Description

This PR fixes formatting issue where the refactored computed property was generating a leading space before the type annotation colon (e.g., var x :Int instead of var x: Int).

The fix removes the trailingTrivia from the variable's pattern that was previously associated with the equals sign.

Context

Related to #3249.
Addresses feedback from swiftlang/sourcekit-lsp#2622

Copy link
Copy Markdown
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.

Thanks. Small nitpick, otherwise LGTM.

} else if let providedType = context.type {
typeAnnotation = TypeAnnotationSyntax(type: providedType)
typeAnnotation = TypeAnnotationSyntax(
colon: .colonToken(leadingTrivia: [], trailingTrivia: .space),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Leading trivia is empty by default so we don’t need to specify it.

@Padmashree06
Copy link
Copy Markdown
Contributor Author

Thank you for the review! I have removed the leading trivia!

@ahoppen
Copy link
Copy Markdown
Member

ahoppen commented May 7, 2026

@swift-ci Please test

@ahoppen ahoppen merged commit ac8f50b into swiftlang:main May 8, 2026
37 of 38 checks passed
@Padmashree06
Copy link
Copy Markdown
Contributor Author

Thanks for merging!

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