Skip to content

Commit 4ea04ec

Browse files
committed
add comment, expand the test
Signed-off-by: Antonio Nuno Monteiro <[email protected]>
1 parent d7b3254 commit 4ea04ec

File tree

2 files changed

+26
-10
lines changed

2 files changed

+26
-10
lines changed

src/dune_rules/module_compilation.ml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,10 @@ let build_cm
325325
; A "-c"
326326
; Command.Ml_kind.flag ml_kind
327327
; Dep src
328-
; Hidden_deps (Dep.Set.of_files (Option.to_list original))
328+
; (* We add a hidden dependency on the original, pre-PPX source
329+
file, which the compiler wants to find to display error
330+
location snippets. *)
331+
Hidden_deps (Dep.Set.of_files (Option.to_list original))
329332
; other_targets
330333
]
331334
>>| Action.Full.add_sandbox sandbox))

test/blackbox-tests/test-cases/melange/ppx-preview.t

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,8 @@ Show PPX snippet preview is shown in Dune
1515
> let x: nope = "hello"
1616
> EOF
1717

18-
$ cat > dune <<EOF
19-
> (melange.emit
20-
> (target output)
21-
> (libraries the_lib)
22-
> (emit_stdlib false))
23-
> EOF
24-
2518
$ export DUNE_SANDBOX=symlink
26-
$ dune build @melange
19+
$ dune build @all
2720
File "lib/the_lib.ml", line 1, characters 7-11:
2821
1 | let x: nope = "hello"
2922
^^^^
@@ -33,10 +26,30 @@ Show PPX snippet preview is shown in Dune
3326
Works if the sandbox is disabled
3427

3528
$ export DUNE_SANDBOX=none
36-
$ dune build @melange
29+
$ dune build @all
3730
File "lib/the_lib.ml", line 1, characters 7-11:
3831
1 | let x: nope = "hello"
3932
^^^^
4033
Error: Unbound type constructor nope
4134
[1]
4235

36+
$ cat > lib/the_lib.mli <<EOF
37+
> val x: nope
38+
> EOF
39+
40+
$ export DUNE_SANDBOX=symlink
41+
$ dune build @all
42+
File "lib/the_lib.mli", line 1, characters 7-11:
43+
1 | val x: nope
44+
^^^^
45+
Error: Unbound type constructor nope
46+
[1]
47+
48+
$ export DUNE_SANDBOX=none
49+
$ dune build @all
50+
File "lib/the_lib.mli", line 1, characters 7-11:
51+
1 | val x: nope
52+
^^^^
53+
Error: Unbound type constructor nope
54+
[1]
55+

0 commit comments

Comments
 (0)