Skip to content

Conversation

@rahulmansharamani14
Copy link

This draft PR starts addressing Issue #4148 (Concatenated template literals are not merged in ADVANCED mode).

What’s in this draft:

  • Adds a minimal failing unit test in PeepholeFoldConstantsTest that asserts two untagged template literals joined by + should be merged into a single template literal.

Next steps (planned):

  • Update PeepholeFoldConstants to fix existing failing tests
  • Add more tests to cover more scenarios, including:
    - string + template literal (with any order)
    - string + string (already working)
    - template literal + template literal (template literal can include referenced variable or valid HTML)

Opening early for review to validate direction before proceeding.

@rahul-kamat
Copy link
Contributor

Hey Rahul! I think your approach sounds great, thanks for finding this issue, looking forward to seeing your planned out next steps!

@lauraharker lauraharker self-assigned this Sep 3, 2025
@spkapust spkapust marked this pull request as ready for review October 27, 2025 16:29
@spkapust spkapust marked this pull request as draft October 27, 2025 16:31
@lauraharker lauraharker assigned spkapust and unassigned lauraharker Nov 10, 2025
copybara-service bot pushed a commit that referenced this pull request Nov 18, 2025
…s are not merged in ADVANCED mode"

Upon further investigation it appears that template literals (specifically those that can't be optimized to strings) are not add folded when transpiling to ES6 or above

What’s in this CL:
- ONLY addressing case of template literal + template literal (added TODO for other cases) in PeepholeFoldConstants.
- added associated unit tests

PiperOrigin-RevId: 833853572
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.

4 participants