Skip to content

Commit 29ad7e1

Browse files
authored
Fix false "no cmi" reporting from errors command (#1577)
from voodoos/fix-errors-false-no-cmi-reporting
2 parents 46ff3b4 + 1730a51 commit 29ad7e1

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed

CHANGES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ unreleased
1717
- Fix object method completion not working (#1606, fixes #1575)
1818
- Improve context detection for package types (#1608, fixes #1607)
1919
- Fix incorrect locations for string literals (#1574)
20+
- Fixed an issue that caused `errors` to erroneously alert about missing
21+
`cmi` files (#1577)
2022
+ editor modes
2123
- emacs: call the user's configured completion UI in
2224
`merlin-construct` (#1598)

src/frontend/query_commands.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,10 +656,10 @@ let dispatch pipeline (type a) : a Query_protocol.t -> a =
656656
| Errors { lexing; parsing; typing }->
657657
let typer = Mpipeline.typer_result pipeline in
658658
let verbosity = verbosity pipeline in
659-
Printtyp.wrap_printing_env (Mtyper.get_env typer) ~verbosity @@ fun () ->
660659
let lexer_errors = Mpipeline.reader_lexer_errors pipeline in
661660
let parser_errors = Mpipeline.reader_parser_errors pipeline in
662661
let typer_errors = Mpipeline.typer_errors pipeline in
662+
Printtyp.wrap_printing_env (Mtyper.get_env typer) ~verbosity @@ fun () ->
663663
(* When there is a cmi error, we will have a lot of meaningless errors,
664664
there is no need to report them. *)
665665
let typer_errors =

tests/test-dirs/errors/no-cmi.t

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
$ mkdir liba
2+
$ cat >liba/liba.ml <<EOF
3+
> module Libb = Libb
4+
> EOF
5+
6+
$ mkdir libb
7+
$ cat >libb/libb.ml <<EOF
8+
> let x = 42
9+
> EOF
10+
11+
$ cat >liba/.merlin <<EOF
12+
> B .
13+
> B ../libb
14+
> EOF
15+
16+
$ (cd libb && $OCAMLC -c -bin-annot libb.ml)
17+
$ (cd liba && $OCAMLC -c -bin-annot liba.ml -I ../libb)
18+
19+
20+
$ ls libb
21+
libb.cmi
22+
libb.cmo
23+
libb.cmt
24+
libb.ml
25+
26+
There should be no errors
27+
$ cd liba && $MERLIN single errors -filename liba.ml<liba.ml |
28+
> jq '.value'
29+
[]

0 commit comments

Comments
 (0)