Skip to content
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

Make buildable node fields mutable and fix withTrailingComma #666

Merged
merged 1 commit into from
Aug 31, 2022

Conversation

fwcd
Copy link
Member

@fwcd fwcd commented Aug 31, 2022

withTrailingComma currently discards the value for leadingTrivia. While adding the parameter would be an option, this PR refactors the function to use the

var result = self
result.field = value
return result

pattern. This also has the advantage that new optional fields cannot accidentally be forgotten.

To achieve this, the fields have to be mutable. Since we are dealing with value types with no further invariants, this should hopefully not be an issue though.

@fwcd fwcd requested a review from ahoppen as a code owner August 31, 2022 06:13
@fwcd
Copy link
Member Author

fwcd commented Aug 31, 2022

@swift-ci please test

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.

Sounds good. Thanks for fixing this.

@fwcd fwcd merged commit 114e16a into swiftlang:main Aug 31, 2022
@fwcd fwcd deleted the fwcd/fix-with-trailing-comma branch August 31, 2022 07:51
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