Skip to content

Commit 76ea131

Browse files
committed
refactor
1 parent e6f9d7c commit 76ea131

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

jscomp/ml/typecore.ml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ let build_or_pat_for_variant_spread env loc lid expected_ty =
597597
match decl with
598598
| {type_kind = Type_variant constructors; type_params} -> (
599599
if List.length type_params > 0 then raise (Error (lid.loc, env, Type_params_not_supported lid.txt));
600-
let ty = newty (Tconstr (path, [], ref Mnil)) in
600+
let ty = newgenty (Tconstr (path, [], ref Mnil)) in
601601
(try
602602
Ctype.subtype env ty expected_ty ()
603603
with
@@ -613,7 +613,7 @@ let build_or_pat_for_variant_spread env loc lid expected_ty =
613613
{
614614
pat_desc =
615615
Tpat_construct
616-
( {loc = Location.none; txt = lid},
616+
( {loc = c.cd_loc; txt = lid},
617617
Env.lookup_constructor ~loc:c.cd_loc lid env,
618618
match c.cd_args with
619619
| Cstr_tuple [] -> []
@@ -633,7 +633,8 @@ let build_or_pat_for_variant_spread env loc lid expected_ty =
633633
pat_type = expected_ty;
634634
pat_env = env;
635635
pat_attributes = [];
636-
})
636+
})
637+
|> List.rev
637638
in
638639
match pats with
639640
| [] -> raise (Error (lid.loc, env, Not_a_variant_type lid.txt))
@@ -642,7 +643,7 @@ let build_or_pat_for_variant_spread env loc lid expected_ty =
642643
List.fold_left
643644
(fun pat pat0 ->
644645
{
645-
Typedtree.pat_desc = Tpat_or (pat0, pat, None);
646+
Typedtree.pat_desc = Tpat_or (pat, pat0, None);
646647
pat_extra = [];
647648
pat_loc = gloc;
648649
pat_env = env;

0 commit comments

Comments
 (0)