| 1 |
Bad attributes generate an error message. |
| 2 |
|
| 3 |
$ echo "(lang dune 2.7)" > dune-project |
| 4 |
$ cat > dune <<'EOF' |
| 5 |
> (executable |
| 6 |
> (name test) |
| 7 |
> (modes byte) |
| 8 |
> (instrumentation (backend bisect_ppx))) |
| 9 |
> EOF |
| 10 |
$ cat > test.ml <<'EOF' |
| 11 |
> [@@@coverage invalid] |
| 12 |
> EOF |
| 13 |
$ dune build --instrument-with bisect_ppx --display quiet |
| 14 |
File "test.ml", line 1, characters 0-21: |
| 15 |
1 | [@@@coverage invalid] |
| 16 |
^^^^^^^^^^^^^^^^^^^^^ |
| 17 |
Error: Bad payload in coverage attribute. |
| 18 |
[1] |
| 19 |
|
| 20 |
|
| 21 |
Warnings 4 (fragile pattern matching due to wildcard) and 11 (unused match case) |
| 22 |
in generated case instrumentation are suppressed. Warning 26 (unused variable |
| 23 |
from as binding) is suppressed. Warning 28 (wildcard given to constant |
| 24 |
constructor) is suppressed. One instance is still displayed for the user's code. |
| 25 |
|
| 26 |
$ cat > test.ml <<'EOF' |
| 27 |
> type t = A | B | C |
| 28 |
> let _ = |
| 29 |
> match A with |
| 30 |
> | A | B -> () |
| 31 |
> | C -> () |
| 32 |
> let _ = |
| 33 |
> match A with |
| 34 |
> | A | B | C -> () |
| 35 |
> let _ = |
| 36 |
> match A with |
| 37 |
> | (A as x) | (B as x) -> x |
| 38 |
> | C -> C |
| 39 |
> let _ = |
| 40 |
> match A with |
| 41 |
> | A _ | B | C -> () |
| 42 |
> EOF |
| 43 |
$ dune build --instrument-with bisect_ppx --display quiet 2>&1 | sed -e 's/ \[[^]]*\]//g' |
| 44 |
File "test.ml", line 15, characters 6-7: |
| 45 |
15 | | A _ | B | C -> () |
| 46 |
^ |
| 47 |
Error (warning 28): wildcard pattern given as argument to a constant constructor |
| 48 |
|
| 49 |
|
| 50 |
Missing record labels warning (9) is suppressed from inserted documentation. It |
| 51 |
is still emitted for the user's code. |
| 52 |
|
| 53 |
$ cat > test.ml <<'EOF' |
| 54 |
> type t = {a : int; b : int} |
| 55 |
> let _ = |
| 56 |
> match {a = 0; b = 1} with |
| 57 |
> | {a} | {a} -> a |
| 58 |
> EOF |
| 59 |
$ dune build --instrument-with bisect_ppx --display quiet 2>&1 | sed -e 's/ \[[^]]*\]//g' |
| 60 |
File "test.ml", line 4, characters 4-7: |
| 61 |
4 | | {a} | {a} -> a |
| 62 |
^^^ |
| 63 |
Error (warning 9): the following labels are not bound in this record pattern: |
| 64 |
b |
| 65 |
Either bind these labels explicitly or add '; _' to the pattern. |
| 66 |
File "test.ml", line 4, characters 10-13: |
| 67 |
4 | | {a} | {a} -> a |
| 68 |
^^^ |
| 69 |
Error (warning 9): the following labels are not bound in this record pattern: |
| 70 |
b |
| 71 |
Either bind these labels explicitly or add '; _' to the pattern. |
| 72 |
File "test.ml", line 4, characters 10-13: |
| 73 |
4 | | {a} | {a} -> a |
| 74 |
^^^ |
| 75 |
Error (warning 12): this sub-pattern is unused. |