You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ocaml syntax: fix linting of functor and functor params
The `module` keyword is now treated uniformly. Previously, it was
matched differently in signatures (matchgroup `ocamlModSpec`) than
elsewhere (matchgroup `ocamlModule`). Both cases have almost identical
syntax:
(* in signatures: *)
module M (X1 : T1) … (Xn: Tn) : MODULE TYPE
(* in structures: *)
module M (X1 : T1) … (Xn: Tn) [: MODULE TYPE] = MODULE DEF
The case distinction was not taking profit of the small difference in
syntax, and it was creating complexity and mismatch between both cases.
Each case had shortcomings.
In signatures, functor parameters like this where not highlighted
corrrectly:
(* in signatures: *)
module M (X1 : T1) : …
Also, the only case where the `functor` keyword was highlighted
correctly was in a `module` type annotation *in a signature*. It was not
highlighted correctly in `module` type annotations *in structures*, nor
in `module` definitions, nor in `module type` definitions.
(* in signatures: *)
module type T = functor (X1 : T1) -> …
module M : functor (X1 : T1) -> … (* the only case that was working *)
(* in structures: *)
module type T = functor (X1 : T1) -> …
module M : functor (X1 : T1) -> … = …
module M = functor (X1 : T1) -> …
These bugs are now fixed. The `ocamlModule` matchgroup subsumes the
features of both former cases (`module` in signatures / in structures).
The `functor` keyword is no more "contained", so that it now matches in
all of the 5 situations above.
0 commit comments