Skip to content

Repairs from semantic drift analysis #8712

Description

@cristianoc

This is the list of repairs coming from semantic drift analysis.

Repairs

Possible additional work

Design changes identified along the way, not part of the repairs above:

  • One .cmt source-file lookup. genType (compiler/gentype/find_source_file.ml) and reanalyze (analysis/reanalyze/src/find_source_file.ml) each walk a .cmt to find a source file. genType returns an absolute path and reanalyze a relative one with debug logging; sharing the walkers needs a library both link, and today that is only compiler/ml.
  • Generate Belt's key-specialised modules. The Int and String variants of Belt's maps and sets are hand-written copies that differ in 2–4 lines each; generating them from one template would add a build step to the runtime.
  • Merge analysis's Log and Debug switches. They are separate verbose switches (db+/dv+) that tests enable independently; merging them changes the debugging command line.
  • One /+ path operator. find_files, module_resolution and build_system each define ( /+ ) as Filename.concat.
  • Commented-out debug code in the type checker. Upstream debug blocks such as check_expans and check_memorized_abbrevs in btype.ml and print_pat/pretty_row in parmatch.ml are kept as comments; keeping or deleting them is a policy choice.
  • Comment positions in the formatter. In an arrow type, (~x /* a */ : int=?, unit) prints the comment after the colon, and a comment after =? moves to the next argument; nothing is lost and the output is stable, but the position changes.
  • rescript-tools help text. The help omits the ppx and extract-embedded commands; whether to advertise them is a CLI decision.
  • RescriptTools.binaryPath from CommonJS. cli/common/bins.js is an ES module with top-level await, so a CommonJS project calling binaryPath probably cannot load it; untested.

🤖 Generated with Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions