Remove ReScript support from the analyzer - #213
Merged
Conversation
This repository is exclusively an OCaml analyzer (#209): CI dropped the ReScript matrix and npm packaging in 1f91b56, upstream removed the .res/.bs.js/bsconfig.json fixtures from examples/, and #210 removed ReScript from the docs. The code had not followed. The pathless flags were already broken for OCaml users. Without a -cmt root, processCmtFiles walked up for bsconfig.json and then read lib/bs/.sourcedirs.json, a BuckleScript build layout, so in a dune project `reanalyze.exe -dce` died with: Error: cannot find project root containing bsconfig.json. Fatal error: exception File "src/Paths.ml", line 23: Assertion failed So this removes a path that could only crash in the supported use. CLI: -all, -dce, -exception, -termination and -config are gone; the -*-cmt forms taking a root path are now the only ones, -noalloc becomes -noalloc-cmt, and running with no analysis selected prints an error instead of silently defaulting to the bsconfig reader. Deleted: src/ext (the vendored ReScript JSON parser, 703 lines) and 285 of the 303 lines of src/vendor/Json.ml. Both were reachable only from Paths.ml's bsconfig reader. Json.escape stays: Log_.ml needs it for -json output. Paths.ml drops from 182 lines to 20; RunConfig loses projectRoot and bsbProjectRoot, which collapses Suppress.checkPrefix. ExnLib: drops the Belt models (~30 table entries), Js.Json, and the bs-json decoders, leaving the standard library and Yojson.Basic. Exn loses decodeError and jsExnError. Reports now suggest OCaml syntax: `[@raises A]` rather than `@raises(A)`, and multiple exceptions print as a tuple `(A, B)` rather than the ReScript array `[A, B]`, matching what the analyzer actually parses. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015Ekre61YPcAuxSimHURmwq
fhammerschmidt
approved these changes
Sep 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Draft — not for merging yet. Branched off
masteras requested, so it does not depend on #210/#211.Removes ReScript from the analyzer itself. #210 covers the docs half of #209; this is the code half.
The pathless flags were already broken for OCaml users
Without a
-*-cmtroot,processCmtFilestook itsNonebranch →Paths.setReScriptProjectRootwalked up looking forbsconfig.json→ then readlib/bs/.sourcedirs.json, a BuckleScript build layout. In a dune project:Reanalyze.ml:223(if !analysisKindSet = false then setConfig ()) made that the default when no flag was passed, and-noallochad no-cmtvariant at all, so it hit the same crash. This removes a path that could only fail in the supported use, not working functionality.CLI change (the one reviewable decision)
-all,-dce,-exception,-terminationand-configare gone. The-*-cmtforms taking a root path are now the only ones,-noallocbecomes-noalloc-cmt, and running with no analysis selected errors instead of silently falling into the bsconfig reader:The alternative was renaming so
-dceitself takes the root, keeping-dce-cmtas a deprecated alias. I went with the smaller change because the README,npm testand every example already invoke the-cmtforms — but say the word and I'll switch.What was deleted (−1,325 / +56)
src/ext/(vendored ReScript JSON parser)src/vendor/Json.mlsrc/Paths.mlsrc/ExnLib.mlBoth vendored JSON parsers were reachable only from
Paths.ml's bsconfig reader.Json.escapestays —Log_.mlneeds it for-jsonoutput, which is the one non-ReScript consumer of that module.RunConfiglosesprojectRootandbsbProjectRoot, which collapsesSuppress.checkPrefix(itsprojectRoot = ""branch was already the only one the cmt path took).ExnLibdrops the Belt models (~30 table entries covering bothBelt.XandBelt_Xspellings),Js.Json, and thebs-jsondecoders, leaving the standard library andYojson.Basic— which is what EXCEPTION.md documents after #210.ExnlosesdecodeErrorandjsExnError;assertFailurestays, sinceAssert_failureis a real OCaml exception.Reports now suggest OCaml syntax
@raises(A)→[@raises A], and multiple exceptions print as a tuple rather than a ReScript array:Both forms were checked against the analyzer's own parser, so the suggestion is now copy-pasteable. This also fixes the
-jsonemitAnnotatepayload that editors insert. Updatesexamples/deadcode/src/exception.txt.Verification
dune buildclean,npm testgreen (deadcode, termination, and regression examples). Manually exercised the new error path,-exception-cmton a scratch project for both the single and tuple suggestion, and confirmed the DCE writer was already emitting correct OCaml ([@@dead "..."]).Not included
create-release.shandDockerfilestill tarreanalyze.nativeout ofsrc/lib/bs/native, a BuckleScript-era path that cannot exist in this tree;dist/ships a stale prebuilt binary andscripts/download_dist.jsserves an npm package CI no longer builds. That is release machinery rather than analysis, so it belongs in its own PR.#197 should be closed — it adds
rescript.jsonsupport to thePaths.mlcode this PR deletes.🤖 Generated with Claude Code
https://claude.ai/code/session_015Ekre61YPcAuxSimHURmwq