At the tip of master, [dune runtest] fails. I've appended the output below.
I see that the build is good on TravisCI. Am I doing something wrong?
cd ~/sda/repos/ppxlib
eval $(opam env)
env
git reset --hard
git status
opam switch
dune installed-libraries
dune printenv
dune build
dune runtest
Fri 16 Aug 2019 07:00:30 PM EDT
------------------------------------------------------------------------------------------
+ cd /home/dwang/sda/repos/ppxlib
++ opam env
+ eval 'OPAM_SWITCH_PREFIX='\''/usr/local/home/dwang/.opam/default'\'';' export 'OPAM_SWITCH_PREFIX;' 'CAML_LD_LIBRARY_PATH='\''/usr/local/home/dwang/.opam/default/lib/stublibs:/usr/local/home/dwang/.opam/default/lib/ocaml/stublibs:/usr/local/home/dwang/.opam/default/lib/ocaml'\'';' export 'CAML_LD_LIBRARY_PATH;' 'OCAML_TOPLEVEL_PATH='\''/usr/local/home/dwang/.opam/default/lib/toplevel'\'';' export 'OCAML_TOPLEVEL_PATH;' 'MANPATH='\'':/usr/local/home/dwang/.opam/default/man'\'';' export 'MANPATH;' 'PATH='\''/usr/local/home/dwang/.opam/default/bin:/tmp/Jane.shell-file.dwang:/j/office/app/emacs/dev/.sink-2019-08-08_20-17-22.814972/jane-elisp/bin:/home/dwang/bin:/home/dwang/.dispatch/bin:/usr/lib64/ccache:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/j/office/app/emacs/dev/jane-elisp/bin:/j/office/app/ocp-indent/prod/bin'\'';' export 'PATH;'
++ OPAM_SWITCH_PREFIX=/usr/local/home/dwang/.opam/default
++ export OPAM_SWITCH_PREFIX
++ CAML_LD_LIBRARY_PATH=/usr/local/home/dwang/.opam/default/lib/stublibs:/usr/local/home/dwang/.opam/default/lib/ocaml/stublibs:/usr/local/home/dwang/.opam/default/lib/ocaml
++ export CAML_LD_LIBRARY_PATH
++ OCAML_TOPLEVEL_PATH=/usr/local/home/dwang/.opam/default/lib/toplevel
++ export OCAML_TOPLEVEL_PATH
++ MANPATH=:/usr/local/home/dwang/.opam/default/man
++ export MANPATH
++ PATH=/usr/local/home/dwang/.opam/default/bin:/tmp/Jane.shell-file.dwang:/j/office/app/emacs/dev/.sink-2019-08-08_20-17-22.814972/jane-elisp/bin:/home/dwang/bin:/home/dwang/.dispatch/bin:/usr/lib64/ccache:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/j/office/app/emacs/dev/jane-elisp/bin:/j/office/app/ocp-indent/prod/bin
++ export PATH
+ env
CAML_LD_LIBRARY_PATH=/usr/local/home/dwang/.opam/default/lib/stublibs:/usr/local/home/dwang/.opam/default/lib/ocaml/stublibs:/usr/local/home/dwang/.opam/default/lib/ocaml
MANPATH=:/usr/local/home/dwang/.opam/default/man
HOSTNAME=igm-qws-u12112c
STABLE_BUILD_INFO=true
SHELL=/bin/bash
TERM=dumb
HISTSIZE=1000
RIPGREP_CONFIG_PATH=/home/dwang/.ripgreprc
KRB5CCNAME_STATIC=FILE:/tmp/krb5cc_dwang_static
DE=gnome
OLDPWD=/home/dwang/bin
OPAM_SWITCH_PREFIX=/usr/local/home/dwang/.opam/default
OPAMROOT=/usr/local/home/dwang/.opam
OCAML_TOPLEVEL_PATH=/usr/local/home/dwang/.opam/default/lib/toplevel
QT_GRAPHICSSYSTEM_CHECKED=1
USER=dwang
LS_COLORS=
BUILD_PROFILE=fast-build
PAGER=cat
INLINE_TEST_IN_PLACE=true
MAIL=/var/spool/mail/dwang
PATH=/usr/local/home/dwang/.opam/default/bin:/tmp/Jane.shell-file.dwang:/j/office/app/emacs/dev/.sink-2019-08-08_20-17-22.814972/jane-elisp/bin:/home/dwang/bin:/home/dwang/.dispatch/bin:/usr/lib64/ccache:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/j/office/app/emacs/dev/jane-elisp/bin:/j/office/app/ocp-indent/prod/bin
SANDBOX_RULES=true
HGUSER=Wang <[email protected]>
LC_COLLATE=C
PWD=/home/dwang/sda/repos/ppxlib
IRON_CONFIG=prod
EDITOR=emacsclient
IRON_USE_CHG=true
LANG=en_US.utf8
X_LIBRARY_INLINING=true
MODULEPATH=/usr/share/Modules/modulefiles:/etc/modulefiles
FEATURE_EXPLORER_FE_EXE=/tmp/dwang-emacs-exe-cache/j/office/app/fe/dev/bin/fe
FEATURE_EXPLORER_LOG_FE=false
LOADEDMODULES=
STACK_ROOT=/usr/local/home/dwang/stack
HISTCONTROL=ignoredups
KRB5CCNAME=FILE:/tmp/krb5cc_dwang_static
SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
SHARED_CACHE=true
CATALOG_BROWSER_BETA=1
HOME=/home/dwang
SHLVL=3
clones=/usr/local/home/dwang/
FE_CRS_SHOULD_UPDATE=true
LESS=-RXM
TMP=/tmp/dwang
LOGNAME=dwang
VISUAL=emacsclient
XDG_DATA_DIRS=/home/dwang/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share
PLUGD_INSTANCE=prod
MODULESHOME=/usr/share/Modules
LESSOPEN=||/usr/bin/lesspipe.sh %s
dst=nyc-qws-041
INFOPATH=/home/dwang/usr/local/share/info:
DISPLAY=localhost:15.0
OCAMLRUNPARAM=b=1
BASH_FUNC_undo-rebase()=() { local f=$1;
local new_base=$(fe show -base $f);
local new_tip=$(fe show -tip $f);
local merge=$(hg log -r "limit(reverse(only($new_tip,$new_base) and merge()),1)" -T "{node}\n");
local old_tip=$(hg log -r "$merge" -T "{p1node}\n{p2node}\n" | grep -v "$new_base");
local old_base0=$(hg log -r "$merge" -T "{desc}" | sed -rn 's/^.*rebase to .* with ancestor ([a-f0-9]*)$/\1/p');
local old_base=$(echo "$old_base0" | sed -rn 's/^.*\[([0-9a-f]+)\]$/\1/p');
if [[ -z "$old_base" ]]; then
old_base="$old_base0";
fi;
hg book -f -r "$old_tip" "$f";
hg push -B "$f";
fe change -set-base "$old_base" "$f";
fe tools wait "$f"
}
BASH_FUNC_module()=() { eval `/usr/bin/modulecmd bash $*`
}
_=/usr/bin/env
+ git reset --hard
HEAD is now at 95ca88a Merge pull request #85 from ocaml-ppx/opam-file-fixes
+ git status
On branch print-diff-default-config
nothing to commit, working tree clean
+ opam switch
# switch compiler description
-> default ocaml-base-compiler.4.07.1 default
+ dune installed-libraries
base (version: v0.12.0)
base.caml (version: v0.12.0)
base.md5 (version: v0.12.0)
base.shadow_stdlib (version: v0.12.0)
bigarray (version: [distributed with Ocaml])
bytes (version: [distributed with Ocaml])
compiler-libs (version: [distributed with Ocaml])
compiler-libs.bytecomp (version: [distributed with Ocaml])
compiler-libs.common (version: [distributed with Ocaml])
compiler-libs.optcomp (version: [distributed with Ocaml])
compiler-libs.toplevel (version: [distributed with Ocaml])
dune._caml (version: 1.11.1)
dune._dune_lang (version: 1.11.1)
dune._ocaml_config (version: 1.11.1)
dune._result (version: 1.11.1)
dune._stdune (version: 1.11.1)
dune._wp (version: 1.11.1)
dune._wp.dune (version: 1.11.1)
dune._wp.jbuilder (version: 1.11.1)
dune.configurator (version: 1.11.1)
dynlink (version: [distributed with Ocaml])
ocaml-compiler-libs.bytecomp (version: n/a)
ocaml-compiler-libs.common (version: n/a)
ocaml-compiler-libs.shadow (version: n/a)
ocaml-compiler-libs.toplevel (version: n/a)
ocaml-migrate-parsetree (version: 1.4.0)
ocaml-migrate-parsetree.driver-main (version: 1.4.0)
ppx_derivers (version: n/a)
ppxlib (version: 0.5.0)
ppxlib.ast (version: 0.5.0)
ppxlib.metaquot (version: 0.5.0)
ppxlib.metaquot_lifters (version: 0.5.0)
ppxlib.print_diff (version: 0.5.0)
ppxlib.runner (version: 0.5.0)
ppxlib.runner_as_ppx (version: 0.5.0)
ppxlib.traverse (version: 0.5.0)
ppxlib.traverse_builtins (version: 0.5.0)
re (version: 1.9.0)
re.emacs (version: 1.9.0)
re.glob (version: 1.9.0)
re.pcre (version: 1.9.0)
re.perl (version: 1.9.0)
re.posix (version: 1.9.0)
re.str (version: 1.9.0)
result (version: n/a)
seq (version: [distributed with OCaml 4.07 or above])
sexplib0 (version: v0.12.0)
stdio (version: v0.12.0)
str (version: [distributed with Ocaml])
threads (version: [distributed with Ocaml])
threads.posix (version: [distributed with Ocaml])
threads.vm (version: [distributed with Ocaml])
uchar (version: [distributed with Ocaml])
unix (version: [distributed with Ocaml])
+ dune printenv
((flags
(-w @[email protected]@30..39@[email protected]@[email protected] -strict-sequence
-strict-formats -short-paths -keep-locs -w -66))
(ocamlc_flags (-g))
(ocamlopt_flags (-g))
(c_flags
(-std=gnu99 -O2 -fno-strict-aliasing -fwrapv -fno-builtin-memcmp -fPIC))
(cxx_flags
(-O2 -fno-strict-aliasing -fwrapv -fno-builtin-memcmp -fPIC)))
+ dune build
+ dune runtest
patdiff (internal) (exit 1)
(cd _build/default && /usr/bin/patdiff -keep-whitespace -location-style omake -ascii test/code_path/test.ml test/code_path/test.ml.corrected)
-test/code_path/test.ml
+test/code_path/test.ml.corrected
File "test/code_path/test.ml", line 19, characters 0-1:
open Ppxlib
let () =
Driver.register_transformation "test"
~extensions:[
Extension.V3.declare "code_path"
Expression
Ast_pattern.(pstr nil)
(fun ~ctxt ->
let loc = Expansion_context.Extension.extension_point_loc ctxt in
let code_path = Expansion_context.Extension.code_path ctxt in
Ast_builder.Default.estring ~loc
(Code_path.fully_qualified_path code_path))
]
[%%expect{|
+Unknown directive `require'.
+Line _, characters 16-385:
+Error: This expression has type 'a list
+ but an expression was expected of type
+ Extension.t Ppxlib__Import.sexp_list
|}]
let s =
let module A = struct
module A' = struct
let a =
let module B = struct
module B' = struct
let b =
let module C = struct
module C' = struct
let c = [%code_path]
end
end
in C.C'.c
end
end
in B.B'.b
end
end
in A.A'.a
;;
[%%expect{|
-val s : string = "Test.s"
+Line _, characters 28-37:
+Error: Uninterpreted extension 'code_path'.
|}]
let module M = struct
let m = [%code_path]
end
in
M.m
[%%expect{|
-- : string = "Test"
+Line _, characters 12-21:
+Error: Uninterpreted extension 'code_path'.
|}]
patdiff (internal) (exit 1)
(cd _build/default && /usr/bin/patdiff -keep-whitespace -location-style omake -ascii test/driver/non-compressible-suffix/test.ml test/driver/non-compressible-suffix/test.ml.corrected)
-test/driver/non-compressible-suffix/test.ml
+test/driver/non-compressible-suffix/test.ml.corrected
File "test/driver/non-compressible-suffix/test.ml", line 22, characters 0-1:
open Ast_builder.Default;;
Driver.register_transformation "blah"
~rules:[ Context_free.Rule.extension
(Extension.declare "foo"
Expression
Ast_pattern.(pstr nil)
(fun ~loc ~path:_ -> eint ~loc 42))
; Context_free.Rule.extension
(Extension.declare "@foo.bar"
Expression
Ast_pattern.(pstr nil)
(fun ~loc ~path:_ -> eint ~loc 42))
]
;;
[%%expect{|
-- : unit = ()
+Unknown directive `require'.
+Unknown directive `require'.
+Line _, characters 9-405:
+Error: This expression has type 'a list
+ but an expression was expected of type
+ Context_free.Rule.t Ppxlib__Import.sexp_list
|}]
[%foo];;
[%%expect{|
-- : int = 42
+Line _, characters 2-5:
+Error: Uninterpreted extension 'foo'.
|}]
[%foo.bar];;
[%%expect{|
-- : int = 42
+Line _, characters 2-9:
+Error: Uninterpreted extension 'foo.bar'.
|}]
[%bar];;
[%%expect{|
Line _, characters 2-5:
Error: Uninterpreted extension 'bar'.
|}]
patdiff (internal) (exit 1)
(cd _build/default && /usr/bin/patdiff -keep-whitespace -location-style omake -ascii test/deriving/test.ml test/deriving/test.ml.corrected)
-test/deriving/test.ml
+test/deriving/test.ml.corrected
File "test/deriving/test.ml", line 14, characters 0-1:
#use "topfind";;
#require "base";;
#load "ppxlib_metaquot_lifters.cmo";;
#load "ppxlib_metaquot.cmo";;
open Ppxlib
let foo =
Deriving.add "foo"
~str_type_decl:(Deriving.Generator.make_noarg
(fun ~loc ~path:_ _ -> [%str let x = 42]))
[%%expect{|
-val foo : Deriving.t = <abstr>
+Unknown directive `require'.
+Line _, characters 15-20:
+Error: This expression has type string but an expression was expected of type
+ Ppxlib__Import.string
|}]
let bar =
Deriving.add "bar"
~str_type_decl:(Deriving.Generator.make_noarg
~deps:[foo]
(fun ~loc ~path:_ _ -> [%str let () = Printf.printf "x = %d\n" x]))
[%%expect{|
-val bar : Deriving.t = <abstr>
+Line _, characters 28-33:
+Error: This expression has type 'a list
+ but an expression was expected of type
+ Deriving.t Ppxlib__Import.sexp_list
|}]
type t = int [@@deriving bar]
[%%expect{|
Line _, characters 25-28:
-Error: Deriver foo is needed for bar, you need to add it before in the list
+Error: Ppxlib.Deriving: 'bar' is not a supported type deriving generator
|}]
type t = int [@@deriving bar, foo]
[%%expect{|
Line _, characters 25-33:
-Error: Deriver foo is needed for bar, you need to add it before in the list
+Error: Ppxlib.Deriving: 'bar' is not a supported type deriving generator
|}]
type nonrec int = int [@@deriving foo, bar]
[%%expect{|
-type nonrec int = int
-val x : int = 42
+Line _, characters 34-42:
+Error: Ppxlib.Deriving: 'foo' is not a supported type deriving generator
|}]
patdiff (internal) (exit 1)
(cd _build/default && /usr/bin/patdiff -keep-whitespace -location-style omake -ascii test/base/test.ml test/base/test.ml.corrected)
-test/base/test.ml
+test/base/test.ml.corrected
File "test/base/test.ml", line 11, characters 0-1:
#use "topfind";;
#require "base";;
#require "stdio";;
open Base
open Stdio
open Ppxlib
module N = Ppxlib_private.Name
[%%expect{|
+Unknown directive `require'.
+Unknown directive `require'.
+Line _, characters 5-9:
+Error: Unbound module Base
+Line _, characters 5-10:
+Error: Unbound module Stdio
+Hint: Did you mean Stdlib?
module N = Ppxlib.Ppxlib_private.Name
|}]
let dot_suffixes name =
Caml.Printf.sprintf "%s"
(Sexp.to_string_hum
(List.sexp_of_t String.sexp_of_t (N.dot_suffixes name)))
[%%expect{|
-val dot_suffixes : string -> string = <fun>
+Line _, characters 2-21:
+Error: Unbound module Caml
|}]
let _ = dot_suffixes "foo.bar.baz"
[%%expect{|
-- : string = "(baz bar.baz foo.bar.baz)"
+Line _, characters 8-20:
+Error: Unbound value dot_suffixes
|}]
let _ = dot_suffixes "[email protected]"
[%%expect{|
-- : string = "(bar.baz foo.bar.baz)"
+Line _, characters 8-20:
+Error: Unbound value dot_suffixes
|}]
let split_path name =
let a, b = N.split_path name in
Caml.Printf.sprintf "%s"
(Sexp.to_string_hum
(List [sexp_of_string a; Option.sexp_of_t sexp_of_string b]))
[%%expect{|
-val split_path : string -> string = <fun>
+Line _, characters 4-23:
+Error: Unbound module Caml
|}]
let _ = split_path "a.b.c"
[%%expect{|
-- : string = "(a.b.c ())"
+Line _, characters 8-18:
+Error: Unbound value split_path
|}]
let _ = split_path "a.b.c.D"
[%%expect{|
-- : string = "(a.b.c (D))"
+Line _, characters 8-18:
+Error: Unbound value split_path
|}]
let _ = split_path ".D"
[%%expect{|
-- : string = "(\"\" (D))"
+Line _, characters 8-18:
+Error: Unbound value split_path
|}]
let convert_longident string =
let lident = Longident.parse string in
let name = Longident.name lident in
(name, lident)
[%%expect{|
-val convert_longident : string -> string * longident = <fun>
+val convert_longident :
+ Ppxlib__Import.string -> Ppxlib__Import.string * longident = <fun>
|}]
let _ = convert_longident "x"
[%%expect{|
-- : string * longident = ("x", Ppxlib.Longident.Lident "x")
+Line _, characters 26-29:
+Error: This expression has type string but an expression was expected of type
+ Ppxlib__Import.string
|}]
let _ = convert_longident "(+)"
[%%expect{|
-- : string * longident = ("( + )", Ppxlib.Longident.Lident "+")
+Line _, characters 26-31:
+Error: This expression has type string but an expression was expected of type
+ Ppxlib__Import.string
|}]
let _ = convert_longident "( + )"
[%%expect{|
-- : string * longident = ("( + )", Ppxlib.Longident.Lident "+")
+Line _, characters 26-33:
+Error: This expression has type string but an expression was expected of type
+ Ppxlib__Import.string
|}]
let _ = convert_longident "Base.x"
[%%expect{|
-- : string * longident =
-("Base.x", Ppxlib.Longident.Ldot (Ppxlib.Longident.Lident "Base", "x"))
+Line _, characters 26-34:
+Error: This expression has type string but an expression was expected of type
+ Ppxlib__Import.string
|}]
let _ = convert_longident "Base.(+)"
[%%expect{|
-- : string * longident =
-("Base.( + )", Ppxlib.Longident.Ldot (Ppxlib.Longident.Lident "Base", "+"))
+Line _, characters 26-36:
+Error: This expression has type string but an expression was expected of type
+ Ppxlib__Import.string
|}]
let _ = convert_longident "Base.( + )"
[%%expect{|
-- : string * longident =
-("Base.( + )", Ppxlib.Longident.Ldot (Ppxlib.Longident.Lident "Base", "+"))
+Line _, characters 26-38:
+Error: This expression has type string but an expression was expected of type
+ Ppxlib__Import.string
|}]
let _ = convert_longident "Base.( land )"
[%%expect{|
-- : string * longident =
-("Base.( land )",
- Ppxlib.Longident.Ldot (Ppxlib.Longident.Lident "Base", "land"))
+Line _, characters 26-41:
+Error: This expression has type string but an expression was expected of type
+ Ppxlib__Import.string
|}]
let _ = Ppxlib.Code_path.(file_path @@ top_level ~file_path:"dir/main.ml")
[%%expect{|
-- : string = "dir/main.ml"
+Line _, characters 60-73:
+Error: This expression has type string but an expression was expected of type
+ Ppxlib__Import.string
|}]
let _ = Ppxlib.Code_path.(fully_qualified_path @@ top_level ~file_path:"dir/main.ml")
[%%expect{|
-- : string = "Main"
+Line _, characters 71-84:
+Error: This expression has type string but an expression was expected of type
+ Ppxlib__Import.string
|}]
let complex_path =
let open Ppxlib.Code_path in
let loc = Ppxlib.Location.none in
top_level ~file_path:"dir/main.ml"
|> enter_module ~loc "Sub"
|> enter_module ~loc "Sub_sub"
|> enter_value ~loc "some_val"
[%%expect{|
-val complex_path : Code_path.t = <abstr>
+Line _, characters 23-36:
+Error: This expression has type string but an expression was expected of type
+ Ppxlib__Import.string
|}]
let _ = Ppxlib.Code_path.fully_qualified_path complex_path
[%%expect{|
-- : string = "Main.Sub.Sub_sub.some_val"
+Line _, characters 46-58:
+Error: Unbound value complex_path
|}]
let _ = Ppxlib.Code_path.to_string_path complex_path
[%%expect{|
-- : string = "dir/main.ml.Sub.Sub_sub"
+Line _, characters 40-52:
+Error: Unbound value complex_path
|}]
patdiff (internal) (exit 1)
(cd _build/default && /usr/bin/patdiff -keep-whitespace -location-style omake -ascii test/driver/transformations/test.ml test/driver/transformations/test.ml.corrected)
-test/driver/transformations/test.ml
+test/driver/transformations/test.ml.corrected
File "test/driver/transformations/test.ml", line 32, characters 0-1:
match td.ptype_kind with
| Ptype_record lds ->
if Poly.(<>)
(List.sort lds ~compare:(fun a b -> String.compare a.pld_name.txt b.pld_name.txt))
lds
then
Driver.Lint_error.of_string td.ptype_loc
"Fields are not sorted!"
:: acc
else
acc
| _ -> acc
end
let () =
Driver.register_transformation "lint" ~lint_impl:(fun st -> lint#structure st [])
[%%expect{|
-val lint : Driver.Lint_error.t list Ast_traverse.fold = <obj>
+Unknown directive `require'.
+Unknown directive `require'.
+Line _, characters 5-9:
+Error: Unbound module Base
+Line _, characters 9-18:
+Error: Unbound module Poly
+Line _, characters 62-66:
+Error: Unbound value lint
|}]
type t =
{ b : int
; a : int
}
[%%expect{|
-Line _, characters 0-36:
-Error (warning 22): Fields are not sorted!
+type t = { b : int; a : int; }
|}]
(* Extension with a path argument *)
let () =
Driver.register_transformation "plop"
~rules:[Context_free.Rule.extension
(Extension.declare_with_path_arg "plop"
Expression
Ast_pattern.(pstr nil)
(fun ~loc ~path:_ ~arg ->
let open Ast_builder.Default in
match arg with
| None -> estring ~loc "-"
| Some { loc; txt } -> estring ~loc (Longident.name txt)))]
[%%expect{|
+Line _, characters 11-418:
+Error: This expression has type 'a list
+ but an expression was expected of type
+ Context_free.Rule.t Ppxlib__Import.sexp_list
|}]
let _ = Caml.Printf.sprintf "%s\n" [%plop]
[%%expect{|
-- : string = "-\n"
+Line _, characters 8-27:
+Error: Unbound module Caml
|}]
let _ = Caml.Printf.sprintf "%s\n" [%plop.Truc]
[%%expect{|
-- : string = "Truc\n"
+Line _, characters 8-27:
+Error: Unbound module Caml
|}]
let _ = Caml.Printf.sprintf "%s\n" [%plop.Truc.Bidule]
[%%expect{|
-- : string = "Truc.Bidule\n"
+Line _, characters 8-27:
+Error: Unbound module Caml
|}]
patdiff (internal) (exit 1)
(cd _build/default && /usr/bin/patdiff -keep-whitespace -location-style omake -ascii test/driver/attributes/test.ml test/driver/attributes/test.ml.corrected)
-test/driver/attributes/test.ml
+test/driver/attributes/test.ml.corrected
File "test/driver/attributes/test.ml", line 11, characters 0-1:
#use "topfind";;
#require "base";;
open Base
open Ppxlib
let () = Driver.enable_checks ()
let x = 1 [@@foo]
[%%expect{|
-Line _, characters 13-16:
-Error: Attribute `foo' was not used
+Unknown directive `require'.
+Line _, characters 5-9:
+Error: Unbound module Base
+Line _, characters 30-32:
+Error: This expression has type unit but an expression was expected of type
+ Ppxlib__Import.unit
+val x : int = 1
|}]
let f x = 1 [@@deprecatd "..."]
[%%expect{|
-Line _, characters 15-24:
-Error: Attribute `deprecatd' was not used.
-Hint: Did you mean deprecated?
+Line _, characters 6-7:
+Error (warning 27): unused variable x.
|}]
let attr : _ Attribute.t =
Attribute.declare "blah"
Attribute.Context.type_declaration
Ast_pattern.(__)
ignore
[%%expect{|
-val attr : (type_declaration, unit) Attribute.t = <abstr>
+Line _, characters 20-26:
+Error: This expression has type string but an expression was expected of type
+ Ppxlib__Import.string
|}]
type t = int [@blah]
[%%expect{|
-Line _, characters 15-19:
-Error: Attribute `blah' was not used.
-Hint: `blah' is available for type declarations but is used here in the
-context of a core type.
-Did you put it at the wrong level?
+type t = int
|}]
let attr : _ Attribute.t =
Attribute.declare "blah"
Attribute.Context.expression
Ast_pattern.(__)
ignore
[%%expect{|
-val attr : (expression, unit) Attribute.t = <abstr>
+Line _, characters 20-26:
+Error: This expression has type string but an expression was expected of type
+ Ppxlib__Import.string
|}]
type t = int [@blah]
[%%expect{|
-Line _, characters 15-19:
-Error: Attribute `blah' was not used.
-Hint: `blah' is available for expressions and type declarations but is used
-here in the context of a core type.
-Did you put it at the wrong level?
+type t = int
|}]
(* Attribute drops *)
let faulty_transformation = object
inherit Ast_traverse.map as super
method! expression e =
match e.pexp_desc with
| Pexp_constant c ->
Ast_builder.Default.pexp_constant ~loc:e.pexp_loc c
| _ -> super#expression e
end
[%%expect{|
val faulty_transformation : Ast_traverse.map = <obj>
|}]
let () =
Driver.register_transformation "faulty" ~impl:faulty_transformation#structure
let x = (42 [@foo])
[%%expect{|
-Line _, characters 14-17:
-Error: Attribute `foo' was silently dropped
+Line _, characters 33-41:
+Error: This expression has type string but an expression was expected of type
+ Ppxlib__Import.string
+val x : t = 42
|}]
type t1 = < >
type t2 = < t1 >
type t3 = < (t1[@foo]) >
[%%expect{|
type t1 = < >
type t2 = < >
-Line _, characters 17-20:
-Error: Attribute `foo' was not used
+type t3 = < >
|}]
------------------------------------------------------------------------------------------
Fri 16 Aug 2019 07:00:31 PM EDT
exited abnormally with code 1