Skip to content

Commit 9d5144f

Browse files
committed
Restore original variant names.
1 parent 9e5876e commit 9d5144f

32 files changed

+341
-304
lines changed

analysis/src/CompletionFrontEnd.ml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,8 @@ let rec exprToContextPathInner (e : Parsetree.expression) =
268268
(* Transform away pipe with apply call *)
269269
exprToContextPath
270270
{
271-
pexp_desc = Pexp_apply {funct = d; args = (Nolbl, lhs) :: args; partial};
271+
pexp_desc =
272+
Pexp_apply {funct = d; args = (Nolabel, lhs) :: args; partial};
272273
pexp_loc;
273274
pexp_attributes;
274275
}
@@ -288,7 +289,7 @@ let rec exprToContextPathInner (e : Parsetree.expression) =
288289
Pexp_apply
289290
{
290291
funct = {pexp_desc = Pexp_ident id; pexp_loc; pexp_attributes};
291-
args = [(Nolbl, lhs)];
292+
args = [(Nolabel, lhs)];
292293
partial;
293294
};
294295
pexp_loc;
@@ -1436,7 +1437,7 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor
14361437
| Some (ctxPath, currentUnlabelledCount) ->
14371438
(processingFun :=
14381439
match lbl with
1439-
| Nolbl -> Some (ctxPath, currentUnlabelledCount + 1)
1440+
| Nolabel -> Some (ctxPath, currentUnlabelledCount + 1)
14401441
| _ -> Some (ctxPath, currentUnlabelledCount));
14411442
if Debug.verbose () then
14421443
print_endline "[expr_iter] Completing for argument value";
@@ -1446,10 +1447,10 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor
14461447
functionContextPath = ctxPath;
14471448
argumentLabel =
14481449
(match lbl with
1449-
| Nolbl ->
1450+
| Nolabel ->
14501451
Unlabelled {argumentPosition = currentUnlabelledCount}
1451-
| Opt {txt = name} -> Optional name
1452-
| Lbl {txt = name} -> Labelled name);
1452+
| Optional {txt = name} -> Optional name
1453+
| Labelled {txt = name} -> Labelled name);
14531454
})
14541455
in
14551456
(match defaultExpOpt with

analysis/src/CompletionJsx.ml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,14 +465,15 @@ let extractJsxProps ~(compName : Longident.t Location.loc) ~args =
465465
in
466466
let rec processProps ~acc args =
467467
match args with
468-
| (Asttypes.Lbl {txt = "children"}, {Parsetree.pexp_loc}) :: _ ->
468+
| (Asttypes.Labelled {txt = "children"}, {Parsetree.pexp_loc}) :: _ ->
469469
{
470470
compName;
471471
props = List.rev acc;
472472
childrenStart =
473473
(if pexp_loc.loc_ghost then None else Some (Loc.start pexp_loc));
474474
}
475-
| ((Lbl {txt = s; loc} | Opt {txt = s; loc}), (eProp : Parsetree.expression))
475+
| ( (Labelled {txt = s; loc} | Optional {txt = s; loc}),
476+
(eProp : Parsetree.expression) )
476477
:: rest -> (
477478
let namedArgLoc = if loc = Location.none then None else Some loc in
478479
match namedArgLoc with

analysis/src/DumpAst.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,9 @@ and printExprItem expr ~pos ~indentation =
218218
^ addIndentation (indentation + 1)
219219
^ "arg: "
220220
^ (match arg with
221-
| Nolbl -> "Nolabel"
222-
| Lbl {txt = name} -> "Labelled(" ^ name ^ ")"
223-
| Opt {txt = name} -> "Optional(" ^ name ^ ")")
221+
| Nolabel -> "Nolabel"
222+
| Labelled {txt = name} -> "Labelled(" ^ name ^ ")"
223+
| Optional {txt = name} -> "Optional(" ^ name ^ ")")
224224
^ ",\n"
225225
^ addIndentation (indentation + 2)
226226
^ "pattern: "

analysis/src/SemanticTokens.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ let command ~debug ~emitter ~path =
266266

267267
let posOfGreatherthanAfterProps =
268268
let rec loop = function
269-
| (Asttypes.Lbl {txt = "children"}, {Parsetree.pexp_loc}) :: _ ->
269+
| (Asttypes.Labelled {txt = "children"}, {Parsetree.pexp_loc}) :: _ ->
270270
Loc.start pexp_loc
271271
| _ :: args -> loop args
272272
| [] -> (* should not happen *) (-1, -1)

analysis/src/SharedTypes.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,7 @@ type arg = {label: label; exp: Parsetree.expression}
898898
let extractExpApplyArgs ~args =
899899
let rec processArgs ~acc args =
900900
match args with
901-
| ( ((Asttypes.Lbl {txt = s; loc} | Opt {txt = s; loc}) as label),
901+
| ( ((Asttypes.Labelled {txt = s; loc} | Optional {txt = s; loc}) as label),
902902
(e : Parsetree.expression) )
903903
:: rest -> (
904904
let namedArgLoc = if loc = Location.none then None else Some loc in
@@ -909,15 +909,15 @@ let extractExpApplyArgs ~args =
909909
name = s;
910910
opt =
911911
(match label with
912-
| Opt _ -> true
912+
| Optional _ -> true
913913
| _ -> false);
914914
posStart = Loc.start loc;
915915
posEnd = Loc.end_ loc;
916916
}
917917
in
918918
processArgs ~acc:({label = Some labelled; exp = e} :: acc) rest
919919
| None -> processArgs ~acc rest)
920-
| (Nolbl, (e : Parsetree.expression)) :: rest ->
920+
| (Nolabel, (e : Parsetree.expression)) :: rest ->
921921
if e.pexp_loc.loc_ghost then processArgs ~acc rest
922922
else processArgs ~acc:({label = None; exp = e} :: acc) rest
923923
| [] -> List.rev acc

analysis/src/SignatureHelp.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ let extractParameters ~signature ~typeStrForParser ~labelPrefixLen =
130130
(* The AST locations does not account for "=?" of optional arguments, so add that to the offset here if needed. *)
131131
let endOffset =
132132
match argumentLabel with
133-
| Asttypes.Opt _ -> endOffset + 2
133+
| Asttypes.Optional _ -> endOffset + 2
134134
| _ -> endOffset
135135
in
136136
extractParams nextFunctionExpr

analysis/src/TypeUtils.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -941,7 +941,7 @@ module Codegen = struct
941941
let mkFailWithExp () =
942942
Ast_helper.Exp.apply
943943
(Ast_helper.Exp.ident {txt = Lident "failwith"; loc = Location.none})
944-
[(Nolbl, Ast_helper.Exp.constant (Pconst_string ("TODO", None)))]
944+
[(Nolabel, Ast_helper.Exp.constant (Pconst_string ("TODO", None)))]
945945

946946
let mkConstructPat ?payload name =
947947
Ast_helper.Pat.construct

analysis/src/Xform.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ module IfThenElse = struct
9595
Pexp_ident
9696
{txt = Longident.Lident (("==" | "!=") as op)};
9797
};
98-
args = [(Nolbl, arg1); (Nolbl, arg2)];
98+
args = [(Nolabel, arg1); (Nolabel, arg2)];
9999
};
100100
},
101101
e1,
@@ -300,7 +300,7 @@ module AddTypeAnnotation = struct
300300
match e.pexp_desc with
301301
| Pexp_fun {arg_label; lhs = pat; rhs = e} ->
302302
let isUnlabeledOnlyArg =
303-
argNum = 1 && arg_label = Nolbl
303+
argNum = 1 && arg_label = Nolabel
304304
&&
305305
match e.pexp_desc with
306306
| Pexp_fun _ -> false

