Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various fixes and improvements to module linting #95

Merged
merged 11 commits into from
Jan 24, 2023

Commits on Nov 1, 2022

  1. Configuration menu
    Copy the full SHA
    a678b03 View commit details
    Browse the repository at this point in the history
  2. ocaml syntax: fix contained functor

    - do not require space before `functor`
    - do not match `functorx` as `functor x`
    
    For precedence reasons, `ocamlMPRestr2` must then be declared after
    `ocamlMPRestr3`.
    Maelan committed Nov 1, 2022
    Configuration menu
    Copy the full SHA
    39856d6 View commit details
    Browse the repository at this point in the history
  3. ocaml syntax: fix contained sig

    - do not require space before contained `sig`
    - do not match `sigx` as `sig x`
    
    For precedence reasons, `ocamlMPRestr1` must then be declared after
    `ocamlMPRestr3`.
    Maelan committed Nov 1, 2022
    Configuration menu
    Copy the full SHA
    c987f09 View commit details
    Browse the repository at this point in the history
  4. ocaml syntax: dedup ocamlSig / ocamlMPRestr1

    for precedence reasons, ocamlSig must be declared after ocamlMPRestr3
    Maelan committed Nov 1, 2022
    Configuration menu
    Copy the full SHA
    a7eec51 View commit details
    Browse the repository at this point in the history
  5. ocaml syntax: dedup ocamlStruct / ocamlFuncStruct

    also, minor fix: do not require a character before `struct` when nested
    in parentheses; this fixes the following example:
    
        open F(
        struct end
        )
    Maelan committed Nov 1, 2022
    Configuration menu
    Copy the full SHA
    175ed43 View commit details
    Browse the repository at this point in the history
  6. ocaml syntax: dedup ocamlMPRestr3 / ocamlModTypeRestr

    (but what is that for?)
    Maelan committed Nov 1, 2022
    Configuration menu
    Copy the full SHA
    524c540 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    60e70f4 View commit details
    Browse the repository at this point in the history
  8. 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.
    Maelan committed Nov 1, 2022
    Configuration menu
    Copy the full SHA
    4f39941 View commit details
    Browse the repository at this point in the history
  9. ocaml syntax: rename some matchgroups relating to modules

    (those I could make sense of)
    Maelan committed Nov 1, 2022
    Configuration menu
    Copy the full SHA
    72cf1d6 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    577635a View commit details
    Browse the repository at this point in the history
  11. request clarification

    Maelan committed Nov 1, 2022
    Configuration menu
    Copy the full SHA
    0676496 View commit details
    Browse the repository at this point in the history