Skip to content

Commit 9e5876e

Browse files
committed
Put type without locs inside module Noloc.
1 parent 82ba4a6 commit 9e5876e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+151
-153
lines changed

analysis/reanalyze/src/Arnold.ml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ module ExtendFunctionTable = struct
582582
Texp_apply {funct = {exp_desc = Texp_ident (path, {loc}, _)}; args};
583583
}
584584
when kindOpt <> None ->
585-
let checkArg ((argLabel : Asttypes.arg_label), _argOpt) =
585+
let checkArg ((argLabel : Asttypes.Noloc.arg_label), _argOpt) =
586586
match (argLabel, kindOpt) with
587587
| (Labelled l | Optional l), Some kind ->
588588
kind |> List.for_all (fun {Kind.label} -> label <> l)
@@ -624,7 +624,7 @@ module ExtendFunctionTable = struct
624624
when callee |> FunctionTable.isInFunctionInTable ~functionTable ->
625625
let functionName = Path.name callee in
626626
args
627-
|> List.iter (fun ((argLabel : Asttypes.arg_label), argOpt) ->
627+
|> List.iter (fun ((argLabel : Asttypes.Noloc.arg_label), argOpt) ->
628628
match (argLabel, argOpt |> extractLabelledArgument) with
629629
| Labelled label, Some (path, loc)
630630
when path |> FunctionTable.isInFunctionInTable ~functionTable
@@ -672,7 +672,7 @@ module CheckExpressionWellFormed = struct
672672
->
673673
let functionName = Path.name functionPath in
674674
args
675-
|> List.iter (fun ((argLabel : Asttypes.arg_label), argOpt) ->
675+
|> List.iter (fun ((argLabel : Asttypes.Noloc.arg_label), argOpt) ->
676676
match argOpt |> ExtendFunctionTable.extractLabelledArgument with
677677
| Some (path, loc) -> (
678678
match argLabel with
@@ -761,7 +761,7 @@ module Compile = struct
761761
let argsFromKind =
762762
innerFunctionDefinition.kind
763763
|> List.map (fun (entry : Kind.entry) ->
764-
( Asttypes.Labelled entry.label,
764+
( Asttypes.Noloc.Labelled entry.label,
765765
Some
766766
{
767767
expr with
@@ -785,7 +785,7 @@ module Compile = struct
785785
args
786786
|> List.find_opt (fun arg ->
787787
match arg with
788-
| Asttypes.Labelled s, Some _ -> s = label
788+
| Asttypes.Noloc.Labelled s, Some _ -> s = label
789789
| _ -> false)
790790
in
791791
let argOpt =

analysis/reanalyze/src/DeadValue.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ let processOptionalArgs ~expType ~(locFrom : Location.t) ~locTo ~path args =
104104
| None -> Some false
105105
in
106106
match lbl with
107-
| Asttypes.Optional s when not locFrom.loc_ghost ->
107+
| Asttypes.Noloc.Optional s when not locFrom.loc_ghost ->
108108
if argIsSupplied <> Some false then supplied := s :: !supplied;
109109
if argIsSupplied = None then suppliedMaybe := s :: !suppliedMaybe
110110
| _ -> ());

analysis/src/CompletionBackEnd.ml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,8 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~pos ~env ~exact
952952
(* compute the application of the first label, then the next ones *)
953953
let args = processApply args [label] in
954954
processApply args nextLabels
955-
| (Asttypes.Nolabel, _) :: nextArgs, [Asttypes.Nolabel] -> nextArgs
955+
| (Asttypes.Noloc.Nolabel, _) :: nextArgs, [Asttypes.Noloc.Nolabel] ->
956+
nextArgs
956957
| ((Labelled _, _) as arg) :: nextArgs, [Nolabel] ->
957958
arg :: processApply nextArgs labels
958959
| (Optional _, _) :: nextArgs, [Nolabel] -> processApply nextArgs labels
@@ -1007,9 +1008,9 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~pos ~env ~exact
10071008
synthetic = true;
10081009
contextPath =
10091010
(match cp with
1010-
| CPApply (c, args) -> CPApply (c, args @ [Asttypes.Nolabel])
1011+
| CPApply (c, args) -> CPApply (c, args @ [Asttypes.Noloc.Nolabel])
10111012
| CPId _ when TypeUtils.isFunctionType ~env ~package typ ->
1012-
CPApply (cp, [Asttypes.Nolabel])
1013+
CPApply (cp, [Asttypes.Noloc.Nolabel])
10131014
| _ -> cp);
10141015
id = fieldName;
10151016
inJsx = false;

analysis/src/CompletionFrontEnd.ml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,7 @@ let rec exprToContextPathInner (e : Parsetree.expression) =
299299
| None -> None
300300
| Some contexPath ->
301301
Some
302-
(CPApply
303-
(contexPath, args |> List.map fst |> List.map Asttypes.to_arg_label))
302+
(CPApply (contexPath, args |> List.map fst |> List.map Asttypes.to_noloc))
304303
)
305304
| Pexp_tuple exprs ->
306305
let exprsAsContextPaths = exprs |> List.filter_map exprToContextPath in

analysis/src/CreateInterface.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ let printSignature ~extractor ~signature =
170170
in
171171
let lblName = labelDecl.ld_id |> Ident.name in
172172
let lbl =
173-
if labelDecl.ld_optional then Asttypes.Optional lblName
173+
if labelDecl.ld_optional then Asttypes.Noloc.Optional lblName
174174
else Labelled lblName
175175
in
176176
{

analysis/src/SharedTypes.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ let ident l = l |> List.map str |> String.concat "."
44

55
type path = string list
66

7-
type typedFnArg = Asttypes.arg_label * Types.type_expr
7+
type typedFnArg = Asttypes.Noloc.arg_label * Types.type_expr
88

99
let pathToString (path : path) = path |> String.concat "."
1010

@@ -605,7 +605,7 @@ module Completable = struct
605605
| CPFloat
606606
| CPBool
607607
| CPOption of contextPath
608-
| CPApply of contextPath * Asttypes.arg_label list
608+
| CPApply of contextPath * Asttypes.Noloc.arg_label list
609609
| CPId of {
610610
path: string list;
611611
completionContext: completionContext;
@@ -692,7 +692,7 @@ module Completable = struct
692692
contextPathToString cp ^ "("
693693
^ (labels
694694
|> List.map (function
695-
| Asttypes.Nolabel -> "Nolabel"
695+
| Asttypes.Noloc.Nolabel -> "Nolabel"
696696
| Labelled s -> "~" ^ s
697697
| Optional s -> "?" ^ s)
698698
|> String.concat ", ")

analysis/src/SignatureHelp.ml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,14 +154,14 @@ let findActiveParameter ~argAtCursor ~args =
154154
(* If a function only has one, unlabelled argument, we can safely assume that's active whenever we're in the signature help for that function,
155155
even if we technically didn't find anything at the cursor (which we don't for empty expressions). *)
156156
match args with
157-
| [(Asttypes.Nolabel, _)] -> Some 0
157+
| [(Asttypes.Noloc.Nolabel, _)] -> Some 0
158158
| _ -> None)
159159
| Some (Unlabelled unlabelledArgumentIndex) ->
160160
let index = ref 0 in
161161
args
162162
|> List.find_map (fun (label, _) ->
163163
match label with
164-
| Asttypes.Nolabel when !index = unlabelledArgumentIndex ->
164+
| Asttypes.Noloc.Nolabel when !index = unlabelledArgumentIndex ->
165165
Some !index
166166
| _ ->
167167
index := !index + 1;
@@ -171,7 +171,7 @@ let findActiveParameter ~argAtCursor ~args =
171171
args
172172
|> List.find_map (fun (label, _) ->
173173
match label with
174-
| (Asttypes.Labelled labelName | Optional labelName)
174+
| (Asttypes.Noloc.Labelled labelName | Optional labelName)
175175
when labelName = name ->
176176
Some !index
177177
| _ ->
@@ -474,7 +474,7 @@ let signatureHelp ~path ~pos ~currentFile ~debug ~allowForConstructorPayloads =
474474
parameters =
475475
parameters
476476
|> List.map (fun (argLabel, start, end_) ->
477-
let argLabel = Asttypes.to_arg_label argLabel in
477+
let argLabel = Asttypes.to_noloc argLabel in
478478
let paramArgCount = !paramUnlabelledArgCount in
479479
paramUnlabelledArgCount := paramArgCount + 1;
480480
let unlabelledArgCount = ref 0 in
@@ -487,8 +487,8 @@ let signatureHelp ~path ~pos ~currentFile ~debug ~allowForConstructorPayloads =
487487
let argCount = !unlabelledArgCount in
488488
unlabelledArgCount := argCount + 1;
489489
match (lbl, argLabel) with
490-
| ( Asttypes.Optional l1,
491-
Asttypes.Optional l2 )
490+
| ( Asttypes.Noloc.Optional l1,
491+
Asttypes.Noloc.Optional l2 )
492492
when l1 = l2 ->
493493
true
494494
| Labelled l1, Labelled l2

analysis/src/TypeUtils.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1123,7 +1123,7 @@ let getFirstFnUnlabelledArgType ~env ~full t =
11231123
in
11241124
let rec findFirstUnlabelledArgType labels =
11251125
match labels with
1126-
| (Asttypes.Nolabel, t) :: _ -> Some t
1126+
| (Asttypes.Noloc.Nolabel, t) :: _ -> Some t
11271127
| _ :: rest -> findFirstUnlabelledArgType rest
11281128
| [] -> None
11291129
in

compiler/frontend/ast_compatible.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,4 +160,4 @@ type object_field = Parsetree.object_field
160160

161161
let object_field l attrs ty = Parsetree.Otag (l, attrs, ty)
162162

163-
type args = (Asttypes.arg_label_loc * Parsetree.expression) list
163+
type args = (Asttypes.arg_label * Parsetree.expression) list

compiler/frontend/ast_compatible.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,4 +137,4 @@ type object_field = Parsetree.object_field
137137
val object_field :
138138
Asttypes.label Asttypes.loc -> attributes -> core_type -> object_field
139139

140-
type args = (Asttypes.arg_label_loc * Parsetree.expression) list
140+
type args = (Asttypes.arg_label * Parsetree.expression) list

0 commit comments

Comments
 (0)