Skip to content

Conversation

@kishikawakatsumi
Copy link
Contributor

@kishikawakatsumi kishikawakatsumi commented Jun 20, 2023


The following pull request changes will also be merged into the release/5.9 branch.

#1813

This pull request fixes a problem where escaping fails when a pound sign follows a sequence of double quotes or backslashes.

As shown in the added test case, foobar""# and foobar\# require two pound signs as delimiter for escaping, but the current implementation only adds one pound sign, resulting in an incorrect string literal.

The reason for this is that a sequence of double quotes or backslashes will stop counting pound signs if they are not followed by a pound sign.

If a double quotation mark or backslash is followed by a double quotation mark or backslash, it must continue in pound sign counting mode.

…follows a sequence of double quotes or backslashes.

This pull request fixes a problem where escaping fails when a pound sign follows a sequence of double quotes or backslashes.

As shown in the added test case, `foobar""#` and `foobar\\#` require two pound signs as delimiter for escaping, but the current implementation only adds one pound sign, resulting in an incorrect string literal.

The reason for this is that a sequence of double quotes or backslashes will stop counting pound signs if they are not followed by a pound sign.

If a double quotation mark or backslash is followed by a double quotation mark or backslash, it must continue in pound sign counting mode.
@ahoppen
Copy link
Member

ahoppen commented Jun 20, 2023

@swift-ci Please test

@ahoppen ahoppen merged commit c89ea14 into swiftlang:release/5.9 Jun 20, 2023
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.

3 participants