Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/vendored-omp/src/ast_56.ml
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ module Outcometree = struct

and out_package (*IF_CURRENT = Outcometree.out_package *) = {
opack_path: out_ident;
opack_constraints: (string * out_type) list;
opack_constraints: (string list * out_type) list;
}

and out_variant (*IF_CURRENT = Outcometree.out_variant *) =
Expand Down
2 changes: 1 addition & 1 deletion src/vendored-omp/src/migrate_parsetree_55_56_migrate.ml
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ and (copy_out_package :
{
Ast_56.Outcometree.opack_path = (copy_out_ident opack_path);
Ast_56.Outcometree.opack_constraints =
(List.map (fun x -> let (x0, x1) = x in (x0, (copy_out_type x1)))
(List.map (fun (x0, x1) -> (String.split_on_char '.' x0, copy_out_type x1))
opack_constraints)
}
and (copy_out_variant :
Expand Down
2 changes: 1 addition & 1 deletion src/vendored-omp/src/migrate_parsetree_56_55_migrate.ml
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ and (copy_out_package :
{
Ast_55.Outcometree.opack_path = (copy_out_ident opack_path);
Ast_55.Outcometree.opack_constraints =
(List.map (fun x -> let (x0, x1) = x in (x0, (copy_out_type x1)))
(List.map (fun (x0, x1) -> (String.concat "." x0, copy_out_type x1))
opack_constraints)
}
and (copy_out_variant :
Expand Down
6 changes: 6 additions & 0 deletions test/lib/dune
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,9 @@
(modules fdLeak)
(flags :standard -open StdLabels)
(libraries reason.refmt-lib))

(test
(name packageConstraints)
(modules packageConstraints)
(package reason)
(libraries reason.ocaml-migrate-parsetree))
26 changes: 26 additions & 0 deletions test/lib/packageConstraints.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
module Old = Reason_omp.Ast_55.Outcometree
module New = Reason_omp.Ast_56.Outcometree

let old_package =
Old.Otyp_module
{ opack_path = Oide_ident { printed_name = "S" }
; opack_constraints =
[ "t", Otyp_var (false, "a")
; "M.t", Otyp_var (false, "b")
; "M.N.u", Otyp_var (false, "c")
]
}

let new_package =
New.Otyp_module
{ opack_path = Oide_ident { printed_name = "S" }
; opack_constraints =
[ [ "t" ], Otyp_var (false, "a")
; [ "M"; "t" ], Otyp_var (false, "b")
; [ "M"; "N"; "u" ], Otyp_var (false, "c")
]
}

let () =
assert (Reason_omp.Migrate_55_56.copy_out_type old_package = new_package);
assert (Reason_omp.Migrate_56_55.copy_out_type new_package = old_package)
Loading