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 @@ -601,7 +601,7 @@ let build_or_pat_for_variant_spread env loc lid expected_ty =
601
601
match decl with
602
602
| {type_kind = Type_variant constructors ; type_params} -> (
603
603
if List. length type_params > 0 then raise (Error (lid.loc, env, Type_params_not_supported lid.txt));
604
- let ty = newty (Tconstr (path, [] , ref Mnil )) in
604
+ let ty = newgenty (Tconstr (path, [] , ref Mnil )) in
605
605
(try
606
606
Ctype. subtype env ty expected_ty ()
607
607
with
@@ -617,7 +617,7 @@ let build_or_pat_for_variant_spread env loc lid expected_ty =
617
617
{
618
618
pat_desc =
619
619
Tpat_construct
620
- ( {loc = Location. none ; txt = lid},
620
+ ( {loc = c.cd_loc ; txt = lid},
621
621
Env. lookup_constructor ~loc: c.cd_loc lid env,
622
622
match c.cd_args with
623
623
| Cstr_tuple [] -> []
@@ -637,7 +637,8 @@ let build_or_pat_for_variant_spread env loc lid expected_ty =
637
637
pat_type = expected_ty;
638
638
pat_env = env;
639
639
pat_attributes = [] ;
640
- })
640
+ })
641
+ |> List. rev
641
642
in
642
643
match pats with
643
644
| [] -> raise (Error (lid.loc, env, Not_a_variant_type lid.txt))
@@ -646,7 +647,7 @@ let build_or_pat_for_variant_spread env loc lid expected_ty =
646
647
List. fold_left
647
648
(fun pat pat0 ->
648
649
{
649
- Typedtree. pat_desc = Tpat_or (pat0, pat , None );
650
+ Typedtree. pat_desc = Tpat_or (pat, pat0 , None );
650
651
pat_extra = [] ;
651
652
pat_loc = gloc;
652
653
pat_env = env;
You can’t perform that action at this time.
0 commit comments