Repository navigation
Conversation
Changelog🏠 Internal
Semantic Diff4 commits · Full page Remove dead code from the vendored Flow parser28d68d3 · cknitt + Claude · Nov 03, 2026, 19:56 UTC Flow's parser moved to Rust, so the vendored OCaml copy (0.320.0) will never be synced again; it is now pruned like the rest of the repository and make dead-code no longer suppresses compiler/flow_parser. Removed, about 3,700 lines: - Unused functions, module-type items and collection helpers, and the [ Kept and marked live: Loc.equal, used by the derived Token.equal (ppx references are invisible to reanalyze), and the height field of the partial_node records cast from map and set nodes. Remove the never-passed ?loc of Ast_literal.type_bool96e0aa7 · cknitt + Claude · Nov 04, 2026, 05:54 UTC The interface declared type_bool with the core_type_lit abbreviation, which hid its optional ?loc from reanalyze; with the abbreviation fix in reanalyze (rescript-lang/reanalyze#224) it is reported: the only caller, bs_builtin_ppx, passes no location. Before: val type_bool : core_type_lit (?loc:Location.t -> unit -> _) After: val type_bool : unit -> Parsetree.core_type Add a changelog fragment for the Flow parser cleanup194c023 · cknitt + Claude · Nov 04, 2026, 06:33 UTC The changelog check requires a fragment; this one records the internal change. Do not check the Flow parser's AST for dead codede5a959 · cknitt + Claude · Nov 08, 2026, 18:08 UTC Without the AST mapper, which read every field to rebuild nodes, most fields of flow_ast.ml are only written: make dead-code reported 435 record labels and 54 modules of them, and nothing else in the Flow parser. The parser fills in the whole AST and the compiler reads only what it needs to classify %raw code, so that file is suppressed like the frozen parsetree0.ml; the rest of the Flow parser stays checked. |
rescript
@rescript/belt
@rescript/darwin-arm64
@rescript/linux-arm64
@rescript/linux-x64
@rescript/runtime
@rescript/win32-x64
commit: |
da1f707 to
47e5c96
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## remove-flow-ast-mapper #9208 +/- ##
=======================================================
Coverage 81.92% 81.92%
=======================================================
Files 456 456
Lines 65471 65469 -2
=======================================================
- Hits 53636 53635 -1
+ Misses 11835 11834 -1
🚀 New features to boost your workflow:
|
bd40d1c to
1906826
Compare
1906826 to
e3da186
Compare
|
@codex review |
Codex Review Summary: ✅ CompletedThis 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. |
|
Codex Review: Didn't find any major issues. Keep it up! 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". |
e3da186 to
ccbb49c
Compare
ccbb49c to
9611ba0
Compare
🎉 Compiler benchmarksAllocated wordsIn total: 346,086,726 → 338,768,729 (-2.11%). 🎉 Improvement: 240 benchmarks allocate more than 1% less.
240 more changes
InstructionsIn total: 9,755,245,135 → 9,675,830,515 (-0.81%). 🎉 Improvement: 22 benchmarks execute more than 1% fewer instructions.
23 more changes
Pull request de5a959 compared with base 9532571 in this run. |
Flow's parser moved to Rust, so the vendored OCaml copy (0.320.0) will never be synced again; it is now pruned like the rest of the repository and make dead-code no longer suppresses compiler/flow_parser. Removed, about 3,700 lines: - Unused functions, module-type items and collection helpers, and the [@@deriving show] debug printers. - Parser entry options ReScript never passes: parse options, the token sink and its rollback buffer. - File_key's variants: ReScript parses only strings, so the source of a location is always None and File_key.t is now empty. - Parse_error variants that are never raised. - AST fields the parser fills in but nothing reads: template literal quasi values (quasis are now locations), the records of tolerated syntax in record declarations and match cases (the tokens are still consumed), JSX text payloads and fragment locations, Comment.on_newline, and TSAccessibility comments. Kept and marked live: Loc.equal, used by the derived Token.equal (ppx references are invisible to reanalyze), and the height field of the partial_node records cast from map and set nodes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Kbf3gLDo8mBJKpNE25WAwT Signed-off-by: Christoph Knittel <ck@cca.io>
The interface declared type_bool with the core_type_lit abbreviation, which hid its optional ?loc from reanalyze; with the abbreviation fix in reanalyze (rescript-lang/reanalyze#224) it is reported: the only caller, bs_builtin_ppx, passes no location. Before: val type_bool : core_type_lit (?loc:Location.t -> unit -> _) After: val type_bool : unit -> Parsetree.core_type Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Kbf3gLDo8mBJKpNE25WAwT Signed-off-by: Christoph Knittel <ck@cca.io>
The changelog check requires a fragment; this one records the internal change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Kbf3gLDo8mBJKpNE25WAwT Signed-off-by: Christoph Knittel <ck@cca.io>
9611ba0 to
c86b01d
Compare
Without the AST mapper, which read every field to rebuild nodes, most fields of flow_ast.ml are only written: make dead-code reported 435 record labels and 54 modules of them, and nothing else in the Flow parser. The parser fills in the whole AST and the compiler reads only what it needs to classify %raw code, so that file is suppressed like the frozen parsetree0.ml; the rest of the Flow parser stays checked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Kbf3gLDo8mBJKpNE25WAwT Signed-off-by: Christoph Knittel <ck@cca.io>
c86b01d to
de5a959
Compare
Stacked on #9267, which removes the Flow parser's comment-moving AST mapper classes.
Flow's parser moved to Rust, so the vendored OCaml copy in
compiler/flow_parser(Flow 0.320.0) will never be synced with upstream again. This PR prunes it like the rest of the repository, somake dead-codeno longer suppresses the whole Flow parser, only its AST (see below). reanalyze reports 0 issues withcompiler/ml/parsetree0.mlandcompiler/flow_parser/parser/flow_ast.mlsuppressed.About 3,500 lines are removed:
[@@deriving show]debug printers.flow_ast.ml's types also cost startup work. That file declares its AST as recursive modules that are their own implementation (module rec Syntax : sig … end = Syntax), so OCaml built a placeholder for each of the over 450 derived functions at every compiler start, although they could never be called.Flow_map/Flow_setfunctors, that's what this PR's benchmark shows: −2.1% allocated words and −0.8% instructions, a fixed amount per compiler process.File_key's variants. ReScript only parses strings, so a location's source is alwaysNoneandFile_key.tis now an empty type.Parse_errorvariants that are never raised.Comment.on_newlineTSAccessibilitycommentsOne file is not checked:
compiler/flow_parser/parser/flow_ast.ml. Without the mapper (#9267), which read every field to rebuild nodes, most AST fields are only written, somake dead-codereported 435 record labels and 54 modules there, and nothing else in the Flow parser. The parser fills in the whole AST and the compiler reads only what it needs to classify%rawcode. So that file is suppressed inscripts/dead_code.sh, like the frozenparsetree0.ml, and the rest of the Flow parser stays checked.Two things stay and are marked
[@live]:Loc.equal, which the derivedToken.equaluses (reanalyze can't see references from ppx-generated code).partial_noderecords that map and set nodes are cast to.compiler/flow_parser/README.mdnow describes the directory as a pruned fork.A second commit removes
Ast_literal.type_bool's?loc, which no caller passes. The.mlideclared it through thecore_type_litabbreviation, which hid it from reanalyze before 2.27.0 (rescript-lang/reanalyze#224 taught it to see through abbreviations).🤖 Generated with Claude Code
https://claude.ai/code/session_01Kbf3gLDo8mBJKpNE25WAwT