Skip to content

.#6

Open
JonoPrest wants to merge 4 commits into
masterfrom
jono/remove-longident-lapply
Open

.#6
JonoPrest wants to merge 4 commits into
masterfrom
jono/remove-longident-lapply

Conversation

@JonoPrest

Copy link
Copy Markdown
Owner

No description provided.

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.
@JonoPrest JonoPrest changed the base branch from jono/lapply-base to master June 11, 2026 13:13
@JonoPrest JonoPrest force-pushed the jono/remove-longident-lapply branch from 7bd4d4e to 4731ede Compare June 11, 2026 16:40
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.
@JonoPrest JonoPrest force-pushed the jono/remove-longident-lapply branch from ca2c07a to 11f6a61 Compare June 12, 2026 07:43
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