Skip to content

[FIR] Don't unescape twice when processing ESCAPE_STRING_TEMPLATE_ENTRY #5465

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

cketti
Copy link
Contributor

@cketti cketti commented Jun 14, 2025

This change avoids needlessly unescaping a character escape sequence in a string twice.

In the psi2fir case, different unescaping implementations were used for the path with template expressions and the path without any template expressions ("fast-pass"); ConversionUtils.escapedStringToCharacter vs. StringUtil.unescapeStringCharacters. The latter supports all of Java's escape sequences instead of just the ones supported by Kotlin. This was not a problem in practice, because when ConversionUtils.escapedStringToCharacter returned an error, the potentially wrongly unescaped value in sb was not used. So this PR does not change the output of AbstractRawFirBuilder.toInterpolatingCall.

@cketti cketti requested a review from a team as a code owner June 14, 2025 17:27
@cketti cketti requested a review from KvanTTT June 14, 2025 17:27
@KvanTTT KvanTTT self-assigned this Jul 1, 2025
Copy link
Contributor

@KvanTTT KvanTTT left a comment

Choose a reason for hiding this comment

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

Thanks! I'm running internal checks and let you know after they are finished.

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