@@ -2506,15 +2506,11 @@ let_binding_body_no_punning:
25062506 let patloc = ($ startpos($ 1 ), $ endpos($ 2 )) in
25072507 (ghpat ~loc: patloc (Ppat_constraint (v, typ)),
25082508 mkexp_constraint ~loc: $ sloc $ 4 $ 2 ) }
2509- | let_ident COLON typevar_list DOT core_type EQUAL seq_expr
2510- (* TODO: could replace [typevar_list DOT core_type]
2511- with [mktyp(poly(core_type))]
2512- and simplify the semantic action? *)
2513- { let typloc = ($ startpos($ 3 ), $ endpos($ 5 )) in
2514- let patloc = ($ startpos($ 1 ), $ endpos($ 5 )) in
2509+ | let_ident COLON poly(core_type) EQUAL seq_expr
2510+ { let patloc = ($ startpos($ 1 ), $ endpos($ 3 )) in
25152511 (ghpat ~loc: patloc
2516- (Ppat_constraint ($ 1 , ghtyp ~loc: typloc ( Ptyp_poly ($ 3 , $ 5 )) )),
2517- $ 7 ) }
2512+ (Ppat_constraint ($ 1 , ghtyp ~loc: ( $ loc ($ 3 )) $ 3 )),
2513+ $ 5 ) }
25182514 | let_ident COLON TYPE lident_list DOT core_type EQUAL seq_expr
25192515 { let exp, poly =
25202516 wrap_type_annotation ~loc: $ sloc $ 4 $ 6 $ 8 in
@@ -2877,7 +2873,7 @@ value_description:
28772873 attrs1 = attributes
28782874 id = mkrhs(val_ident)
28792875 COLON
2880- ty = core_type
2876+ ty = possibly_poly( core_type)
28812877 attrs2 = post_item_attributes
28822878 { let attrs = attrs1 @ attrs2 in
28832879 let loc = make_loc $ sloc in
@@ -2894,7 +2890,7 @@ primitive_declaration:
28942890 attrs1 = attributes
28952891 id = mkrhs(val_ident)
28962892 COLON
2897- ty = core_type
2893+ ty = possibly_poly( core_type)
28982894 EQUAL
28992895 prim = raw_string+
29002896 attrs2 = post_item_attributes
@@ -3072,20 +3068,20 @@ constructor_declarations:
30723068generic_constructor_declaration(opening):
30733069 opening
30743070 cid = mkrhs(constr_ident)
3075- args_res = generalized_constructor_arguments
3071+ vars_args_res = generalized_constructor_arguments
30763072 attrs = attributes
30773073 {
3078- let args, res = args_res in
3074+ let vars, args, res = vars_args_res in
30793075 let info = symbol_info $ endpos in
30803076 let loc = make_loc $ sloc in
3081- cid, args, res, attrs, loc, info
3077+ cid, vars, args, res, attrs, loc, info
30823078 }
30833079;
30843080% inline constructor_declaration(opening):
30853081 d = generic_constructor_declaration(opening)
30863082 {
3087- let cid, args, res, attrs, loc, info = d in
3088- Type. constructor cid ~args ?res ~attrs ~loc ~info
3083+ let cid, vars, args, res, attrs, loc, info = d in
3084+ Type. constructor cid ~vars ~ args ?res ~attrs ~loc ~info
30893085 }
30903086;
30913087str_exception_declaration:
@@ -3110,28 +3106,33 @@ sig_exception_declaration:
31103106 ext = ext
31113107 attrs1 = attributes
31123108 id = mkrhs(constr_ident)
3113- args_res = generalized_constructor_arguments
3109+ vars_args_res = generalized_constructor_arguments
31143110 attrs2 = attributes
31153111 attrs = post_item_attributes
3116- { let args, res = args_res in
3112+ { let vars, args, res = vars_args_res in
31173113 let loc = make_loc ($ startpos, $ endpos(attrs2)) in
31183114 let docs = symbol_docs $ sloc in
31193115 Te. mk_exception ~attrs
3120- (Te. decl id ~args ?res ~attrs: (attrs1 @ attrs2) ~loc ~docs )
3116+ (Te. decl id ~vars ~ args ?res ~attrs: (attrs1 @ attrs2) ~loc ~docs )
31213117 , ext }
31223118;
31233119% inline let_exception_declaration:
31243120 mkrhs(constr_ident) generalized_constructor_arguments attributes
3125- { let args, res = $ 2 in
3126- Te. decl $ 1 ~args ?res ~attrs: $ 3 ~loc: (make_loc $ sloc) }
3121+ { let vars, args, res = $ 2 in
3122+ Te. decl $ 1 ~vars ~ args ?res ~attrs: $ 3 ~loc: (make_loc $ sloc) }
31273123;
31283124generalized_constructor_arguments:
3129- /* empty*/ { (Pcstr_tuple [] ,None ) }
3130- | OF constructor_arguments { ($ 2 ,None ) }
3125+ /* empty*/ { ([] , Pcstr_tuple [] ,None ) }
3126+ | OF constructor_arguments { ([] , $ 2 ,None ) }
31313127 | COLON constructor_arguments MINUSGREATER atomic_type % prec below_HASH
3132- { ($ 2 ,Some $ 4 ) }
3128+ { ([] ,$ 2 ,Some $ 4 ) }
3129+ | COLON typevar_list DOT constructor_arguments MINUSGREATER atomic_type
3130+ % prec below_HASH
3131+ { ($ 2 ,$ 4 ,Some $ 6 ) }
31333132 | COLON atomic_type % prec below_HASH
3134- { (Pcstr_tuple [] ,Some $ 2 ) }
3133+ { ([] ,Pcstr_tuple [] ,Some $ 2 ) }
3134+ | COLON typevar_list DOT atomic_type % prec below_HASH
3135+ { ($ 2 ,Pcstr_tuple [] ,Some $ 4 ) }
31353136;
31363137
31373138constructor_arguments:
@@ -3196,8 +3197,8 @@ label_declaration_semi:
31963197% inline extension_constructor_declaration(opening):
31973198 d = generic_constructor_declaration(opening)
31983199 {
3199- let cid, args, res, attrs, loc, info = d in
3200- Te. decl cid ~args ?res ~attrs ~loc ~info
3200+ let cid, vars, args, res, attrs, loc, info = d in
3201+ Te. decl cid ~vars ~ args ?res ~attrs ~loc ~info
32013202 }
32023203;
32033204extension_constructor_rebind(opening):
0 commit comments