Skip to content

Commit daf3e8b

Browse files
committed
remove redundant field from polyVariantConstructor type
1 parent 51e1e77 commit daf3e8b

File tree

2 files changed

+11
-15
lines changed

2 files changed

+11
-15
lines changed

analysis/src/CompletionBackEnd.ml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -711,13 +711,17 @@ let detail name (kind : Completion.kind) =
711711
| FileModule _ -> "file module"
712712
| Field ({typ}, s) -> name ^ ": " ^ (typ |> Shared.typeToString) ^ "\n\n" ^ s
713713
| Constructor (c, s) -> showConstructor c ^ "\n\n" ^ s
714-
| PolyvariantConstructor ({name; payload}, s) ->
714+
| PolyvariantConstructor ({name; args}, s) ->
715715
"#" ^ name
716-
^ (match payload with
717-
| None -> ""
718-
| Some ({desc = Types.Ttuple _} as typeExpr) ->
719-
typeExpr |> Shared.typeToString
720-
| Some typeExpr -> "(" ^ (typeExpr |> Shared.typeToString) ^ ")")
716+
^ (match args with
717+
| [] -> ""
718+
| [typeExpr] -> typeExpr |> Shared.typeToString
719+
| typeExprs ->
720+
"("
721+
^ (typeExprs
722+
|> List.map (fun typeExpr -> typeExpr |> Shared.typeToString)
723+
|> String.concat ", ")
724+
^ ")")
721725
^ "\n\n" ^ s
722726

723727
let findAllCompletions ~(env : QueryEnv.t) ~prefix ~exact ~namesUsed
@@ -1533,10 +1537,6 @@ let rec extractType ~env ~package (t : Types.type_expr) =
15331537
|> List.map (fun (label, field) ->
15341538
{
15351539
name = label;
1536-
payload =
1537-
(match field with
1538-
| Types.Rpresent maybeTypeExpr -> maybeTypeExpr
1539-
| _ -> None);
15401540
args =
15411541
(* Multiple arguments are represented as a Ttuple, while a single argument is just the type expression itself. *)
15421542
(match field with

analysis/src/SharedTypes.ml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -279,11 +279,7 @@ end = struct
279279
{env with exported = structure.exported; pathRev; parent = Some env}
280280
end
281281

282-
type polyVariantConstructor = {
283-
name: string;
284-
payload: Types.type_expr option;
285-
args: Types.type_expr list;
286-
}
282+
type polyVariantConstructor = {name: string; args: Types.type_expr list}
287283

288284
module Completion = struct
289285
type kind =

0 commit comments

Comments
 (0)