Normalize string literal representation across the compiler - #8606
Normalize string literal representation across the compiler#8606cknitt wants to merge 4 commits into
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
a6f1445 to
c292e07
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a6f1445259
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## codex/string-literal-regression-coverage #8606 +/- ##
============================================================================
+ Coverage 76.48% 76.67% +0.18%
============================================================================
Files 478 478
Lines 63172 63864 +692
============================================================================
+ Hits 48317 48965 +648
- Misses 14855 14899 +44
🚀 New features to boost your workflow:
|
Signed-off-by: Christoph Knittel <ck@cca.io>
|
Heads-up on a likely conflict with #8608 (merging the Lam IR into Lambda), and a suggestion on ordering. Overlap: 26 compiler files. The part that matters is that this PR modifies seven files that #8608 deletes:
About +57 / −31 in total. As far as I can tell those edits are all the same thing: propagating the changed Suggestion: land #8608 first. The reason is that this duplication is exactly what it removes. After it, The reverse order looks worse: #8608 would have to carry this PR's in-flight string representation into files it is simultaneously deleting. Same work, harder direction. It would also cost that PR its main verification property — it claims generated JavaScript is unchanged, checked against runtime, Belt and the 620 modules in One more thing worth knowing: No urgency from my side — mostly flagging it early so the order is a decision rather than a surprise at rebase time. |
c292e07 to
513d122
Compare
|
@codex review |
rescript
@rescript/belt
@rescript/darwin-arm64
@rescript/darwin-x64
@rescript/linux-arm64
@rescript/linux-x64
@rescript/runtime
@rescript/win32-x64
commit: |
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Signed-off-by: Christoph Knittel <ck@cca.io>
Signed-off-by: Christoph Knittel <ck@cca.io>
This is the second PR in the two-PR String Theory stack, built on #8605. It replaces the compiler’s historical delimiter protocol with explicit representations for semantic strings, templates, JSON literals, and raw JavaScript.
Consistent representations
Each layer now distinguishes runtime string values from source text that must be preserved:
This structure continues through the typed tree, Lambda, and JavaScript IR. The frozen AST v0 bridge converts to and from its legacy encoding at that single compatibility boundary.
A shared
String_literalmodule now owns escape decoding, canonical encoding, UTF-16 operations, surrogate handling, and template line-ending semantics.This removes:
DNone,DStarJ,DBackQuotes, andDNoQuotesdelimiter protocol"js","*j", and"bq"marker strings++trees and attributes for interpolated templatesAst_utf8_stringandAst_utf8_string_interpimplementationsOutput behavior
Template literals now remain explicit throughout compilation and carry over into the generated JavaScript:
++applications.Behavior fixes
The normalized representation also resolves several correctness issues:
"a"and"\x61"now compare by runtime value, preserve source order, and produce the expected redundant-pattern warning.jsoninterpolation and unsupported uses of JSON literals are rejected.@asvalues and Unicode line separators in generated paths.Testing
Coverage spans parsing and printing, the AST v0 bridge, type checking, Lambda and JavaScript IR, constant folding, generated JavaScript, GenType, analysis, and end-to-end behavior.
Verified with:
make testmake test-syntaxmake test-syntax-roundtripmake test-gentypemake test-analysisCloses #8602.