Hacktoberfest 2026 : les issues que les mainteneurs ont marquées pour octobre, ouvertes et accessibles aux débutants. Parcourir les issues Hacktoberfest

Port selected upstream OCaml type checker improvements (post 4.06)

Ouverte
#9,130 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
5/5
Temps estimé
Plus d'une semaine
Accessibilité débutants
35/100
Type d'issue
Fonctionnalité
Clarté
Plutôt claire
Activité
Active
Stack technique
ocaml
Domaine
compilers

Piste de recherche

Start by reading the compiler sources under compiler/ml and compare the listed upstream changes with the specific behavior you want to port. The issue asks for each candidate to be a separate PR with tests and a changelog fragment; choose one candidate and use its stated files, such as includecore/includemod for diff-based inclusion errors. Done means the selected improvement is ported and covered by tests, with a changelog fragment.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

The type checker and pattern-match compiler in compiler/ml are a 4.06-era fork of OCaml. They have diverged a lot since then. Upstream has made several improvements in the meantime that would help ReScript users directly. This issue tracks the ones worth porting by hand. A full resync is not a goal.

Candidates, by value

  • Diff-based inclusion errors (4.13, Diffing). Signature mismatches name the record field or variant constructor that was added, removed, swapped or renamed, and the same goes for functor arguments. Today we print "Their kinds differ" or "Fields number N have different names". .resi mismatches are common, and the change stays mostly within includecore/includemod. It needs a port by hand, because of our own error cases (Field_optional, Runtime_annotation, Not_undefined, …).
  • Shapes (4.14). .cmt files record where each definition comes from, through functor applications, include and module aliases. This would remove the analysis limitation for cross-file references through applied functors (see #9084). It is also the basis for project-wide find-references. Requires a cmt format change.
  • Matching on mutable fields under guards (upstream ocaml/ocaml#7241, unsound). We are affected: a failed guard that changes a mutable field can make switch take a case that does not match. Repro and details in #9129. Upstream fixed it in OCaml 5.3 (ocaml/ocaml#13138, ocaml/ocaml#13152).
  • Warning names (4.12). Accept names like +unused-var next to numbers in -w and in rescript.json. Cheap to add, and warning configs become readable.
  • Parmatch improvements. These can be picked one at a time. Counterexamples mention guarded clauses ("some guarded clause may match this value"). Unused cases inside or-patterns are detected more precisely. Refutation is faster.
  • Structured unification traces (Errortrace, 4.14/5.0). These separate unification, equality and moregen failures, which gives more precise "not compatible" explanations. We have already rewritten many messages (error_message_utils), so the gain is smaller and touches more code.
  • Type scopes (4.08–4.11). Escape checks for locally abstract types and first-class modules would use a separate scope instead of levels. This is invasive (ctype/typecore), so only worth it if escape bugs come up.
  • GADT soundness fixes (injectivity, 4.12, and others). Port these when a bug report needs one. GADTs are rare in ReScript code.

Out of scope

  • Abstract type_expr (4.14) and the with_local_level refactor (5.1): a lot of churn, no user-visible gain.
  • Upstream error rendering (Location.report): we have our own code_frame.
  • Lambda/Simplif optimisations and Flambda: the JS backend has its own Lam passes.
  • Language features that don't fit ReScript: binding operators, labeled tuples, effects, unboxed layouts and modes, with module type.
  • Alerts ([@alert]): would only be nice to have unless there is demand for categories beyond @deprecated.

Each checked item should be its own PR with tests and a changelog fragment where users can see the change.

Langage dominant
OCaml
Étoiles
7.5k
Forks
484
Merge moyen
20 h 43 min
PR mergées (30 j)
263

Préparer son environnement

Ouvrir dans Codespaces

Lance le conteneur de développement du projet dans votre navigateur, avec votre propre compte GitHub.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de rescript-lang/rescript

Toutes les issues de rescript-lang/rescript

Issues similaires

Plus d'issues Compilers

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.