File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -597,7 +597,7 @@ let build_or_pat_for_variant_spread env loc lid expected_ty =
597
597
match decl with
598
598
| {type_kind = Type_variant constructors ; type_params} -> (
599
599
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
601
601
(try
602
602
Ctype. subtype env ty expected_ty ()
603
603
with
@@ -613,7 +613,7 @@ let build_or_pat_for_variant_spread env loc lid expected_ty =
613
613
{
614
614
pat_desc =
615
615
Tpat_construct
616
- ( {loc = Location. none ; txt = lid},
616
+ ( {loc = c.cd_loc ; txt = lid},
617
617
Env. lookup_constructor ~loc: c.cd_loc lid env,
618
618
match c.cd_args with
619
619
| Cstr_tuple [] -> []
@@ -633,7 +633,8 @@ let build_or_pat_for_variant_spread env loc lid expected_ty =
633
633
pat_type = expected_ty;
634
634
pat_env = env;
635
635
pat_attributes = [] ;
636
- })
636
+ })
637
+ |> List. rev
637
638
in
638
639
match pats with
639
640
| [] -> 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 =
642
643
List. fold_left
643
644
(fun pat pat0 ->
644
645
{
645
- Typedtree. pat_desc = Tpat_or (pat0, pat , None );
646
+ Typedtree. pat_desc = Tpat_or (pat, pat0 , None );
646
647
pat_extra = [] ;
647
648
pat_loc = gloc;
648
649
pat_env = env;
You can’t perform that action at this time.
0 commit comments