Repository navigation
Remove Pconst_json and represent fixed external arguments in the parsetree - #8875
Conversation
910b6bf to
19a5a20
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #8875 +/- ##
==========================================
- Coverage 81.02% 81.01% -0.01%
==========================================
Files 453 454 +1
Lines 63030 63187 +157
==========================================
+ Hits 51070 51193 +123
- Misses 11960 11994 +34
🚀 New features to boost your workflow:
|
rescript
@rescript/belt
@rescript/darwin-arm64
@rescript/darwin-x64
@rescript/linux-arm64
@rescript/linux-x64
@rescript/runtime
@rescript/win32-x64
commit: |
|
Developer playground preview: https://rescript-lang.github.io/rescript/dev-playground/?version=pr-8875 |
`@as(value) _` arguments of externals become `Parg_fixed`, holding the value as written. `Pconst_json` is gone: `json` templates are ordinary tagged templates except as fixed values, whose v0 encoding is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NP47qMfjMbjUTKZDsLthDo Signed-off-by: Christoph Knittel <ck@cca.io>
19a5a20 to
b5d7c86
Compare
Pconst_json and represent fixed external arguments in the parsetree
|
@codex review |
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b5d7c862f4
ℹ️ 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".
Relocating mappers now reach every location of a fixed argument, including the ones `Ast_mapper_to0` synthesizes for the v0 spelling. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NP47qMfjMbjUTKZDsLthDo Signed-off-by: Christoph Knittel <ck@cca.io>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 99b7a84575
ℹ️ 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".
`@as(@foo 1) _` stays an attribute, so `@foo` is not dropped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NP47qMfjMbjUTKZDsLthDo Signed-off-by: Christoph Knittel <ck@cca.io>
|
@codex review |
|
Codex Review: Didn't find any major issues. What shall we delve into next? 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". |
First part of splitting #8609, so that the syntax for fixed external arguments can be discussed separately.
Summary
This PR removes
Pconst_jsonfrom the parsetree and gives fixed external arguments (@as(value) _) a dedicated parsetree node instead of an attribute on_.Removing
Pconst_jsonjsontemplates no longer have their own constant:json...`` is an ordinary tagged template. It used to be rejected everywhere except in@as, and is now accepted like any other tagged template.@as(json`...`) _, it keeps working as before and becomesPfixed_jsonbelow.json-delimited string).jsonrejection code is gone:Ast_payload.reject_json_literal*, the post-PPXunconsumed_json_iterator, the parser'sjsontemplate special case, andTypecore.Json_literal_outside_external.Fixed external arguments
Parg_fixedfor the top-level arguments of externals, keeping the value and its locations as written. The formatter prints it back as@as(value) _._ [@as value]), andAst_mapper_from0reads an external's@as(value) _arguments the same way the parser does.@asreader, so the generated code and the error messages stay the same._with other attributes besides@as, a braced payload such as@as({1}), a second@as, and invalid payloads.The
.cmi,.cmtand AST magic numbers are bumped, since removingPconst_jsonchanges the marshalled constant layout.Tests
jsonfixtures now check thatjsontemplates are ordinary tagged templates (tagged_template_test.res, the parser and super-errors snapshots).printer/typexpr/fixedExternal.resandast-mapping/FixedExternal.rescover the fixed-argument forms, comments and attributes.ounit_ast_mapper0_tests: a fixed argument reaches v0 as_ [@as 1]and comes back with its value and locations, and only externals get fixed arguments.Compared with master's compiler, apart from
jsontemplates outside fixed arguments, formatter output and the v0 tree a PPX receives are identical for every.res/.resifile in the repository. Compiled output and errors are identical for a few hundred fixed-argument forms in plain,@obj,@sendand@variadicexternals, both directly and through a PPX.🤖 Generated with Claude Code
https://claude.ai/code/session_01NP47qMfjMbjUTKZDsLthDo