Skip to content

Commit d031b30

Browse files
committed
fix: improve code
Signed-off-by: Sachin Beniwal <s474996633@gmail.com>
1 parent d4c988b commit d031b30

3 files changed

Lines changed: 11 additions & 8 deletions

File tree

src/dune_lang/dune_project.ml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -956,17 +956,17 @@ let parse ~dir ~(lang : Lang.Instance.t) ~file =
956956
and+ pkg_field =
957957
field_o
958958
"pkg"
959-
(let+ loc = loc
960-
and+ () = junk_everything in
961-
loc)
959+
(Syntax.since Stanza.syntax (3, 21)
960+
>>> let+ loc = loc
961+
and+ () = junk_everything in
962+
loc)
962963
in
963964
(match pkg_field with
964965
| Some loc ->
965966
User_error.raise
966967
~loc
967-
[ Pp.text "(pkg ...) belongs in dune-workspace, not dune-project"
968-
; Pp.text "Hint: move this stanza to your dune-workspace file"
969-
]
968+
~hints:[ Pp.text "move this stanza to your dune-workspace file" ]
969+
[ Pp.text "(pkg ...) belongs in dune-workspace, not dune-project" ]
970970
| None -> ());
971971
fun (opam_packages : (Loc.t * Package.t Memo.t) Package.Name.Map.t) ->
972972
let opam_file_location =

test/blackbox-tests/test-cases/workspaces/pkg-in-dune-project.t/run.t renamed to test/blackbox-tests/test-cases/pkg/pkg-in-dune-project-error.t

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
Test that putting (pkg enabled) in dune-project instead of dune-workspace
22
gives a helpful error message.
33

4+
$ cat > dune-project <<EOF
5+
> (lang dune 3.21)
6+
> (pkg enabled)
7+
> EOF
8+
49
$ dune build
510
File "dune-project", line 2, characters 0-13:
611
2 | (pkg enabled)

test/blackbox-tests/test-cases/workspaces/pkg-in-dune-project.t/dune-project

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)