vim-ocaml icon indicating copy to clipboard operation
vim-ocaml copied to clipboard

OCaml syntax highlighting with struct surround with parentheses

Open ghost opened this issue 9 years ago • 2 comments

Here is a piece of syntax which is not properly handled:

module type X_int = sig val x : int end

module Four: X_int = struct
  let x = 4
end

Four.x

module Three = (struct
  let x = 3
end: X_int)

Three.x

Which looks like: screen shot 2016-01-01 at 8 10 07 pm

ghost avatar Jan 01 '16 12:01 ghost

I confirm this bug. Here is a minimal example:

module M0 : sig end = struct let x = 0 end
(* => linting of struct is correct *)

module M1 : sig end = (struct let x = 0 end : sig end)
(* => linting of struct is correct
  (but linting of last sig is buggy because of the type linter of PR#76) *)

module M2 = (struct let x = 0 end : sig end)
(* =>        ^^^^^^^^^^^^^^^^^^^^
   the whole struct is linted with a wrong, uniform style
   (but linting of last sig is correct) *)

Maelan avatar Jul 22 '22 14:07 Maelan

A related discrepancy:

module IM           = Stdlib.Map.Make(Int)
(*                    ^^^^^^^^^^^^^^^^^^^^
   shown as a module/functor, with a uniform style *)

module IM : sig end = Stdlib.Map.Make(Int)
(*                    ^^^^^^^^^^^^^^^^^^^^
   shown as as an expression (a datatype constructor `Make`
   prefixed with a module path, and a constructor `Int`) *)

It’s just the fact that = does not follow module IM immediately.

Maelan avatar Nov 01 '22 22:11 Maelan