Repository navigation
Support ReScript 12 and 13 in dependency and value usage analysis - #10
Merged
Merged
Conversation
- Decode typed trees with the layout of the compiler that wrote each .cmt file (ReScript 11 vs 12, told apart by the cmt_infos size), fixing the segfault in -vb on ReScript 12 builds - Resolve the .ast file of namespaced modules (app-Ns.cmt -> app.ast) so imports are filtered again, drop the generated namespace module from the graph, and normalize namespaced value paths for -vb - Read .ast headers by their byte length instead of as a module count - Read the ReScript 12 dependencies/dev-dependencies fields of rescript.json - Filter ReScript 12 runtime modules (Stdlib_*, Primitive_*) - Align the vendored ReScript 11 typedtree with the compiler layout - Add ReScript 12 fixture projects (standard and namespaced) with graph and value usage regression tests
- Identify the compiler of each .cmt file from its magic number and cmt_infos layout (lib/compilers.ml), and decode typed trees with one backend per release (Compiler_v11, Compiler_v12) - Keep typed trees opaque in the vendored Cmt_format and accept every CMT format version when reading; rename the ReScript 11 typedtree to Typedtree_v11 - Support ReScript 13 (13.0.0-alpha.6) for the dependency graph; value usage analysis reports -6 for compilers it cannot decode yet - Stop with an error on .cmt files from unknown compilers instead of silently producing an empty graph - Skip constructors added by later releases in the decoders instead of matching on unknown tags - Add ReScript 13 fixture projects, self-contained compiler identification tests, and build fixture workspace packages one at a time so they do not corrupt their shared compiled dependencies - Document the supported ReScript versions and how to add a release
- Pick the typed tree decoder from the compiler version in lib/bs/compiler-info.json where several releases write the same CMT format: ReScript 12 and 13.0.0-alpha.1 to alpha.5 all write Caml1999T022 with 14 fields, but alpha.4 inserted constructors in the middle of expression_desc and crashed -vb on for...of loops - Read 13.0.0-alpha.1 to alpha.3 and alpha.5 with the ReScript 12 decoder, extended with the constructors alpha.5 appends (for...of, break, continue), and report -6 for alpha.4 and versions not checked yet - Add a decoder for the 13.0.0-alpha.6 typed tree (Typedtree_v13, Compiler_v13) - Add a module using ReScript 13 syntax to the ReScript 13 fixtures and test value usage there, plus version identification tests
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.
Resolves #6
Summary
-vb) on ReScript 12 builds..cmttyped trees are read with the layout of the compiler that wrote them, through one backend per release (Compiler_v11,Compiler_v12,Compiler_v13) selected inlib/compilers.mlby the CMT magic number, thecmt_infoslayout and, where several releases write the same CMT format, the compiler version inlib/bs/compiler-info.json"namespace": true:app-Ns.cmtis now matched withapp.ast, so imports are filtered again. Unused imports and ReScript 12 runtime modules (Stdlib_*,Primitive_*) no longer show up as dependencies, the generated namespace module is no longer a node, and-vbworks in namespaced projects.astheaders by their byte length instead of treating it as a module countdependencies/dev-dependenciesfields ofrescript.jsonwhen resolving external modules-6from-vb.cmtfiles from unknown compilers instead of silently producing an empty graph, and skip constructors added by later releases instead of misreading themSupported ReScript versions
-vb)-6)Other versions of a supported CMT format (for example a later 13.0 prerelease) get the dependency graph, and
-6from-vbuntil their typed tree has been checked.Tests
test/rescript12,test/rescript13), each with a standard and a namespaced project built from the same sources astest/rescripttest_value_usage(same-vbcounts on ReScript 11, 12 and 13, plus a ReScript 13 module usingfor...of,continue, template literals and object literals) andtest_compilers(compiler identification by format and version, decoder guards; runs underdune runtest)@rescript/react