Better error report.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@12654 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Alain Frisch 2012-06-29 09:49:52 +00:00
parent 8531a5c8ee
commit 9d32d89108
2 changed files with 7 additions and 3 deletions

View File

@ -27,8 +27,10 @@ let ifdef =
else
this # module_expr body_not_def
| {pmod_desc = Pmod_ident {txt = Lident "IFDEF"}} ->
failwith "Improper use of IFDEF" (* todo: location *)
| {pmod_desc = Pmod_ident {txt = Lident "IFDEF"}; pmod_loc = loc} ->
Format.printf "%a@.Improper use of IFDEF. The correct form is: IFDEF(<var_name:uident>)(<then:modtype>)(<body:modtype>)@."
Location.print_loc loc;
exit 2
| x -> super # module_expr x
end

View File

@ -1,5 +1,7 @@
include IFDEF(XHOME)(struct
let () = print_endline "Defined!"
end)(struct
end)
(*(struct
let () = print_endline "Not defined!"
end)
*)