Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Thierry Martinez
override
Commits
b66c59df
Commit
b66c59df
authored
Jul 01, 2019
by
Thierry Martinez
Browse files
Fix examples for using ppx_show/ppx_compare instead of ppx_deriving
parent
71cf58f8
Pipeline
#85198
passed with stages
in 41 minutes and 19 seconds
Changes
7
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
examples/longident_show/dune
View file @
b66c59df
(executable
(name longident_show)
(preprocess (staged_pps override ppx_
deriving.
show))
(libraries compiler-libs.common))
(preprocess (staged_pps override ppx_show))
(libraries compiler-libs.common
ppx_show.runtime
))
examples/longident_show/longident_show.ml
View file @
b66c59df
...
...
@@ -7,7 +7,7 @@ end
let
test
()
=
assert
(
Longident
.
show
(
Longident
.
parse
"Foo.Bar.baz"
)
=
{
|
(
Longident
.
Ldot
(
(
Longident
.
Ldot
((
Longident
.
Lident
"Foo"
)
,
"Bar"
)
)
,
"baz"
)
)
|
}
{
|
Longident
.
Ldot
(
Longident
.
Ldot
((
Longident
.
Lident
"Foo"
)
,
"Bar"
)
,
"baz"
)
|
}
)
...
...
examples/package_type/dune
View file @
b66c59df
(executable
(name package_type)
(preprocess (staged_pps override ppxlib.metaquot ppx_
deriving.
show))
(libraries compiler-libs.common))
(preprocess (staged_pps override ppxlib.metaquot ppx_show))
(libraries compiler-libs.common
ppx_show.runtime
))
examples/package_type/package_type.ml
View file @
b66c59df
...
...
@@ -29,10 +29,13 @@
type
package_type
=
_
[
@@
deriving
show
]
end
]
let
core_type_of_string
s
=
let
lexbuf
=
Lexing
.
from_string
s
in
Parser
.
parse_core_type
Lexer
.
token
lexbuf
let
test
()
=
let
loc
=
Location
.
none
in
let
ptyp
=
match
([
%
type
:
(
module
S
with
type
t1
=
t2
)
]
:
Parsetree
.
core_type
)
with
match
core_type_of_string
{
|
(
module
S
with
type
t1
=
t2
)
|
}
with
|
{
ptyp_desc
=
Ptyp_package
ptyp
;
_
}
->
ptyp
|
_
->
assert
false
in
assert
(
show_package_type
ptyp
=
"(S, [(t1, t2)])"
)
...
...
examples/ppxlib_ast/dune
View file @
b66c59df
(executable
(name ppxlib_ast)
(preprocess (staged_pps override ppxlib.metaquot ppx_
deriving.eq
))
(preprocess (staged_pps override ppxlib.metaquot ppx_
compare
))
(libraries compiler-libs.common))
(rule
...
...
examples/ppxlib_ast/ppxlib_ast.cppo.ml
View file @
b66c59df
...
...
@@ -2,6 +2,8 @@
described in the comments of
https://github.com/ocaml-ppx/ppxlib/blob/master/ast/ast.ml *)
open
Ppx_compare_lib
.
Builtin
(* "- replacing app [type ...] by [and ...] to make everything one
recursive block" *)
[
%%
recursive
...
...
@@ -60,11 +62,16 @@ recursive block" *)
end
[
%%
print_rewrite_system
]]
[
@@
deriving
eq
]
[
@@
deriving
equal
]
let
structure_of_string
s
=
let
lexbuf
=
Lexing
.
from_string
s
in
Parser
.
implementation
Lexer
.
token
lexbuf
let
test
()
=
let
loc
=
Location
.
none
in
assert
(
equal_structure
[
%
str
(
1
,
2
)]
[
%
str
(
1
,
2
)]);
assert
(
not
(
equal_structure
[
%
str
(
1
,
"a"
)]
[
%
str
(
1
,
"b"
)]))
assert
(
equal_structure
(
structure_of_string
"(1, 2)"
)
(
structure_of_string
"(1, 2)"
));
assert
(
not
(
equal_structure
(
structure_of_string
{
|
(
1
,
"a"
)
|
})
(
structure_of_string
{
|
(
1
,
"b"
)
|
})))
let
()
=
test
()
examples/typedtree_collect_texp_apply/typedtree_collect_texp_apply.cppo.ml
View file @
b66c59df
...
...
@@ -100,6 +100,7 @@ let collector =
method
env
=
any
method
constructor_description
=
any
method
concr
=
any
method
module_presence
=
any
end
let
collect_texp_apply_from_structure
(
structure
:
Typedtree
.
structure
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment