Skip to content

Improve assert statement generation and fix token choices #575

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 3 commits into from
Aug 12, 2022

Conversation

fwcd
Copy link
Member

@fwcd fwcd commented Aug 11, 2022

In preparation for #555, this patch migrates generateAssertStmtTextChoices to return an expr node instead of a string (as a small follow-up to #542). Additionally, it adds a utility function for escaping string literals (to address #549) and a function for generating force-unwraps based on a type's optionality.

@fwcd fwcd requested a review from ahoppen as a code owner August 11, 2022 16:54
Comment on lines 104 to 106
mappedTokenChoices.append(contentsOf: tokenChoices.compactMap { SYNTAX_TOKEN_MAP[$0] })
self.tokenChoices = mappedTokenChoices
mappedTokenChoices.append(contentsOf: tokenChoices.map { SYNTAX_TOKEN_MAP["\($0)Token"] })
Copy link
Member Author

Choose a reason for hiding this comment

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

This fixes a bug where self.tokenChoices was always empty since the tokenChoices do not have the Token suffix.

@fwcd
Copy link
Member Author

fwcd commented Aug 11, 2022

@swift-ci please test

@fwcd fwcd force-pushed the improve-assert-stmt-generation branch 2 times, most recently from f5f167a to 4de056e Compare August 11, 2022 17:52
@fwcd fwcd force-pushed the improve-assert-stmt-generation branch from 3dae647 to ebfa2af Compare August 12, 2022 14:56
@fwcd
Copy link
Member Author

fwcd commented Aug 12, 2022

@swift-ci please test

@fwcd fwcd merged commit 71ab8cc into swiftlang:main Aug 12, 2022
@fwcd fwcd deleted the improve-assert-stmt-generation branch August 12, 2022 17:00
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