Skip to content

Remove dead Sig_class/Sig_class_type variants#7

Open
JonoPrest wants to merge 2 commits into
masterfrom
jono/remove-sig-class
Open

Remove dead Sig_class/Sig_class_type variants#7
JonoPrest wants to merge 2 commits into
masterfrom
jono/remove-sig-class

Conversation

@JonoPrest

Copy link
Copy Markdown
Owner

No description provided.

JonoPrest and others added 2 commits June 12, 2026 12:40
* Remove the unreachable Longident.Lapply constructor

Longident.Lapply is the parsetree form of OCaml's applicative-functor
path syntax (F(X).t), where a functor is applied inline inside an
identifier path. ReScript's grammar has no such production: functor
application is only a module expression (module M = F(X)), which the
type checker resolves to Path.Papply, never a Longident.Lapply. The
parser never builds Lapply, so every match on it was dead (assert false
/ fatal_error / raise Not_found / defensive printer fallbacks).

Remove the constructor and all its handling across the type checker,
printers, depend, and analysis. The sole construction site was
Ctype.lid_of_path (Path.Papply -> Longident.Lapply); since no Papply
flows into that type-path conversion, replace it with assert false,
matching the existing Papply -> assert false invariants. Removing the
Env.lookup_module Lapply arms also left functor_components.fcomp_arg
write-only, so drop that field too.

Add a super_errors fixture exercising functor application plus a
type-path error, confirming the functor machinery and error printing
are unchanged.

* Update changelog

* Format functor fixture and refresh super_errors snapshot

* lid_of_path: render Papply paths gracefully instead of asserting

Applicative functors are on by default, so Path.Papply paths are
produced internally (typemod path_of_module, Mtype.strengthen) even
though ReScript source cannot reference such a path directly. Replace the
assert false in Ctype.lid_of_path's Papply arm (introduced when removing
Longident.Lapply) with a graceful Lident rendering via Path.name, so any
diagnostic that ever reaches it degrades to a readable name (e.g. F(Arg))
instead of aborting the compiler.

Add an ounit test that calls Ctype.lid_of_path on a synthetic Papply path
(unreachable from source, so exercised directly) to lock in the graceful
behavior.
Types.signature_item carried Sig_class and Sig_class_type (OCaml class /
class-type items, each `of unit` dummy AST nodes). ReScript has no
classes, so the parser and type checker never construct them; every
match arm was assert false / identity / skip.

Remove both variants and all their handling across the type system
(btype, subst, env, mtype, includemod, printtyp, translmod,
transl_recmodule), gentype, and analysis. Also drop the stale
commented-out get_string block in lam_print.ml referencing the old
3-arg Sig_class form, and simplify the now-trivial filter_rem_sig.

The frozen parsetree0 Pstr_class/Psig_class dummies are independent and
left untouched.
@JonoPrest JonoPrest force-pushed the jono/remove-sig-class branch from 32d44b5 to 4c4b308 Compare June 12, 2026 10:45
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