Skip to content

Remove the S-expression parsetree printer - #8803

Merged
cknitt merged 2 commits into
masterfrom
remove-sexp-printer
Oct 12, 2026
Merged

cknitt merged 2 commits into
masterfrom
remove-sexp-printer

Conversation

@cknitt

@cknitt cknitt commented Oct 11, 2026

Copy link
Copy Markdown
Member

First step of #8798.

res_parser -print sexp printed the parsetree as an S-expression. Its only user was the formatter roundtrip test in scripts/test_syntax.sh, which formatted each file twice and checked two things:

  • the two formatted texts are equal;
  • the ASTs parsed from them, printed as S-expressions, are equal.

The parser is deterministic, so the second check holds whenever the first does. It never caught anything the text check didn't. The roundtrip test now only checks the text, and the printer goes. That's about 1,100 lines that every new parsetree node no longer has to handle.

The printer also printed the character offsets of explicit braces (braces_loc, since #8678) and no other locations. That was unintended and isn't carried over anywhere.

res_parser's other -print modes (ast, comments, doc, ml, res, tokens) are unchanged. res_parser isn't shipped in the npm packages, so this doesn't affect users.

🤖 Generated with Claude Code

https://claude.ai/code/session_013ZYFYMu3AE9P1xFVCR34d1

cknitt and others added 2 commits October 11, 2026 19:30
The roundtrip test was its only user, and its AST comparison was
redundant with the check that formatting is idempotent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ZYFYMu3AE9P1xFVCR34d1
Signed-off-by: Christoph Knittel <ck@cca.io>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ZYFYMu3AE9P1xFVCR34d1
Signed-off-by: Christoph Knittel <ck@cca.io>
@cknitt
cknitt marked this pull request as ready for review October 11, 2026 19:50
@cknitt

cknitt commented Oct 11, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-11T19:52:12.451952Z 42eea77 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 42eea77a81

ℹ️ 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".

Comment thread CHANGELOG.md
@pkg-pr-new

pkg-pr-new Bot commented Oct 11, 2026

Copy link
Copy Markdown

Open in StackBlitz

rescript

npm i https://pkg.pr.new/rescript@8803

@rescript/belt

npm i https://pkg.pr.new/@rescript/belt@8803

@rescript/darwin-arm64

npm i https://pkg.pr.new/@rescript/darwin-arm64@8803

@rescript/darwin-x64

npm i https://pkg.pr.new/@rescript/darwin-x64@8803

@rescript/linux-arm64

npm i https://pkg.pr.new/@rescript/linux-arm64@8803

@rescript/linux-x64

npm i https://pkg.pr.new/@rescript/linux-x64@8803

@rescript/runtime

npm i https://pkg.pr.new/@rescript/runtime@8803

@rescript/win32-x64

npm i https://pkg.pr.new/@rescript/win32-x64@8803

commit: 42eea77

@cknitt
cknitt requested a review from cristianoc October 11, 2026 20:01
@github-actions

Copy link
Copy Markdown

@cknitt
cknitt merged commit 904027b into master Oct 12, 2026
24 checks passed
@cknitt
cknitt deleted the remove-sexp-printer branch October 12, 2026 04:29
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