@@ -189,7 +189,6 @@ type argument = {
189
189
}
190
190
191
191
type type_parameter = {
192
- dotted : bool ;
193
192
attrs : Ast_helper .attrs ;
194
193
label : Asttypes .arg_label ;
195
194
typ : Parsetree .core_type ;
@@ -386,8 +385,7 @@ let build_longident words =
386
385
387
386
let make_infix_operator (p : Parser.t ) token start_pos end_pos =
388
387
let stringified_token =
389
- if token = Token. MinusGreater then
390
- if p.uncurried_config = Legacy then " |." else " |.u"
388
+ if token = Token. MinusGreater then " |.u"
391
389
else if token = Token. PlusPlus then " ^"
392
390
else if token = Token. BangEqual then " <>"
393
391
else if token = Token. BangEqualEqual then " !="
@@ -519,7 +517,7 @@ let wrap_type_annotation ~loc newtypes core_type body =
519
517
* return a wrapping function that wraps ((__x) => ...) around an expression
520
518
* e.g. foo(_, 3) becomes (__x) => foo(__x, 3)
521
519
*)
522
- let process_underscore_application ( p : Parser.t ) args =
520
+ let process_underscore_application args =
523
521
let exp_question = ref None in
524
522
let hidden_var = " __x" in
525
523
let check_arg ((lab , exp ) as arg ) =
@@ -541,8 +539,7 @@ let process_underscore_application (p : Parser.t) args =
541
539
~loc: Location. none
542
540
in
543
541
let fun_expr = Ast_helper.Exp. fun_ ~loc Nolabel None pattern exp_apply in
544
- if p.uncurried_config = Legacy then fun_expr
545
- else Ast_uncurried. uncurried_fun ~loc ~arity: 1 fun_expr
542
+ Ast_uncurried. uncurried_fun ~loc ~arity: 1 fun_expr
546
543
| None -> exp_apply
547
544
in
548
545
(args, wrap)
@@ -1571,53 +1568,17 @@ and parse_es6_arrow_expression ?(arrow_attrs = []) ?(arrow_start_pos = None)
1571
1568
| TermParameter _ -> true
1572
1569
| TypeParameter _ -> false )
1573
1570
in
1574
- let body_needs_braces =
1575
- let is_fun =
1576
- match body.pexp_desc with
1577
- | Pexp_fun _ -> true
1578
- | _ -> false
1579
- in
1580
- match term_parameters with
1581
- | TermParameter {dotted} :: _
1582
- when p.uncurried_config |> Res_uncurried. from_dotted ~dotted && is_fun ->
1583
- true
1584
- | TermParameter _ :: rest when p.uncurried_config = Legacy && is_fun ->
1585
- rest
1586
- |> List. exists (function
1587
- | TermParameter {dotted} -> dotted
1588
- | _ -> false )
1589
- | _ -> false
1590
- in
1591
- let body =
1592
- if body_needs_braces then
1593
- {
1594
- body with
1595
- pexp_attributes = make_braces_attr body.pexp_loc :: body .pexp_attributes;
1596
- }
1597
- else body
1598
- in
1599
1571
let _paramNum, arrow_expr, _arity =
1600
1572
List. fold_right
1601
1573
(fun parameter (term_param_num , expr , arity ) ->
1602
1574
match parameter with
1603
1575
| TermParameter
1604
- {
1605
- dotted;
1606
- attrs;
1607
- label = lbl;
1608
- expr = default_expr;
1609
- pat;
1610
- pos = start_pos;
1611
- } ->
1576
+ {attrs; label = lbl; expr = default_expr; pat; pos = start_pos} ->
1612
1577
let loc = mk_loc start_pos end_pos in
1613
1578
let fun_expr =
1614
1579
Ast_helper.Exp. fun_ ~loc ~attrs lbl default_expr pat expr
1615
1580
in
1616
- let uncurried =
1617
- p.uncurried_config |> Res_uncurried. from_dotted ~dotted
1618
- in
1619
- if uncurried && (term_param_num = 1 || p.uncurried_config = Legacy )
1620
- then
1581
+ if term_param_num = 1 then
1621
1582
( term_param_num - 1 ,
1622
1583
Ast_uncurried. uncurried_fun ~loc ~arity fun_expr,
1623
1584
1 )
@@ -2257,10 +2218,9 @@ and parse_binary_expr ?(context = OrdinaryExpr) ?a p prec =
2257
2218
let loc = mk_loc a.Parsetree. pexp_loc.loc_start b.pexp_loc.loc_end in
2258
2219
let expr =
2259
2220
match (token, b.pexp_desc) with
2260
- | BarGreater , Pexp_apply (fun_expr, args)
2261
- when p.uncurried_config = Uncurried ->
2221
+ | BarGreater , Pexp_apply (fun_expr , args ) ->
2262
2222
{b with pexp_desc = Pexp_apply (fun_expr, args @ [(Nolabel , a)])}
2263
- | BarGreater , _ when p.uncurried_config = Uncurried ->
2223
+ | BarGreater , _ ->
2264
2224
Ast_helper.Exp. apply ~loc ~attrs: [uncurried_app_attr] b [(Nolabel , a)]
2265
2225
| _ ->
2266
2226
Ast_helper.Exp. apply ~loc
@@ -3788,13 +3748,10 @@ and parse_call_expr p fun_expr =
3788
3748
in
3789
3749
let apply =
3790
3750
Ext_list. fold_left args fun_expr (fun call_body group ->
3791
- let dotted , args = group in
3792
- let args, wrap = process_underscore_application p args in
3751
+ let _ , args = group in
3752
+ let args, wrap = process_underscore_application args in
3793
3753
let exp =
3794
- let uncurried =
3795
- p.uncurried_config |> Res_uncurried. from_dotted ~dotted
3796
- in
3797
- let attrs = if uncurried then [uncurried_app_attr] else [] in
3754
+ let attrs = [uncurried_app_attr] in
3798
3755
let attrs = if is_partial then res_partial_attr :: attrs else attrs in
3799
3756
Ast_helper.Exp. apply ~loc ~attrs call_body args
3800
3757
in
@@ -4064,8 +4021,7 @@ and parse_poly_type_expr p =
4064
4021
let t_fun =
4065
4022
Ast_helper.Typ. arrow ~loc Asttypes. Nolabel typ return_type
4066
4023
in
4067
- if p.uncurried_config = Legacy then t_fun
4068
- else Ast_uncurried. uncurried_type ~loc ~arity: 1 t_fun
4024
+ Ast_uncurried. uncurried_type ~loc ~arity: 1 t_fun
4069
4025
| _ -> Ast_helper.Typ. var ~loc: var.loc var.txt)
4070
4026
| _ -> assert false )
4071
4027
| _ -> parse_typ_expr p
@@ -4285,7 +4241,7 @@ and parse_type_parameter p =
4285
4241
|| Grammar. is_typ_expr_start p.token
4286
4242
then
4287
4243
let start_pos = p.Parser. start_pos in
4288
- let dotted = Parser. optional p Dot in
4244
+ let _ = Parser. optional p Dot (* dot is ignored *) in
4289
4245
let attrs = doc_attr @ parse_attributes p in
4290
4246
match p.Parser. token with
4291
4247
| Tilde -> (
@@ -4303,8 +4259,8 @@ and parse_type_parameter p =
4303
4259
| Equal ->
4304
4260
Parser. next p;
4305
4261
Parser. expect Question p;
4306
- Some {dotted; attrs; label = Optional name; typ; start_pos}
4307
- | _ -> Some {dotted; attrs; label = Labelled name; typ; start_pos})
4262
+ Some {attrs; label = Optional name; typ; start_pos}
4263
+ | _ -> Some {attrs; label = Labelled name; typ; start_pos})
4308
4264
| Lident _ -> (
4309
4265
let name, loc = parse_lident p in
4310
4266
match p.token with
@@ -4322,8 +4278,8 @@ and parse_type_parameter p =
4322
4278
| Equal ->
4323
4279
Parser. next p;
4324
4280
Parser. expect Question p;
4325
- Some {dotted; attrs; label = Optional name; typ; start_pos}
4326
- | _ -> Some {dotted; attrs; label = Labelled name; typ; start_pos})
4281
+ Some {attrs; label = Optional name; typ; start_pos}
4282
+ | _ -> Some {attrs; label = Labelled name; typ; start_pos})
4327
4283
| _ ->
4328
4284
let constr = Location. mkloc (Longident. Lident name) loc in
4329
4285
let args = parse_type_constructor_args ~constr_name: constr p in
@@ -4335,20 +4291,13 @@ and parse_type_parameter p =
4335
4291
4336
4292
let typ = parse_arrow_type_rest ~es6_arrow: true ~start_pos typ p in
4337
4293
let typ = parse_type_alias p typ in
4338
- Some {dotted; attrs = [] ; label = Nolabel ; typ; start_pos})
4294
+ Some {attrs = [] ; label = Nolabel ; typ; start_pos})
4339
4295
| _ ->
4340
4296
let typ = parse_typ_expr p in
4341
4297
let typ_with_attributes =
4342
4298
{typ with ptyp_attributes = List. concat [attrs; typ.ptyp_attributes]}
4343
4299
in
4344
- Some
4345
- {
4346
- dotted;
4347
- attrs = [] ;
4348
- label = Nolabel ;
4349
- typ = typ_with_attributes;
4350
- start_pos;
4351
- }
4300
+ Some {attrs = [] ; label = Nolabel ; typ = typ_with_attributes; start_pos}
4352
4301
else None
4353
4302
4354
4303
(* (int, ~x:string, float) *)
@@ -4361,7 +4310,7 @@ and parse_type_parameters p =
4361
4310
let loc = mk_loc start_pos p.prev_end_pos in
4362
4311
let unit_constr = Location. mkloc (Longident. Lident " unit" ) loc in
4363
4312
let typ = Ast_helper.Typ. constr unit_constr [] in
4364
- [{dotted = false ; attrs = [] ; label = Nolabel ; typ; start_pos}]
4313
+ [{attrs = [] ; label = Nolabel ; typ; start_pos}]
4365
4314
| _ ->
4366
4315
let params =
4367
4316
parse_comma_delimited_region ~grammar: Grammar. TypeParameters
@@ -4402,23 +4351,10 @@ and parse_es6_arrow_type ~attrs p =
4402
4351
Parser. expect EqualGreater p;
4403
4352
let return_type = parse_typ_expr ~alias: false p in
4404
4353
let end_pos = p.prev_end_pos in
4405
- let return_type_arity =
4406
- match parameters with
4407
- | _ when p.uncurried_config <> Legacy -> 0
4408
- | _ ->
4409
- if parameters |> List. exists (function {dotted; typ = _ } -> dotted)
4410
- then 0
4411
- else
4412
- let _, args, _ = Res_parsetree_viewer. arrow_type return_type in
4413
- List. length args
4414
- in
4354
+ let return_type_arity = 0 in
4415
4355
let _paramNum, typ, _arity =
4416
4356
List. fold_right
4417
- (fun {dotted; attrs; label = arg_lbl ; typ; start_pos}
4418
- (param_num , t , arity ) ->
4419
- let uncurried =
4420
- p.uncurried_config |> Res_uncurried. from_dotted ~dotted
4421
- in
4357
+ (fun {attrs; label = arg_lbl ; typ; start_pos} (param_num , t , arity ) ->
4422
4358
let loc = mk_loc start_pos end_pos in
4423
4359
let arity =
4424
4360
(* Workaround for ~lbl: @as(json`false`) _, which changes the arity *)
@@ -4437,7 +4373,7 @@ and parse_es6_arrow_type ~attrs p =
4437
4373
| _ -> arity
4438
4374
in
4439
4375
let t_arg = Ast_helper.Typ. arrow ~loc ~attrs arg_lbl typ t in
4440
- if uncurried && ( param_num = 1 || p.uncurried_config = Legacy ) then
4376
+ if param_num = 1 then
4441
4377
(param_num - 1 , Ast_uncurried. uncurried_type ~loc ~arity t_arg, 1 )
4442
4378
else (param_num - 1 , t_arg, arity + 1 ))
4443
4379
parameters
@@ -4498,8 +4434,7 @@ and parse_arrow_type_rest ~es6_arrow ~start_pos typ p =
4498
4434
let arrow_typ =
4499
4435
Ast_helper.Typ. arrow ~loc Asttypes. Nolabel typ return_type
4500
4436
in
4501
- if p.uncurried_config = Legacy then arrow_typ
4502
- else Ast_uncurried. uncurried_type ~loc ~arity: 1 arrow_typ
4437
+ Ast_uncurried. uncurried_type ~loc ~arity: 1 arrow_typ
4503
4438
| _ -> typ
4504
4439
4505
4440
and parse_typ_expr_region p =
@@ -5112,12 +5047,10 @@ and parse_type_equation_or_constr_decl p =
5112
5047
let arrow_type =
5113
5048
Ast_helper.Typ. arrow ~loc Asttypes. Nolabel typ return_type
5114
5049
in
5115
- let uncurried = p.uncurried_config <> Legacy in
5116
5050
let arrow_type =
5117
- if uncurried then
5118
- Ast_uncurried. uncurried_type ~loc ~arity: 1 arrow_type
5119
- else arrow_type
5051
+ Ast_uncurried. uncurried_type ~loc ~arity: 1 arrow_type
5120
5052
in
5053
+
5121
5054
let typ = parse_type_alias p arrow_type in
5122
5055
(Some typ, Asttypes. Public , Parsetree. Ptype_abstract )
5123
5056
| _ -> (Some typ, Asttypes. Public , Parsetree. Ptype_abstract ))
@@ -6668,13 +6601,6 @@ and parse_standalone_attribute p =
6668
6601
let start_pos = p.start_pos in
6669
6602
Parser. expect AtAt p;
6670
6603
let attr_id = parse_attribute_id ~start_pos p in
6671
- let attr_id =
6672
- match attr_id.txt with
6673
- | "uncurried" ->
6674
- p.uncurried_config < - Config. Uncurried ;
6675
- attr_id
6676
- | _ -> attr_id
6677
- in
6678
6604
let payload = parse_payload p in
6679
6605
(attr_id, payload)
6680
6606
0 commit comments