Skip to content

Commit 4784968

Browse files
committed
Improve error when parsing several licenses
Closes #6103 Signed-off-by: Etienne Millon <me@emillon.org>
1 parent c9eca1b commit 4784968

File tree

2 files changed

+9
-6
lines changed
  • src/dune_engine
  • test/blackbox-tests/test-cases/dune-project-meta/main.t

2 files changed

+9
-6
lines changed

src/dune_engine/package.ml

+5-3
Original file line numberDiff line numberDiff line change
@@ -498,10 +498,12 @@ module Info = struct
498498
(Dune_lang.Syntax.since Stanza.syntax (v (1, 9)) >>> repeat string)
499499
and+ license =
500500
field_o "license"
501-
(Dune_lang.Syntax.since Stanza.syntax (v (3, 2))
501+
(Dune_lang.Syntax.since Stanza.syntax (v (1, 9))
502502
>>> repeat1 string
503-
<|> ( Dune_lang.Syntax.since Stanza.syntax (v (1, 9)) >>> string
504-
>>| fun s -> [ s ] ))
503+
~check_multi:
504+
(Dune_lang.Syntax.since ~what:"Parsing several licenses"
505+
Stanza.syntax
506+
(v (3, 2))))
505507
and+ homepage =
506508
field_o "homepage"
507509
(Dune_lang.Syntax.since Stanza.syntax (v (1, 10)) >>> string)

test/blackbox-tests/test-cases/dune-project-meta/main.t/run.t

+4-3
Original file line numberDiff line numberDiff line change
@@ -606,10 +606,11 @@ Reject multiple licences in version [1.9, 3.2)
606606
> EOF
607607

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

615616
Allow multiple licences in version >= 3.2

0 commit comments

Comments
 (0)