Skip to content

Commit

Permalink
Merge pull request ocaml#1710 from voodoos/issue-1703-cmi-file-flag
Browse files Browse the repository at this point in the history
Ignore `-cmi-file` flag
  • Loading branch information
voodoos authored Nov 27, 2023
2 parents 07af9cd + 135d470 commit 994ed99
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ merlin NEXT_VERSION
+ merlin binary
- Fix a follow-up issue to the preference of non-ghost nodes introduced in #1660 (#1690, fixes #1689)
- Add `--cache-period` flag, that sets cache invalidation period. (#1698)
- Ignore the new 5.1 `cmi-file` flag instead of rejecting it (#1710, fixes
#1703)
+ editor modes
- vim: load merlin when Vim is compiled with +python3/dyn (e.g. MacVim)

Expand Down
2 changes: 1 addition & 1 deletion src/kernel/mconfig.ml
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ let ocaml_ignored_parametrized_flags = [
"-inline"; "-inline-prim-cost"; "-inline-toplevel"; "-intf";
"-intf_suffix"; "-intf-suffix"; "-o"; "-rounds"; "-runtime-variant";
"-unbox-closures-factor"; "-use-prims"; "-use_runtime"; "-use-runtime";
"-error-style"; "-dump-dir";
"-error-style"; "-dump-dir"; "-cmi-file";
]

let ocaml_warnings_spec ~error =
Expand Down
27 changes: 27 additions & 0 deletions tests/test-dirs/with-cmi.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Since OCaml 5.1 the compiler support the -cmi-file flag:
> -cmi-file filename
> Use the given interface file to type-check the ML source file to compile.
> When this option is not specified, the compiler looks for a .mli file with
> the same base name than the implementation it is compiling and in the same
> directory. If such a file is found, the compiler looks for a corresponding
> .cmi file in the included directories and reports an error if it fails to
> find one.

$ cat >main.mli <<'EOF'
> val f : unit -> int
> EOF

$ $OCAMLC -c main.mli
$ rm main.mli


$ cat >main.ml <<'EOF'
> let f () = 42
> EOF

$ $OCAMLC -c -cmi-file main.cmi main.ml

Merlin should ignore the -cmi-file flag
$ $MERLIN single errors -cmi-file main.cmi -filename main.ml <main.ml |
> jq '.value'
[]

0 comments on commit 994ed99

Please sign in to comment.