Skip to content

Remove dead code from the vendored Flow parser - #9208

Open
cknitt wants to merge 4 commits into
remove-flow-ast-mapperfrom
prune-flow-parser
Open

cknitt wants to merge 4 commits into
remove-flow-ast-mapperfrom
prune-flow-parser

Conversation

@cknitt

@cknitt cknitt commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

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, so make dead-code no longer suppresses the whole Flow parser, only its AST (see below). reanalyze reports 0 issues with compiler/ml/parsetree0.ml and compiler/flow_parser/parser/flow_ast.ml suppressed.

About 3,700 lines are removed:

  • Unused functions, module-type items, 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 only parses strings, so a location's source is always None and File_key.t is now an empty type.
  • Parse_error variants that are never raised.
  • AST fields the parser fills in but nothing reads:
    • template literal quasi values (quasis are now just locations)
    • the records of tolerated syntax in record declarations and match cases (the parser still consumes those tokens, so the accepted input is unchanged)
    • JSX text payloads and fragment locations
    • Comment.on_newline
    • TSAccessibility comments

One 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, so make dead-code reported 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 %raw code. So that file is suppressed in scripts/dead_code.sh, like the frozen parsetree0.ml, and the rest of the Flow parser stays checked.

Two things stay and are marked [@live]:

  • Loc.equal, which the derived Token.equal uses (reanalyze can't see references from ppx-generated code).
  • The height field of the partial_node records that map and set nodes are cast to.

compiler/flow_parser/README.md now describes the directory as a pruned fork.

A second commit removes Ast_literal.type_bool's ?loc, which no caller passes. The .mli declared it through the core_type_lit abbreviation, which hid it from reanalyze until rescript-lang/reanalyze#224 learned to see through abbreviations. make dead-code reports 0 issues with that reanalyze version.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Kbf3gLDo8mBJKpNE25WAwT

@cknitt
cknitt added this pull request to stack #9209 November 3, 2026 19:56
@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Changelog

🏠 Internal

  • Remove dead code from the vendored Flow parser, which is no longer synced with upstream, and include it in make dead-code.

Semantic Diff

4 commits · Full page

Remove dead code from the vendored Flow parser

28d68d3 · 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 [@@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.

Remove the never-passed ?loc of Ast_literal.type_bool

96e0aa7 · 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 cleanup

194c023 · 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 code

de5a959 · 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.

@pkg-pr-new

pkg-pr-new Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

rescript

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

@rescript/belt

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

@rescript/darwin-arm64

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

@rescript/linux-arm64

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

@rescript/linux-x64

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

@rescript/runtime

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

@rescript/win32-x64

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

commit: de5a959

@cknitt
cknitt force-pushed the prune-flow-parser branch from da1f707 to 47e5c96 Compare November 4, 2026 06:14
@codecov

codecov Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.92%. Comparing base (defd652) to head (de5a959).

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     
Files with missing lines Coverage Δ
compiler/frontend/ast_literal.ml 100.00% <100.00%> (+7.14%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cknitt

cknitt commented Nov 7, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-07T06:07:58.705079Z e3da186 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

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: e3da186613

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

@cknitt
cknitt marked this pull request as ready for review November 7, 2026 06:17
@cknitt
cknitt requested a review from cristianoc November 7, 2026 06:17
@cknitt
cknitt force-pushed the prune-flow-parser branch from e3da186 to ccbb49c Compare November 7, 2026 18:49
@cknitt
cknitt force-pushed the prune-flow-parser branch from ccbb49c to 9611ba0 Compare November 8, 2026 08:23
@github-actions

github-actions Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

🎉 Compiler benchmarks

Allocated words

In total: 346,086,726 → 338,768,729 (-2.11%).

🎉 Improvement: 240 benchmarks allocate more than 1% less.

Benchmark Base Head Change
packages/@rescript/runtime/Primitive_list.resi 122,397 92,899 -24.10%
packages/@rescript/runtime/Primitive_float_extern.res 123,965 94,467 -23.80%
packages/@rescript/runtime/Stdlib_Blob.res 124,095 94,597 -23.77%
packages/@rescript/runtime/Stdlib_File.res 125,939 96,441 -23.42%
packages/@rescript/runtime/Primitive_promise.res 127,505 98,007 -23.13%
packages/@rescript/runtime/Primitive_int_extern.res 128,279 98,781 -23.00%
packages/@rescript/runtime/Primitive_string_extern.res 128,628 99,130 -22.93%
packages/@rescript/runtime/Stdlib_Iterable.resi 128,844 99,346 -22.89%
packages/@rescript/runtime/Stdlib_AsyncIterable.resi 128,991 99,493 -22.87%
packages/@rescript/runtime/Obj.res 129,551 100,053 -22.77%
240 more changes
Benchmark Base Head Change
packages/@rescript/runtime/Stdlib_Iterable.res 129,620 100,122 -22.76%
packages/@rescript/runtime/Stdlib_AsyncIterable.res 129,697 100,199 -22.74%
packages/@rescript/runtime/Primitive_exceptions.resi 130,862 101,364 -22.54%
packages/@rescript/runtime/Primitive_hash.resi 133,329 103,831 -22.12%
packages/@rescript/runtime/Primitive_dict.res 133,428 103,930 -22.11%
packages/@rescript/runtime/Primitive_module.resi 133,750 104,252 -22.05%
packages/@rescript/runtime/RescriptTools.res 134,772 105,274 -21.89%
packages/@rescript/runtime/Stdlib_TaggedTemplate.resi 137,177 107,679 -21.50%
packages/@rescript/runtime/Stdlib_ArrayBuffer.res 138,787 109,289 -21.25%
packages/@rescript/runtime/Stdlib_ArrayBuffer.resi 141,605 112,107 -20.83%
packages/@rescript/runtime/RescriptTools_ExtractCodeBlocks.res 142,676 113,178 -20.67%
packages/@rescript/runtime/Stdlib_Lazy.resi 143,179 113,681 -20.60%
packages/@rescript/runtime/Primitive_array_extern.res 145,222 115,724 -20.31%
packages/@rescript/runtime/Primitive_object_extern.res 145,494 115,996 -20.27%
packages/@rescript/runtime/Stdlib_TaggedTemplate.res 146,949 117,365 -20.13%
packages/@rescript/runtime/Stdlib_Intl_Segments.res 147,341 117,843 -20.02%
packages/@rescript/runtime/Stdlib_Bool.resi 147,450 117,952 -20.01%
packages/@rescript/runtime/Primitive_object.resi 148,032 118,534 -19.93%
packages/@rescript/runtime/Dom_storage2.res 150,710 121,212 -19.57%
packages/@rescript/runtime/Jsx.res 152,920 123,422 -19.29%
packages/@rescript/runtime/Primitive_option.resi 153,273 123,775 -19.25%
packages/@rescript/runtime/Stdlib_JsExn.resi 153,753 124,255 -19.19%
packages/@rescript/runtime/Stdlib_WeakSet.res 153,890 124,392 -19.17%
packages/@rescript/runtime/Stdlib_Type.resi 166,619 137,121 -17.70%
packages/@rescript/runtime/Stdlib_WeakMap.res 166,800 137,302 -17.68%
packages/@rescript/runtime/Stdlib_Temporal_Now.res 174,020 144,522 -16.95%
packages/@rescript/runtime/Stdlib_Global.res 175,762 146,264 -16.78%
packages/@rescript/runtime/Stdlib_Symbol.res 177,906 148,408 -16.58%
packages/@rescript/runtime/Stdlib_Bool.res 178,747 149,249 -16.50%
packages/@rescript/runtime/Primitive_bool.res 180,122 150,624 -16.38%
packages/@rescript/runtime/Primitive_float.res 180,352 150,854 -16.36%
packages/@rescript/belt/src/Belt_Int.resi 180,750 151,252 -16.32%
packages/@rescript/belt/src/Belt_Float.resi 182,227 152,729 -16.19%
packages/@rescript/runtime/Stdlib_IterableIterator.resi 182,359 152,861 -16.18%
packages/@rescript/runtime/Stdlib_Intl_Common.res 184,734 155,236 -15.97%
packages/@rescript/runtime/Stdlib_Ordering.res 184,876 155,378 -15.96%
packages/@rescript/runtime/Stdlib_Intl_Segmenter.res 185,799 156,301 -15.88%
packages/@rescript/runtime/Stdlib_Global.resi 187,144 157,646 -15.76%
packages/@rescript/runtime/Stdlib_Symbol.resi 191,221 161,723 -15.43%
packages/@rescript/runtime/Stdlib_Intl_NumberFormat_Grouping.res 191,347 161,849 -15.42%
packages/@rescript/runtime/Stdlib_Iterator.resi 192,251 162,753 -15.34%
packages/@rescript/runtime/Stdlib_AsyncIterableIterator.resi 193,128 163,630 -15.27%
packages/@rescript/runtime/Stdlib_Generator.resi 193,477 163,979 -15.25%
packages/@rescript/runtime/Primitive_string.res 194,356 164,858 -15.18%
packages/@rescript/belt/src/Belt_internalBucketsType.resi 197,484 167,986 -14.94%
packages/@rescript/belt/src/Belt_Float.res 197,975 168,477 -14.90%
packages/@rescript/belt/src/Belt_Int.res 198,410 168,912 -14.87%
packages/@rescript/runtime/Stdlib_Pair.res 199,351 169,853 -14.80%
packages/@rescript/runtime/Stdlib_RegExp.res 199,866 170,368 -14.76%
packages/@rescript/runtime/Stdlib_AsyncGenerator.resi 199,945 170,447 -14.75%
packages/@rescript/runtime/Dom_storage.res 200,843 171,345 -14.69%
packages/@rescript/belt/src/Belt_MutableStack.resi 201,518 172,020 -14.64%
packages/@rescript/belt/src/Belt_SortArrayString.resi 201,602 172,104 -14.63%
packages/@rescript/runtime/Stdlib_Intl_ListFormat.res 201,696 172,198 -14.62%
packages/@rescript/belt/src/Belt_SortArrayInt.resi 201,726 172,228 -14.62%
packages/@rescript/runtime/Stdlib_Intl.res 205,102 175,604 -14.38%
packages/@rescript/runtime/Primitive_int.res 207,054 177,556 -14.25%
packages/@rescript/belt/src/Belt_HashSetString.resi 207,434 177,936 -14.22%
packages/@rescript/belt/src/Belt_HashSetInt.resi 207,552 178,054 -14.21%
packages/@rescript/belt/src/Belt_Range.resi 208,289 178,791 -14.16%
packages/@rescript/runtime/Stdlib_JsExn.res 209,577 179,969 -14.13%
packages/@rescript/runtime/Stdlib_Intl_Collator.res 211,321 181,823 -13.96%
packages/@rescript/runtime/Stdlib_Intl_RelativeTimeFormat.res 212,564 183,066 -13.88%
packages/@rescript/runtime/Primitive_bigint.res 212,634 183,136 -13.87%
packages/@rescript/runtime/Stdlib_AsyncIterator.resi 213,028 183,530 -13.85%
packages/@rescript/runtime/Stdlib_JsError.resi 217,149 187,651 -13.58%
packages/@rescript/runtime/Stdlib_IterableIterator.res 217,904 188,340 -13.57%
packages/@rescript/runtime/Stdlib_BigInt.resi 218,371 188,873 -13.51%
packages/@rescript/belt/src/Belt.res 219,402 189,904 -13.44%
packages/@rescript/runtime/Stdlib_RegExp.resi 220,157 190,659 -13.40%
packages/@rescript/runtime/Stdlib_Float.resi 226,277 196,779 -13.04%
packages/@rescript/runtime/Stdlib_Intl_Locale.res 230,814 201,316 -12.78%
packages/@rescript/runtime/Primitive_array.res 232,025 202,527 -12.71%
packages/@rescript/belt/src/Belt_internalSetBuckets.resi 232,418 202,920 -12.69%
packages/@rescript/runtime/Stdlib_Nullable.resi 235,090 205,592 -12.55%
packages/@rescript/runtime/Stdlib_Intl_PluralRules.res 235,547 206,049 -12.52%
packages/@rescript/runtime/Stdlib_Type.res 235,866 206,368 -12.51%
packages/@rescript/runtime/Stdlib_Int.resi 238,193 208,695 -12.38%
packages/@rescript/runtime/Primitive_exceptions.res 238,761 209,263 -12.35%
packages/@rescript/runtime/Stdlib_Null.resi 239,566 210,068 -12.31%
packages/@rescript/belt/src/Belt_MutableQueue.resi 240,682 211,184 -12.26%
packages/@rescript/runtime/Stdlib_Generator.res 241,309 211,811 -12.22%
packages/@rescript/runtime/Stdlib_BigInt.res 243,733 214,235 -12.10%
packages/@rescript/runtime/Primitive_list.res 244,006 214,508 -12.09%
packages/@rescript/runtime/Stdlib_Map.res 244,494 214,996 -12.06%
packages/@rescript/belt/src/Belt_HashMapString.resi 247,612 218,114 -11.91%
packages/@rescript/belt/src/Belt_HashMapInt.resi 247,733 218,235 -11.91%
packages/@rescript/runtime/Stdlib_Set.res 249,875 220,377 -11.81%
packages/@rescript/runtime/Stdlib_Map.resi 252,458 222,960 -11.68%
packages/@rescript/runtime/Stdlib_Temporal.res 254,737 225,239 -11.58%
packages/@rescript/runtime/Stdlib_AsyncGenerator.res 255,623 226,125 -11.54%
packages/@rescript/runtime/Stdlib_Float.res 256,942 227,352 -11.52%
packages/@rescript/belt/src/Belt_HashSet.resi 258,131 228,633 -11.43%
packages/@rescript/runtime/Stdlib_Set.resi 263,454 233,956 -11.20%
packages/@rescript/runtime/Stdlib_Lazy.res 263,586 234,088 -11.19%
packages/@rescript/belt/src/Belt_internalBuckets.resi 265,718 236,220 -11.10%
packages/@rescript/runtime/Stdlib_JsError.res 270,025 240,527 -10.92%
packages/@rescript/runtime/Stdlib_JSON.resi 270,253 240,755 -10.91%
packages/@rescript/runtime/Stdlib_DataView.res 270,716 241,218 -10.90%
packages/@rescript/runtime/Stdlib_Option.resi 272,008 242,510 -10.84%
packages/@rescript/runtime/Stdlib_IteratorObject.resi 272,097 242,599 -10.84%
packages/@rescript/runtime/Stdlib_AsyncIterableIterator.res 272,943 243,379 -10.83%
packages/@rescript/runtime/Primitive_js_extern.res 273,217 243,719 -10.80%
packages/@rescript/runtime/Stdlib_Iterator.res 275,781 246,033 -10.79%
packages/@rescript/runtime/Pervasives.res 273,517 244,019 -10.78%
packages/@rescript/runtime/Stdlib_Dict.resi 275,829 246,311 -10.70%
packages/@rescript/belt/src/Belt_Option.resi 277,332 247,834 -10.64%
packages/@rescript/runtime/Stdlib_Object.res 277,484 247,971 -10.64%
packages/@rescript/belt/src/Belt_Result.resi 279,074 249,576 -10.57%
packages/@rescript/belt/src/Belt_SortArray.resi 287,668 258,170 -10.25%
packages/@rescript/belt/src/Belt_SetString.resi 293,427 263,929 -10.05%
packages/@rescript/belt/src/Belt_Id.resi 293,471 263,973 -10.05%
packages/@rescript/belt/src/Belt_SetInt.resi 293,561 264,063 -10.05%
packages/@rescript/runtime/Stdlib_IteratorObject.res 297,165 267,667 -9.93%
packages/@rescript/belt/src/Belt_MutableSetString.resi 298,691 269,193 -9.88%
packages/@rescript/belt/src/Belt_MutableSetInt.resi 298,813 269,315 -9.87%
packages/@rescript/runtime/Stdlib_DataView.resi 302,100 272,602 -9.76%
packages/@rescript/runtime/Stdlib_Temporal_PlainMonthDay.res 302,120 272,622 -9.76%
packages/@rescript/runtime/RescriptTools_Docgen.resi 312,384 282,886 -9.44%
packages/@rescript/runtime/RescriptTools_Docgen.res 322,763 293,265 -9.14%
packages/@rescript/belt/src/Belt_Id.res 328,758 299,260 -8.97%
packages/@rescript/belt/src/Belt_internalBucketsType.res 330,378 300,880 -8.93%
packages/@rescript/belt/src/Belt_Range.res 332,840 303,342 -8.86%
packages/@rescript/belt/src/Belt_HashMap.resi 334,732 305,234 -8.81%
packages/@rescript/runtime/Stdlib_Result.resi 336,313 306,815 -8.77%
packages/@rescript/runtime/Stdlib_JSON.res 337,578 308,080 -8.74%
packages/@rescript/runtime/Stdlib_Temporal_Instant.res 341,740 312,242 -8.63%
packages/@rescript/runtime/Stdlib_AsyncIterator.res 345,511 315,763 -8.61%
packages/@rescript/runtime/Primitive_option.res 346,827 317,329 -8.51%
packages/@rescript/belt/src/Belt_MutableMapString.resi 352,025 322,527 -8.38%
packages/@rescript/belt/src/Belt_MutableMapInt.resi 352,150 322,652 -8.38%
packages/@rescript/runtime/Stdlib_Temporal_PlainTime.res 354,180 324,682 -8.33%
packages/@rescript/runtime/Stdlib_Dict.res 365,165 335,109 -8.23%
packages/@rescript/runtime/Stdlib_Math.resi 364,272 334,774 -8.10%
packages/@rescript/runtime/Stdlib_Math.res 374,533 345,035 -7.88%
packages/@rescript/runtime/Stdlib_Int8Array.res 376,085 346,587 -7.84%
packages/@rescript/runtime/Stdlib_Uint8Array.res 376,100 346,602 -7.84%
packages/@rescript/runtime/Stdlib_Float32Array.res 376,198 346,700 -7.84%
packages/@rescript/runtime/Stdlib_Float64Array.res 376,198 346,700 -7.84%
packages/@rescript/runtime/Stdlib_Int16Array.res 376,232 346,734 -7.84%
packages/@rescript/runtime/Stdlib_Int32Array.res 376,232 346,734 -7.84%
packages/@rescript/runtime/Stdlib_Uint16Array.res 376,239 346,741 -7.84%
packages/@rescript/runtime/Stdlib_Uint32Array.res 376,239 346,741 -7.84%
packages/@rescript/runtime/Stdlib_BigInt64Array.res 376,259 346,761 -7.84%
packages/@rescript/runtime/Stdlib_BigUint64Array.res 376,332 346,834 -7.84%
packages/@rescript/runtime/Stdlib_Uint8ClampedArray.res 376,617 347,119 -7.83%
packages/@rescript/runtime/Stdlib_Nullable.res 381,593 352,095 -7.73%
packages/@rescript/runtime/Stdlib_Null.res 383,553 354,055 -7.69%
packages/@rescript/runtime/Primitive_module.res 387,991 358,493 -7.60%
packages/@rescript/belt/src/Belt_internalAVLset.resi 402,659 373,161 -7.33%
packages/@rescript/runtime/Stdlib_Promise.resi 407,465 377,967 -7.24%
packages/@rescript/runtime/Stdlib_Promise.res 407,841 378,343 -7.23%
packages/@rescript/runtime/Stdlib_Temporal_Common.res 408,080 378,582 -7.23%
packages/@rescript/runtime/Stdlib_Temporal_Duration.res 409,467 379,969 -7.20%
packages/@rescript/runtime/Stdlib_Console.res 417,283 387,785 -7.07%
packages/@rescript/runtime/Stdlib_Temporal_PlainYearMonth.res 418,475 388,977 -7.05%
packages/@rescript/runtime/Stdlib_Intl_DateTimeFormat.res 428,064 398,566 -6.89%
packages/@rescript/belt/src/Belt_MapString.resi 430,913 401,415 -6.85%
packages/@rescript/belt/src/Belt_MapInt.resi 430,961 401,463 -6.84%
packages/@rescript/belt/src/Belt_Option.res 438,487 408,989 -6.73%
packages/@rescript/runtime/Stdlib_Temporal_PlainDate.res 438,618 409,120 -6.73%
packages/@rescript/belt/src/Belt_MutableSet.resi 438,676 409,178 -6.72%
packages/@rescript/belt/src/Belt_MutableMap.resi 439,085 409,587 -6.72%
packages/@rescript/runtime/Stdlib_Intl_NumberFormat.res 444,447 414,949 -6.64%
packages/@rescript/belt/src/Belt_SetDict.resi 445,640 416,142 -6.62%
packages/@rescript/belt/src/Belt_MutableStack.res 445,919 416,421 -6.62%
packages/@rescript/runtime/Stdlib_List.resi 449,625 420,127 -6.56%
packages/@rescript/runtime/Stdlib_Console.resi 454,083 424,585 -6.50%
packages/@rescript/runtime/Stdlib_Temporal_PlainDateTime.res 473,203 443,705 -6.23%
packages/@rescript/belt/src/Belt_Result.res 473,429 443,933 -6.23%
packages/@rescript/belt/src/Belt_Set.resi 479,602 450,104 -6.15%
packages/@rescript/runtime/Stdlib_Int.res 505,727 476,227 -5.83%
packages/@rescript/belt/src/Belt_internalAVLtree.resi 511,690 482,192 -5.76%
packages/@rescript/runtime/Stdlib_String.resi 536,182 506,684 -5.50%
packages/@rescript/runtime/Stdlib_String.res 562,727 533,227 -5.24%
packages/@rescript/belt/src/Belt_MapDict.resi 564,741 535,243 -5.22%
packages/@rescript/runtime/Stdlib_Date.res 609,841 580,343 -4.84%
packages/@rescript/runtime/Stdlib_Temporal_ZonedDateTime.res 613,140 583,642 -4.81%
packages/@rescript/belt/src/Belt_Map.resi 629,213 599,715 -4.69%
packages/@rescript/runtime/Stdlib_Date.resi 656,140 626,642 -4.50%
packages/@rescript/belt/src/Belt_Array.resi 704,437 674,939 -4.19%
parse/RedBlackTreeNoComments.res 370,016 355,262 -3.99%
parse/RedBlackTree.res 377,730 362,976 -3.91%
packages/@rescript/runtime/Stdlib_Array.resi 778,451 748,953 -3.79%
packages/@rescript/belt/src/Belt_internalSetBuckets.res 791,857 762,359 -3.73%
packages/@rescript/belt/src/Belt_internalSetInt.res 820,130 790,634 -3.60%
packages/@rescript/belt/src/Belt_internalSetString.res 821,317 791,819 -3.59%
packages/@rescript/belt/src/Belt_List.resi 823,358 793,860 -3.58%
packages/@rescript/runtime/Stdlib_TypedArray.res 827,590 798,092 -3.56%
packages/@rescript/runtime/Stdlib_Option.res 841,583 812,085 -3.51%
packages/@rescript/belt/src/Belt_MutableQueue.res 880,779 851,277 -3.35%
packages/@rescript/belt/src/Belt_HashSetInt.res 964,697 935,203 -3.06%
packages/@rescript/belt/src/Belt_HashSetString.res 965,012 935,514 -3.06%
packages/@rescript/belt/src/Belt_Set.res 971,512 942,014 -3.04%
packages/@rescript/runtime/Stdlib.res 1,016,722 987,224 -2.90%
packages/@rescript/runtime/Primitive_hash.res 1,054,338 1,024,750 -2.81%
packages/@rescript/belt/src/Belt_Map.res 1,113,256 1,083,641 -2.66%
packages/@rescript/belt/src/Belt_internalBuckets.res 1,108,527 1,079,095 -2.66%
packages/@rescript/runtime/JsxEvent.res 1,146,223 1,116,164 -2.62%
packages/@rescript/belt/src/Belt_HashSet.res 1,125,729 1,096,235 -2.62%
format/RedBlackTreeNoComments.res 590,678 575,929 -2.50%
packages/@rescript/belt/src/Belt_HashMapInt.res 1,223,511 1,194,013 -2.41%
packages/@rescript/belt/src/Belt_HashMapString.res 1,224,217 1,194,719 -2.41%
packages/@rescript/runtime/Dom.res 1,248,756 1,219,256 -2.36%
packages/@rescript/runtime/Primitive_object.res 1,272,912 1,243,266 -2.33%
format/RedBlackTree.res 643,987 629,238 -2.29%
packages/@rescript/belt/src/Belt_MutableMapInt.res 1,325,776 1,296,231 -2.23%
packages/@rescript/belt/src/Belt_MutableMapString.res 1,326,050 1,296,550 -2.22%
packages/@rescript/belt/src/Belt_MapInt.res 1,368,653 1,339,147 -2.16%
packages/@rescript/belt/src/Belt_MapString.res 1,369,188 1,339,690 -2.15%
packages/@rescript/belt/src/Belt_HashMap.res 1,400,227 1,370,729 -2.11%
packages/@rescript/runtime/Stdlib_Array.res 1,416,917 1,387,413 -2.08%
packages/@rescript/belt/src/Belt_SetInt.res 1,447,170 1,417,672 -2.04%
packages/@rescript/belt/src/Belt_SetString.res 1,447,894 1,418,396 -2.04%
packages/@rescript/runtime/Stdlib_Result.res 1,455,711 1,426,213 -2.03%
packages/@rescript/belt/src/Belt_SortArrayInt.res 1,481,495 1,451,993 -1.99%
packages/@rescript/belt/src/Belt_SortArrayString.res 1,483,285 1,453,781 -1.99%
packages/@rescript/belt/src/Belt_MutableMap.res 1,494,019 1,464,523 -1.97%
packages/@rescript/belt/src/Belt_SortArray.res 1,597,370 1,567,872 -1.85%
packages/@rescript/belt/src/Belt_internalMapInt.res 1,642,998 1,613,500 -1.80%
packages/@rescript/belt/src/Belt_internalMapString.res 1,644,835 1,615,341 -1.79%
packages/@rescript/belt/src/Belt_SetDict.res 1,673,587 1,644,089 -1.76%
packages/@rescript/belt/src/Belt_MutableSetInt.res 1,865,096 1,835,596 -1.58%
packages/@rescript/belt/src/Belt_MutableSetString.res 1,866,289 1,836,834 -1.58%
packages/@rescript/belt/src/Belt_MapDict.res 1,911,339 1,881,855 -1.54%
packages/@rescript/runtime/JsxDOMStyle.res 2,067,249 2,037,751 -1.43%
packages/@rescript/belt/src/Belt_MutableSet.res 2,161,529 2,132,033 -1.36%
packages/@rescript/belt/src/Belt_Array.res 2,394,453 2,364,907 -1.23%
packages/@rescript/runtime/JsxDOM.res 2,863,057 2,833,559 -1.03%
packages/@rescript/runtime/Stdlib_List.res 2,947,937 2,918,447 -1.00%
packages/@rescript/belt/src/Belt_internalAVLset.res 3,209,545 3,179,986 -0.92%
packages/@rescript/belt/src/Belt_List.res 3,501,252 3,471,754 -0.84%
parse/HeroGraphic.res 1,868,915 1,854,155 -0.79%
packages/@rescript/belt/src/Belt_internalAVLtree.res 3,977,876 3,948,378 -0.74%
format/HeroGraphic.res 3,076,275 3,061,526 -0.48%
stress/ListLiteral.res 3,560,324 3,545,575 -0.41%
stress/InlineChain.res 3,751,086 3,736,337 -0.39%
parse/Napkinscript.res 10,730,798 10,716,049 -0.14%
stress/NestedClosures.res 11,561,945 11,547,196 -0.13%
stress/PolyVariantSwitch.res 14,340,192 14,325,443 -0.10%

Instructions

In total: 9,755,245,135 → 9,675,830,515 (-0.81%).

🎉 Improvement: 22 benchmarks execute more than 1% fewer instructions.

Benchmark Base Head Change
packages/@rescript/runtime/Stdlib_Math.resi 24,577,588 21,381,681 -13.00%
packages/@rescript/runtime/Stdlib_Temporal_PlainDate.res 27,393,734 24,193,354 -11.68%
packages/@rescript/runtime/Stdlib_List.resi 28,059,384 24,861,153 -11.40%
packages/@rescript/runtime/Stdlib_Temporal_PlainDateTime.res 28,840,171 25,635,385 -11.11%
parse/RedBlackTreeNoComments.res 16,174,123 14,577,532 -9.87%
packages/@rescript/runtime/Stdlib_String.resi 32,785,466 29,603,914 -9.70%
parse/RedBlackTree.res 16,581,522 14,981,831 -9.65%
packages/@rescript/runtime/Stdlib_Temporal_ZonedDateTime.res 34,571,408 31,393,076 -9.19%
packages/@rescript/runtime/Stdlib_Date.resi 37,625,191 34,423,721 -8.51%
packages/@rescript/belt/src/Belt_Array.resi 38,049,844 34,858,938 -8.39%
23 more changes
Benchmark Base Head Change
packages/@rescript/belt/src/Belt_List.resi 43,016,968 39,833,075 -7.40%
packages/@rescript/runtime/Stdlib_Array.resi 43,608,150 40,435,240 -7.28%
packages/@rescript/runtime/Stdlib_TypedArray.res 44,674,979 41,478,169 -7.16%
format/RedBlackTreeNoComments.res 25,705,200 24,107,226 -6.22%
format/RedBlackTree.res 26,049,577 24,451,603 -6.13%
packages/@rescript/runtime/JsxDOMStyle.res 100,936,879 97,375,265 -3.53%
packages/@rescript/runtime/JsxDOM.res 123,849,187 120,293,778 -2.87%
packages/@rescript/belt/src/Belt_List.res 125,995,470 122,764,736 -2.56%
parse/HeroGraphic.res 72,045,682 70,451,663 -2.21%
packages/@rescript/belt/src/Belt_internalAVLtree.res 146,491,687 143,296,967 -2.18%
stress/InlineChain.res 141,838,162 139,874,270 -1.38%
stress/ListLiteral.res 136,460,528 134,848,956 -1.18%
format/HeroGraphic.res 213,169,175 211,571,201 -0.75%
parse/Napkinscript.res 335,369,362 333,772,645 -0.48%
stress/RefsInLoop.res 401,545,986 399,990,006 -0.39%
stress/PolyVariantSwitch.res 636,430,257 634,474,518 -0.31%
stress/TypeAliasChain.res 526,987,389 525,391,563 -0.30%
stress/NestedClosures.res 548,774,984 547,145,585 -0.30%
format/Napkinscript.res 604,862,716 603,264,742 -0.26%
stress/Record.res 1,075,812,799 1,073,756,896 -0.19%
stress/ObjectFields.res 951,427,704 949,819,551 -0.17%
stress/LetRec.res 1,418,885,410 1,416,825,985 -0.15%
stress/IntSwitch.res 1,726,648,453 1,724,696,290 -0.11%

Pull request de5a959 compared with base 9532571 in this run.

cknitt and others added 3 commits November 8, 2026 18:03
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>
@cknitt
cknitt force-pushed the prune-flow-parser branch from 9611ba0 to c86b01d Compare November 8, 2026 18:10
@cknitt
cknitt removed this pull request from stack #9209 November 8, 2026 18:11
@cknitt
cknitt changed the base branch from remove-dead-code-reanalyze to remove-flow-ast-mapper November 8, 2026 18:11
@cknitt
cknitt added this pull request to stack #9268 November 8, 2026 18:11
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>
@cknitt
cknitt force-pushed the prune-flow-parser branch from c86b01d to de5a959 Compare November 8, 2026 18:11

This branch has not been deployed

No deployments
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.

1 participant