-
-
Notifications
You must be signed in to change notification settings - Fork 57
Closed
Description
In #915, the silencing of warning 20 was moved to all function applications (regardless if the function is defined with mel.raw
or not).
I understand it's impossible to detect this kind of situation at PPX time. But I wonder if the silencing should be removed from the PPX, and instead document in mel.raw
docs that these functions need to be explicitly annotated? E.g. if the ppx was modified to not add the attribute, this test would trigger the following results:
Usage of mel.raw can trigger warning 20 ([ignored-extra-argument])
$ . ./setup.sh
$ cat > dune-project <<EOF
> (lang dune 3.8)
> (using melange 0.1)
> EOF
$ cat > dune << EOF
> (melange.emit
> (target out)
> (emit_stdlib false)
> (preprocess (pps melange.ppx)))
> EOF
$ cat > foo.ml <<EOF
> let addOne = [%mel.raw {|
> function (a) {
> return a + 1;
> }
> |}]
> let x = addOne 2
> EOF
$ dune build @melange
File "foo.ml", line 6, characters 15-16:
6 | let x = addOne 2
^
Error (warning 20 [ignored-extra-argument]): this argument will not be used by the function.
[1]
Annotating the function (which should always be the case, for safety) makes the
warning go away
$ cat > foo.ml <<EOF
> let addOne: int -> int = [%mel.raw {|
> function (a) {
> return a + 1;
> }
> |}]
> let x = addOne 2
> EOF
$ dune build @melange
Metadata
Metadata
Assignees
Labels
No labels