File tree Expand file tree Collapse file tree 2 files changed +26
-5
lines changed
test/blackbox-tests/test-cases/virtual-libraries Expand file tree Collapse file tree 2 files changed +26
-5
lines changed Original file line number Diff line number Diff line change @@ -125,19 +125,18 @@ let decode =
125125 ~since_expanded: Stanza_common.Modules_settings. since_expanded
126126 " virtual_modules"
127127 in
128- let + kind_loc, dune_file_kind =
129- located
130- @@ field " kind" Lib_kind.Dune_file. decode ~default: Lib_kind.Dune_file. Normal
128+ let + dune_file_kind =
129+ field " kind" Lib_kind.Dune_file. decode ~default: Lib_kind.Dune_file. Normal
131130 in
132131 let kind : Lib_kind.t =
133132 match virtual_modules, dune_file_kind with
134133 | Some _ , ((Parameter | Ppx_deriver _ | Ppx_rewriter _ ) as incompatable_kind ) ->
135134 User_error. raise
136- ~loc: kind_loc
135+ ~loc: stanza_loc
137136 ~hints: [ Pp. text " Remove either the 'kind' or 'virtual_modules' fields" ]
138137 [ Pp. text " Only virtual libraries can have 'virtual_modules'"
139138 ; Pp. textf
140- " but this library has 'virtual_modules' and is specified as kind %s "
139+ " but this library has 'virtual_modules' and is specified as kind '%s'. "
141140 (Lib_kind.Dune_file. cstr_name incompatable_kind)
142141 ]
143142 | Some _ , Normal ->
Original file line number Diff line number Diff line change 1+ Test that trying to use virtual_modules with an incompatible kind reports a user
2+ error
3+
4+ $ echo " (lang dune 3.20)" > dune-project
5+
6+ $ touch empty. mli
7+ $ cat > dune << EOF
8+ > (library
9+ > (name invalid_lib)
10+ > (kind parameter)
11+ > (virtual_modules empty))
12+ > EOF
13+ $ dune build
14+ File " dune" , lines 1 -4, characters 0 -72:
15+ 1 | (library
16+ 2 | (name invalid_lib)
17+ 3 | (kind parameter)
18+ 4 | (virtual_modules empty))
19+ Error: Only virtual libraries can have ' virtual_modules'
20+ but this library has ' virtual_modules' and is specified as kind ' parameter' .
21+ Hint: Remove either the ' kind' or ' virtual_modules' fields
22+ [1 ]
You can’t perform that action at this time.
0 commit comments