compiler/frontend/ast_compatible.ml

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ open Parsetree
3131
let default_loc = Location.none
3232

3333
let arrow ?loc ?attrs ~arity a b =
34-
Ast_helper.Typ.arrow ?loc ?attrs ~arity Nolbl a b
34+
Ast_helper.Typ.arrow ?loc ?attrs ~arity Nolabel a b
3535

3636
let apply_simple ?(loc = default_loc) ?(attrs = []) (fn : expression)
3737
(args : expression list) : expression =
@@ -42,7 +42,7 @@ let apply_simple ?(loc = default_loc) ?(attrs = []) (fn : expression)
4242
Pexp_apply
4343
{
4444
funct = fn;
45-
args = Ext_list.map args (fun x -> (Asttypes.Nolbl, x));
45+
args = Ext_list.map args (fun x -> (Asttypes.Nolabel, x));
4646
partial = false;
4747
};
4848
}
@@ -51,7 +51,8 @@ let app1 ?(loc = default_loc) ?(attrs = []) fn arg1 : expression =
5151
{
5252
pexp_loc = loc;
5353
pexp_attributes = attrs;
54-
pexp_desc = Pexp_apply {funct = fn; args = [(Nolbl, arg1)]; partial = false};
54+
pexp_desc =
55+
Pexp_apply {funct = fn; args = [(Nolabel, arg1)]; partial = false};
5556
}
5657

