Skip to content

Commit

Permalink
Improve error when parsing several licenses
Browse files Browse the repository at this point in the history
Closes ocaml#6103

Signed-off-by: Etienne Millon <me@emillon.org>
  • Loading branch information
emillon committed Sep 2, 2022
1 parent c9eca1b commit 4784968
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
8 changes: 5 additions & 3 deletions src/dune_engine/package.ml
Original file line number Diff line number Diff line change
Expand Up @@ -498,10 +498,12 @@ module Info = struct
(Dune_lang.Syntax.since Stanza.syntax (v (1, 9)) >>> repeat string)
and+ license =
field_o "license"
(Dune_lang.Syntax.since Stanza.syntax (v (3, 2))
(Dune_lang.Syntax.since Stanza.syntax (v (1, 9))
>>> repeat1 string
<|> ( Dune_lang.Syntax.since Stanza.syntax (v (1, 9)) >>> string
>>| fun s -> [ s ] ))
~check_multi:
(Dune_lang.Syntax.since ~what:"Parsing several licenses"
Stanza.syntax
(v (3, 2))))
and+ homepage =
field_o "homepage"
(Dune_lang.Syntax.since Stanza.syntax (v (1, 10)) >>> string)
Expand Down
7 changes: 4 additions & 3 deletions test/blackbox-tests/test-cases/dune-project-meta/main.t/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -606,10 +606,11 @@ Reject multiple licences in version [1.9, 3.2)
> EOF

$ dune build
File "dune-project", line 4, characters 13-16:
File "dune-project", line 4, characters 0-17:
4 | (license MIT ISC)
^^^
Error: Too many argument for license
^^^^^^^^^^^^^^^^^
Error: Parsing several licenses is only available since version 3.2 of the
dune language. Please update your dune-project file to have (lang dune 3.2).
[1]

Allow multiple licences in version >= 3.2
Expand Down

0 comments on commit 4784968

Please sign in to comment.