5758
let app2 ?(loc = default_loc) ?(attrs = []) fn arg1 arg2 : expression =
@@ -60,7 +61,7 @@ let app2 ?(loc = default_loc) ?(attrs = []) fn arg1 arg2 : expression =
6061
pexp_attributes = attrs;
6162
pexp_desc =
6263
Pexp_apply
63-
{funct = fn; args = [(Nolbl, arg1); (Nolbl, arg2)]; partial = false};
64+
{funct = fn; args = [(Nolabel, arg1); (Nolabel, arg2)]; partial = false};
6465
}
6566

6667
let app3 ?(loc = default_loc) ?(attrs = []) fn arg1 arg2 arg3 : expression =
@@ -71,7 +72,7 @@ let app3 ?(loc = default_loc) ?(attrs = []) fn arg1 arg2 arg3 : expression =
7172
Pexp_apply
7273
{
7374
funct = fn;
74-
args = [(Nolbl, arg1); (Nolbl, arg2); (Nolbl, arg3)];
75+
args = [(Nolabel, arg1); (Nolabel, arg2); (Nolabel, arg3)];
7576
partial = false;
7677
};
7778
}
@@ -82,7 +83,14 @@ let fun_ ?(loc = default_loc) ?(attrs = []) ?(async = false) ~arity pat exp =
8283
pexp_attributes = attrs;
8384
pexp_desc =
8485
Pexp_fun
85-
{arg_label = Nolbl; default = None; lhs = pat; rhs = exp; arity; async};
86+
{
87+
arg_label = Nolabel;
88+
default = None;
89+
lhs = pat;
90+
rhs = exp;
91+
arity;
92+
async;
93+
};
8694
}
8795

8896
let const_exp_string ?(loc = default_loc) ?(attrs = []) ?delimiter (s : string)
@@ -111,7 +119,7 @@ let apply_labels ?(loc = default_loc) ?(attrs = []) fn
111119
funct = fn;
112120
args =
113121
Ext_list.map args (fun (l, a) ->
114-
(Asttypes.Lbl {txt = l; loc = Location.none}, a));
122+
(Asttypes.Labelled {txt = l; loc = Location.none}, a));
115123
partial = false;
116124
};
117125
}
@@ -120,7 +128,8 @@ let label_arrow ?(loc = default_loc) ?(attrs = []) ~arity txt arg ret :
120128
core_type =
121129
{
122130
ptyp_desc =
123-
Ptyp_arrow {lbl = Asttypes.Lbl {txt; loc = default_loc}; arg; ret; arity};
131+
Ptyp_arrow
132+
{lbl = Asttypes.Labelled {txt; loc = default_loc}; arg; ret; arity};
124133
ptyp_loc = loc;
125134
ptyp_attributes = attrs;
126135
}
@@ -129,7 +138,8 @@ let opt_arrow ?(loc = default_loc) ?(attrs = []) ~arity txt arg ret : core_type
129138
=
130139
{
131140
ptyp_desc =
132-
Ptyp_arrow {lbl = Asttypes.Opt {txt; loc = default_loc}; arg; ret; arity};
141+
Ptyp_arrow
142+
{lbl = Asttypes.Optional {txt; loc = default_loc}; arg; ret; arity};
133143
ptyp_loc = loc;
134144
ptyp_attributes = attrs;
135145
}

compiler/frontend/ast_core_type.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,5 +171,5 @@ let list_of_arrow (ty : t) : t * param_type list =
171171
let add_last_obj (ty : t) (obj : t) =
172172
let result, params = list_of_arrow ty in
173173
mk_fn_type
174-
(params @ [{label = Nolbl; ty = obj; attr = []; loc = obj.ptyp_loc}])
174+
(params @ [{label = Nolabel; ty = obj; attr = []; loc = obj.ptyp_loc}])
175175
result

0 commit comments

Comments
 (0)