From c52773f82b28a47473f4422408db89ac2f2e0df0 Mon Sep 17 00:00:00 2001 From: Gabriel Nordeborn Date: Sat, 30 Dec 2023 21:58:10 +0100 Subject: [PATCH 01/17] debugging-type-resolution --- .vscode/settings.json | 24 +- analysis/.ocamlformat | 2 +- analysis/dune-project | 2 +- analysis/rescript-vscode.opam | 2 +- analysis/src/Cli.ml | 10 +- analysis/src/CompletionBackEnd.ml | 26 +- analysis/src/SharedTypes.ml | 12 +- analysis/src/TypeUtils.ml | 153 +++++- analysis/tests/src/EnvCompletion.res | 63 +++ analysis/tests/src/EnvCompletionOtherFile.res | 13 + analysis/tests/src/QueryFile.res | 6 + analysis/tests/src/Reprod.res | 9 + analysis/tests/src/SchemaAssets.res | 6 + .../tests/src/expected/Completion.res.txt | 15 + .../expected/CompletionExpressions.res.txt | 448 +++++++++++++++ .../CompletionFunctionArguments.res.txt | 95 ++++ .../expected/CompletionInferValues.res.txt | 78 +++ .../tests/src/expected/CompletionJsx.res.txt | 3 + .../src/expected/CompletionJsxProps.res.txt | 33 ++ .../src/expected/CompletionPattern.res.txt | 218 ++++++++ .../expected/CompletionTypeAnnotation.res.txt | 47 ++ .../tests/src/expected/Destructuring.res.txt | 20 + .../tests/src/expected/EnvCompletion.res.txt | 511 ++++++++++++++++++ .../expected/EnvCompletionOtherFile.res.txt | 0 .../src/expected/ExhaustiveSwitch.res.txt | 8 + analysis/tests/src/expected/Fragment.res.txt | 6 + analysis/tests/src/expected/Hover.res.txt | 2 + analysis/tests/src/expected/Jsx2.res.txt | 3 + analysis/tests/src/expected/QueryFile.res.txt | 0 analysis/tests/src/expected/Reprod.res.txt | 41 ++ .../tests/src/expected/SchemaAssets.res.txt | 0 .../src/expected/TypeAtPosCompletion.res.txt | 23 + analysis/tests/src/expected/Xform.res.txt | 1 + 33 files changed, 1834 insertions(+), 46 deletions(-) create mode 100644 analysis/tests/src/EnvCompletion.res create mode 100644 analysis/tests/src/EnvCompletionOtherFile.res create mode 100644 analysis/tests/src/QueryFile.res create mode 100644 analysis/tests/src/Reprod.res create mode 100644 analysis/tests/src/SchemaAssets.res create mode 100644 analysis/tests/src/expected/EnvCompletion.res.txt create mode 100644 analysis/tests/src/expected/EnvCompletionOtherFile.res.txt create mode 100644 analysis/tests/src/expected/QueryFile.res.txt create mode 100644 analysis/tests/src/expected/Reprod.res.txt create mode 100644 analysis/tests/src/expected/SchemaAssets.res.txt diff --git a/.vscode/settings.json b/.vscode/settings.json index 11909bf1d..7cf99ab8c 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,13 +1,13 @@ { - "editor.insertSpaces": false, - "tslint.enable": true, - "typescript.tsc.autoDetect": "off", - "typescript.preferences.quoteStyle": "single", - "editor.codeActionsOnSave": { - "source.fixAll.eslint": true - }, - "ocaml.sandbox": { - "kind": "opam", - "switch": "${workspaceFolder:rescript-vscode}/analysis" - } -} \ No newline at end of file + "editor.insertSpaces": false, + "tslint.enable": true, + "typescript.tsc.autoDetect": "off", + "typescript.preferences.quoteStyle": "single", + "editor.codeActionsOnSave": { + "source.fixAll.eslint": "explicit" + }, + "ocaml.sandbox": { + "kind": "opam", + "switch": "4.14.0" + } +} diff --git a/analysis/.ocamlformat b/analysis/.ocamlformat index 3bef5a7b4..87496a125 100644 --- a/analysis/.ocamlformat +++ b/analysis/.ocamlformat @@ -1,5 +1,5 @@ profile = default -version = 0.22.4 +version = 0.26.1 field-space = tight-decl break-cases = toplevel diff --git a/analysis/dune-project b/analysis/dune-project index 47a122217..6d54204c8 100644 --- a/analysis/dune-project +++ b/analysis/dune-project @@ -17,7 +17,7 @@ (ocaml (>= 4.10)) (ocamlformat - (= 0.22.4)) + (= 0.26.1)) (cppo (= 1.6.9)) (reanalyze diff --git a/analysis/rescript-vscode.opam b/analysis/rescript-vscode.opam index 1645dea53..72c8e4dd3 100644 --- a/analysis/rescript-vscode.opam +++ b/analysis/rescript-vscode.opam @@ -7,7 +7,7 @@ homepage: "https://github.com/rescript-lang/rescript-vscode" bug-reports: "https://github.com/rescript-lang/rescript-vscode/issues" depends: [ "ocaml" {>= "4.10"} - "ocamlformat" {= "0.22.4"} + "ocamlformat" {= "0.26.1"} "cppo" {= "1.6.9"} "reanalyze" {= "2.23.0"} "dune" diff --git a/analysis/src/Cli.ml b/analysis/src/Cli.ml index dcb86bdd6..dc55b2d5d 100644 --- a/analysis/src/Cli.ml +++ b/analysis/src/Cli.ml @@ -144,10 +144,11 @@ let main () = ~maxLength ~debug | [_; "codeLens"; path] -> Commands.codeLens ~path ~debug | [_; "extractDocs"; path] -> - - let () = match Sys.getenv_opt "FROM_COMPILER" with - | Some("true") -> Cfg.isDocGenFromCompiler := true - | _ -> () in + let () = + match Sys.getenv_opt "FROM_COMPILER" with + | Some "true" -> Cfg.isDocGenFromCompiler := true + | _ -> () + in DocExtraction.extractDocs ~path ~debug | [_; "codeAction"; path; startLine; startCol; endLine; endCol; currentFile] @@ -194,6 +195,7 @@ let main () = Printf.printf "\"%s\"" (Json.escape (Commands.format ~path)) | [_; "test"; path] -> Cfg.supportsSnippets := true; + Debug.debugLevel := Verbose; Commands.test ~path | args when List.mem "-h" args || List.mem "--help" args -> prerr_endline help | _ -> diff --git a/analysis/src/CompletionBackEnd.ml b/analysis/src/CompletionBackEnd.ml index 9ffc51fcc..236939d81 100644 --- a/analysis/src/CompletionBackEnd.ml +++ b/analysis/src/CompletionBackEnd.ml @@ -1061,6 +1061,12 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~pos ~env ~exact ~kind:(Completion.Value (Utils.unwrapIfOption typ)); ]) | CArgument {functionContextPath; argumentLabel} -> ( + Debug.logVerbose + (Printf.sprintf "--> function argument: %s" + (match argumentLabel with + | Labelled n | Optional n -> n + | Unlabelled {argumentPosition} -> "$" ^ string_of_int argumentPosition)); + let labels, env = match functionContextPath @@ -1069,8 +1075,11 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~pos ~env ~exact |> completionsGetCompletionType2 ~debug ~full ~opens ~rawOpens ~pos with | Some ((TypeExpr typ | ExtractedType (Tfunction {typ})), env) -> + Debug.logVerbose "--> found function type"; (typ |> TypeUtils.getArgs ~full ~env, env) - | _ -> ([], env) + | _ -> + Debug.logVerbose "--> could not find function type"; + ([], env) in let targetLabel = labels @@ -1090,8 +1099,11 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~pos ~env ~exact | Some (Optional _, _) -> true in match targetLabel with - | None -> [] + | None -> + Debug.logVerbose "--> could not look up function argument"; + [] | Some (_, typ) -> + Debug.logVerbose "--> found function argument!"; [ Completion.create "dummy" ~env ~kind: @@ -1825,6 +1837,7 @@ let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover completable = fallbackOrEmpty ~items ()) | None -> fallbackOrEmpty ()) | Cexpression {contextPath; prefix; nested} -> ( + Debug.logVerbose "--> expression completion"; (* Completions for local things like variables in scope, modules in the project, etc. We only add completions when there's a prefix of some sort we can filter on, since we know we're in some sort of context, and @@ -1841,11 +1854,16 @@ let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover completable = ~exact:true ~scope |> completionsGetCompletionType ~full with - | None -> regularCompletions + | None -> + Debug.logVerbose "--> could not get completions for context path"; + regularCompletions | Some (typ, env) -> ( match typ |> TypeUtils.resolveNested ~env ~full ~nested with - | None -> regularCompletions + | None -> + Debug.logVerbose "--> could not resolve nested expression path"; + regularCompletions | Some (typ, _env, completionContext) -> ( + Debug.logVerbose "--> found type in nested expression completion"; (* Wrap the insert text in braces when we're completing the root of a JSX prop value. *) let wrapInsertTextInBraces = diff --git a/analysis/src/SharedTypes.ml b/analysis/src/SharedTypes.ml index 2528b6021..8707a70a7 100644 --- a/analysis/src/SharedTypes.ml +++ b/analysis/src/SharedTypes.ml @@ -334,6 +334,7 @@ and completionType = | TtypeT of {env: QueryEnv.t; path: Path.t} | Tvariant of { env: QueryEnv.t; + typeParamsEnv: QueryEnv.t; constructors: Constructor.t list; variantDecl: Types.type_declaration; variantName: string; @@ -347,6 +348,9 @@ and completionType = } | Trecord of { env: QueryEnv.t; + typeParamsEnv: QueryEnv.t; + typeArgs: Types.type_expr list; + typeParams: Types.type_expr list; fields: field list; definition: [ `NameOnly of string @@ -354,7 +358,13 @@ and completionType = | `TypeExpr of Types.type_expr (** When we have the full type expr from the compiler. *) ]; } - | TinlineRecord of {env: QueryEnv.t; fields: field list} + | TinlineRecord of { + env: QueryEnv.t; + typeParamsEnv: QueryEnv.t; + fields: field list; + typeArgs: Types.type_expr list; + typeParams: Types.type_expr list; + } | Tfunction of { env: QueryEnv.t; args: typedFnArg list; diff --git a/analysis/src/TypeUtils.ml b/analysis/src/TypeUtils.ml index 5979cef92..c43e89aa6 100644 --- a/analysis/src/TypeUtils.ml +++ b/analysis/src/TypeUtils.ml @@ -1,7 +1,8 @@ open SharedTypes -let instantiateType ~typeParams ~typeArgs (t : Types.type_expr) = - if typeParams = [] || typeArgs = [] then t +let instantiateType ?(instantiateTypes = true) ~typeParams ~typeArgs + (t : Types.type_expr) = + if typeParams = [] || typeArgs = [] || instantiateTypes = false then t else let rec applySub tp ta t = match (tp, ta) with @@ -109,8 +110,32 @@ let rec extractFunctionType ~env ~package typ = in loop ~env [] typ +let rec findInPairs pred lst1 lst2 = + match (lst1, lst2) with + | [], _ | _, [] -> None + | x :: xs, y :: ys -> if pred x then Some y else findInPairs pred xs ys + +let rec instantiateVar ~typeParams ~typeArgs ~typeParamsEnv ~env + (t : Types.type_expr) = + match t.desc with + | Tlink t1 | Tsubst t1 | Tpoly (t1, []) -> + instantiateVar ~typeParams ~typeArgs ~typeParamsEnv ~env t1 + | Tvar (Some varName) -> + let rec findTypeArg params args = + match (params, args) with + | [], _ | _, [] -> (t, env) + | {Types.desc = Tvar (Some currentArgName)} :: _, arg :: _ + when currentArgName = varName -> + (arg, typeParamsEnv) + | _ :: params, _ :: args -> findTypeArg params args + in + findTypeArg typeParams typeArgs + | _ -> (t, env) + (** Pulls out a type we can complete from a type expr. *) -let rec extractType ~env ~package (t : Types.type_expr) = +let rec extractType ?(instantiateTypes = true) ~env ~package + (t : Types.type_expr) = + let instantiateType = instantiateType ~instantiateTypes in match t.desc with | Tlink t1 | Tsubst t1 | Tpoly (t1, []) -> extractType ~env ~package t1 | Tconstr (Path.Pident {name = "option"}, [payloadTypeExpr], _) -> @@ -131,26 +156,51 @@ let rec extractType ~env ~package (t : Types.type_expr) = Some (Tfunction {env; args; typ = t; uncurried = true; returnType = tRet}) | _args, _tRet -> None) | Tconstr (path, typeArgs, _) -> ( + Debug.logVerbose + (Printf.sprintf "[extract_type]--> digging for type %s in %s" + (Path.name path) env.file.moduleName); match References.digConstructor ~env ~package path with - | Some (_env, {item = {decl = {type_manifest = Some t1; type_params}}}) -> + | Some + (_envFromItem, {item = {decl = {type_manifest = Some t1; type_params}}}) + -> + Debug.logVerbose "[extract_type]--> found type manifest"; t1 |> instantiateType ~typeParams:type_params ~typeArgs |> extractType ~env ~package - | Some (_env, {name; item = {decl; kind = Type.Variant constructors}}) -> + | Some + ( envFromDeclaration, + {name; item = {decl; kind = Type.Variant constructors}} ) -> + Debug.logVerbose "[extract_type]--> found variant"; Some (Tvariant { - env; + typeParamsEnv = env; + env = envFromDeclaration; constructors; variantName = name.txt; variantDecl = decl; typeArgs; typeParams = decl.type_params; }) - | Some (env, {item = {kind = Record fields}}) -> - Some (Trecord {env; fields; definition = `TypeExpr t}) + | Some (envFromDeclaration, {item = {kind = Record fields; decl}}) -> + Debug.logVerbose "[extract_type]--> found record"; + Some + (Trecord + { + typeParamsEnv = env; + env = envFromDeclaration; + fields; + definition = `TypeExpr t; + typeArgs; + typeParams = decl.type_params; + }) | Some (env, {item = {name = "t"}}) -> Some (TtypeT {env; path}) - | _ -> None) + | None -> + Debug.logVerbose "[extract_type]--> found nothing when digging"; + None + | _ -> + Debug.logVerbose "[extract_type]--> found something else when digging"; + None) | Ttuple expressions -> Some (Tuple (env, expressions, t)) | Tvariant {row_fields} -> let constructors = @@ -176,7 +226,9 @@ let rec extractType ~env ~package (t : Types.type_expr) = Some (Tfunction {env; args; typ = t; uncurried = false; returnType = tRet}) | _args, _tRet -> None) - | _ -> None + | _ -> + Debug.logVerbose "[extract_type]--> miss"; + None let findReturnTypeOfFunctionAtLoc loc ~(env : QueryEnv.t) ~full ~debug = match References.getLocItem ~full ~pos:(loc |> Loc.end_) ~debug with @@ -290,12 +342,22 @@ let extractTypeFromResolvedType (typ : Type.t) ~env ~full = match typ.kind with | Tuple items -> Some (Tuple (env, items, Ctype.newty (Ttuple items))) | Record fields -> - Some (Trecord {env; fields; definition = `NameOnly typ.name}) + Some + (Trecord + { + env; + typeParamsEnv = env; + fields; + definition = `NameOnly typ.name; + typeParams = typ.decl.type_params; + typeArgs = []; + }) | Variant constructors -> Some (Tvariant { env; + typeParamsEnv = env; constructors; variantName = typ.name; variantDecl = typ.decl; @@ -312,8 +374,10 @@ type ctx = Rfield of string (** A record field of name *) (** This moves through a nested path via a set of instructions, trying to resolve the type at the end of the path. *) let rec resolveNested ~env ~full ~nested ?ctx (typ : completionType) = + let extractType = extractType ~instantiateTypes:false in match nested with | [] -> + Debug.logVerbose "[nested_expr]--> reached end of pattern, returning type"; Some ( typ, env, @@ -324,22 +388,34 @@ let rec resolveNested ~env ~full ~nested ?ctx (typ : completionType) = | patternPath :: nested -> ( match (patternPath, typ) with | Completable.NTupleItem {itemNum}, Tuple (env, tupleItems, _) -> ( + Debug.logVerbose "[nested_expr]--> trying to move into tuple"; match List.nth_opt tupleItems itemNum with - | None -> None + | None -> + Debug.logVerbose "[nested_expr]--> tuple element not found"; + None | Some typ -> typ |> extractType ~env ~package:full.package |> Utils.Option.flatMap (fun typ -> typ |> resolveNested ~env ~full ~nested)) | ( NFollowRecordField {fieldName}, - (TinlineRecord {env; fields} | Trecord {env; fields}) ) -> ( + ( TinlineRecord {env; typeParamsEnv; fields; typeParams; typeArgs} + | Trecord {env; typeParamsEnv; fields; typeParams; typeArgs} ) ) -> ( + Debug.logVerbose "[nested_expr]--> trying to move into record field"; match fields |> List.find_opt (fun (field : field) -> field.fname.txt = fieldName) with - | None -> None + | None -> + Debug.logVerbose "[nested_expr]--> did not find record field"; + None | Some {typ; optional} -> + Debug.logVerbose "[nested_expr]--> found record field type"; let typ = if optional then Utils.unwrapIfOption typ else typ in + + Debug.logVerbose + (Printf.sprintf "[nested_expr]--> extracting from type %s in env %s" + (Shared.typeToString typ) env.file.moduleName); typ |> extractType ~env ~package:full.package |> Utils.Option.flatMap (fun typ -> @@ -353,46 +429,70 @@ let rec resolveNested ~env ~full ~nested ?ctx (typ : completionType) = | ( NRecordBody {seenFields}, (Trecord {env; definition = `NameOnly _} as extractedType) ) -> Some (extractedType, env, Some (Completable.RecordField {seenFields})) - | NRecordBody {seenFields}, TinlineRecord {env; fields} -> + | ( NRecordBody {seenFields}, + TinlineRecord {env; typeParamsEnv; typeArgs; typeParams; fields} ) -> Some - ( TinlineRecord {fields; env}, + ( TinlineRecord {fields; env; typeParamsEnv; typeArgs; typeParams}, env, Some (Completable.RecordField {seenFields}) ) | ( NVariantPayload {constructorName = "Some"; itemNum = 0}, Toption (env, ExtractedType typ) ) -> + Debug.logVerbose "[nested_expr]--> moving into option Some"; typ |> resolveNested ~env ~full ~nested | ( NVariantPayload {constructorName = "Some"; itemNum = 0}, Toption (env, TypeExpr typ) ) -> + Debug.logVerbose "[nested_expr]--> moving into option Some"; typ |> extractType ~env ~package:full.package |> Utils.Option.flatMap (fun t -> t |> resolveNested ~env ~full ~nested) | NVariantPayload {constructorName = "Ok"; itemNum = 0}, Tresult {okType} -> + Debug.logVerbose "[nested_expr]--> moving into result Ok"; okType |> extractType ~env ~package:full.package |> Utils.Option.flatMap (fun t -> t |> resolveNested ~env ~full ~nested) | ( NVariantPayload {constructorName = "Error"; itemNum = 0}, Tresult {errorType} ) -> + Debug.logVerbose "[nested_expr]--> moving into result Error"; errorType |> extractType ~env ~package:full.package |> Utils.Option.flatMap (fun t -> t |> resolveNested ~env ~full ~nested) | ( NVariantPayload {constructorName; itemNum}, - Tvariant {env; constructors; typeParams; typeArgs} ) -> ( + Tvariant {env; typeParamsEnv; constructors; typeParams; typeArgs} ) -> ( + Debug.logVerbose + (Printf.sprintf + "[nested_expr]--> trying to move into variant payload $%i of \ + constructor '%s'" + itemNum constructorName); match constructors |> List.find_opt (fun (c : Constructor.t) -> c.cname.txt = constructorName) with | Some {args = Args args} -> ( + Debug.logVerbose "[nested_expr]--> found constructor (Args type)"; match List.nth_opt args itemNum with - | None -> None + | None -> + Debug.logVerbose "[nested_expr]--> did not find relevant args num"; + None | Some (typ, _) -> + Debug.logVerbose + (Printf.sprintf "[nested_expr]--> found arg of type: %s" + (Shared.typeToString typ)); + + let typ, env = + typ |> instantiateVar ~env ~typeParamsEnv ~typeParams ~typeArgs + in typ - |> instantiateType ~typeParams ~typeArgs |> extractType ~env ~package:full.package |> Utils.Option.flatMap (fun typ -> + Debug.logVerbose + "[nested_expr]--> extracted type, continuing descent"; typ |> resolveNested ~env ~full ~nested)) | Some {args = InlineRecord fields} when itemNum = 0 -> - TinlineRecord {env; fields} |> resolveNested ~env ~full ~nested + Debug.logVerbose "[nested_expr]--> found constructor (inline record)"; + TinlineRecord + {env; typeParamsEnv = env; typeArgs = []; typeParams = []; fields} + |> resolveNested ~env ~full ~nested | _ -> None) | ( NPolyvariantPayload {constructorName; itemNum}, Tpolyvariant {env; constructors} ) -> ( @@ -437,8 +537,17 @@ let findTypeOfConstructorArg constructors ~constructorName ~payloadNum ~env = match List.nth_opt args payloadNum with | None -> None | Some (typ, _) -> Some (TypeExpr typ)) - | Some {args = InlineRecord fields} when payloadNum = 0 -> - Some (ExtractedType (TinlineRecord {env; fields})) + | Some {args = InlineRecord fields; typeDecl = _, decl} when payloadNum = 0 -> + Some + (ExtractedType + (TinlineRecord + { + env; + typeParamsEnv = env; + typeParams = decl.type_params; + typeArgs = []; + fields; + })) | _ -> None let findTypeOfPolyvariantArg constructors ~constructorName ~payloadNum = diff --git a/analysis/tests/src/EnvCompletion.res b/analysis/tests/src/EnvCompletion.res new file mode 100644 index 000000000..1bddb38e1 --- /dev/null +++ b/analysis/tests/src/EnvCompletion.res @@ -0,0 +1,63 @@ +type things = One | Two +type things2 = Four | Five + +let res: EnvCompletionOtherFile.someResult = Okay(One) + +let use = (): EnvCompletionOtherFile.response => { + stuff: First, + res: Failure(""), +} + +// switch res { | } +// ^com + +// switch res { | Okay() } +// ^com + +// switch res { | Failure() } +// ^com + +// switch use() { | } +// ^com + +// switch use() { | {} } +// ^com + +// switch use() { | {stuff: } } +// ^com + +// switch use() { | {stuff: Second() } } +// ^com + +// switch use() { | {stuff: Second({}) } } +// ^com + +// switch use() { | {res: } } +// ^com + +// switch use() { | {res: Okay() } } +// ^com + +// switch use() { | {res: Okay(Second()) } } +// ^com + +// switch use() { | {res: Okay(Second({})) } } +// ^com + +let res2: EnvCompletionOtherFile.someRecord = { + name: "string", + theThing: Four, + theVariant: First, +} + +// switch res2 { | } +// ^com + +// switch res2 { | {} } +// ^com + +// switch res2 { | {theThing: } } +// ^com + +// switch res2 { | {theVariant: } } +// ^com diff --git a/analysis/tests/src/EnvCompletionOtherFile.res b/analysis/tests/src/EnvCompletionOtherFile.res new file mode 100644 index 000000000..1218b0010 --- /dev/null +++ b/analysis/tests/src/EnvCompletionOtherFile.res @@ -0,0 +1,13 @@ +type someResult<'a, 'b> = Okay('a) | Failure('b) + +type r1 = {age: int} + +type theVariant = First | Second(r1) + +type someRecord<'thing> = { + name: string, + theThing: 'thing, + theVariant: theVariant, +} + +type response = {stuff: theVariant, res: someResult} diff --git a/analysis/tests/src/QueryFile.res b/analysis/tests/src/QueryFile.res new file mode 100644 index 000000000..0ba6f3d1d --- /dev/null +++ b/analysis/tests/src/QueryFile.res @@ -0,0 +1,6 @@ +module Types = { + type byAddress = SchemaAssets.input_ByAddress + type location = SchemaAssets.input_Location + + type variables = {location: location} +} diff --git a/analysis/tests/src/Reprod.res b/analysis/tests/src/Reprod.res new file mode 100644 index 000000000..633aa7fa6 --- /dev/null +++ b/analysis/tests/src/Reprod.res @@ -0,0 +1,9 @@ +module Query = { + let use = (~variables: QueryFile.Types.variables) => { + ignore(variables) + "" + } +} + +// let x = Query.use(~variables={location: ByAddress()}) +// ^com diff --git a/analysis/tests/src/SchemaAssets.res b/analysis/tests/src/SchemaAssets.res new file mode 100644 index 000000000..b83ff5c0d --- /dev/null +++ b/analysis/tests/src/SchemaAssets.res @@ -0,0 +1,6 @@ +@live +type rec input_ByAddress = {city: string} +@tag("__$inputUnion") +and input_Location = + | @as("byAddress") ByAddress(input_ByAddress) + | @as("byId") ById(string) diff --git a/analysis/tests/src/expected/Completion.res.txt b/analysis/tests/src/expected/Completion.res.txt index a959525bb..33945e0c4 100644 --- a/analysis/tests/src/expected/Completion.res.txt +++ b/analysis/tests/src/expected/Completion.res.txt @@ -518,8 +518,11 @@ JSX 59:21] second[59:22->59:28]=...[59:29->59:30]> _children:Non Completable: Cexpression CJsxPropValue [O, Comp] second=z Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CJsxPropValue [O, Comp] second Path O.Comp.make +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "zzz", "kind": 12, @@ -1742,6 +1745,7 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 3 pervasives Completion.res Completion.res ContextPath Value[x] Path x +[extract_type]--> miss Completable: Cpath Value[T] Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder Package opens Pervasives.JsxModules.place holder @@ -2141,8 +2145,11 @@ Completable: Cexpression Type[someVariantWithDeprecated] Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder Package opens Pervasives.JsxModules.place holder Resolved opens 3 pervasives Completion.res Completion.res +--> expression completion ContextPath Type[someVariantWithDeprecated] Path someVariantWithDeprecated +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "DoNotUseMe", "kind": 4, @@ -2195,8 +2202,16 @@ Completable: Cexpression Type[withUncurried]->recordField(fn) Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder Package opens Pervasives.JsxModules.place holder Resolved opens 3 pervasives Completion.res Completion.res +--> expression completion ContextPath Type[withUncurried] Path withUncurried +[nested_expr]--> trying to move into record field +[nested_expr]--> found record field type +[nested_expr]--> extracting from type (. int) => unit in env Completion +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion +[extract_type]--> digging for type unit in Completion +[extract_type]--> found nothing when digging [{ "label": "(. v) => {}", "kind": 12, diff --git a/analysis/tests/src/expected/CompletionExpressions.res.txt b/analysis/tests/src/expected/CompletionExpressions.res.txt index 0b5a19564..351ca51ad 100644 --- a/analysis/tests/src/expected/CompletionExpressions.res.txt +++ b/analysis/tests/src/expected/CompletionExpressions.res.txt @@ -8,6 +8,7 @@ ContextPath Value[s] Path s ContextPath Value[f] Path f +[nested_expr]--> reached end of pattern, returning type [{ "label": "(_, _)", "kind": 12, @@ -24,9 +25,18 @@ Pexp_apply ...[26:11->26:25] (...[26:26->26:28]) Completable: Cexpression CArgument Value[fnTakingRecord]($0)->recordBody Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[fnTakingRecord]($0) +--> function argument: $0 ContextPath Value[fnTakingRecord] Path fnTakingRecord +--> found function type +--> found function argument! +[extract_type]--> digging for type someRecord in CompletionExpressions +[extract_type]--> found record +[extract_type]--> digging for type someRecord in CompletionExpressions +[extract_type]--> found record +--> found type in nested expression completion [{ "label": "age", "kind": 5, @@ -71,9 +81,18 @@ Pexp_apply ...[29:11->29:25] (...[29:27->29:28]) Completable: Cexpression CArgument Value[fnTakingRecord]($0)=n->recordBody Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[fnTakingRecord]($0) +--> function argument: $0 ContextPath Value[fnTakingRecord] Path fnTakingRecord +--> found function type +--> found function argument! +[extract_type]--> digging for type someRecord in CompletionExpressions +[extract_type]--> found record +[extract_type]--> digging for type someRecord in CompletionExpressions +[extract_type]--> found record +--> found type in nested expression completion [{ "label": "nested", "kind": 5, @@ -88,9 +107,20 @@ Pexp_apply ...[32:11->32:25] (...[32:26->32:38]) Completable: Cexpression CArgument Value[fnTakingRecord]($0)->recordField(offline) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[fnTakingRecord]($0) +--> function argument: $0 ContextPath Value[fnTakingRecord] Path fnTakingRecord +--> found function type +--> found function argument! +[extract_type]--> digging for type someRecord in CompletionExpressions +[extract_type]--> found record +[nested_expr]--> trying to move into record field +[nested_expr]--> found record field type +[nested_expr]--> extracting from type bool in env CompletionExpressions +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "true", "kind": 4, @@ -111,9 +141,18 @@ Pexp_apply ...[35:11->35:25] (...[35:26->35:38]) Completable: Cexpression CArgument Value[fnTakingRecord]($0)->recordBody Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[fnTakingRecord]($0) +--> function argument: $0 ContextPath Value[fnTakingRecord] Path fnTakingRecord +--> found function type +--> found function argument! +[extract_type]--> digging for type someRecord in CompletionExpressions +[extract_type]--> found record +[extract_type]--> digging for type someRecord in CompletionExpressions +[extract_type]--> found record +--> found type in nested expression completion [{ "label": "offline", "kind": 5, @@ -152,9 +191,18 @@ Pexp_apply ...[38:11->38:25] (...[38:26->38:52]) Completable: Cexpression CArgument Value[fnTakingRecord]($0)->recordBody Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[fnTakingRecord]($0) +--> function argument: $0 ContextPath Value[fnTakingRecord] Path fnTakingRecord +--> found function type +--> found function argument! +[extract_type]--> digging for type someRecord in CompletionExpressions +[extract_type]--> found record +[extract_type]--> digging for type someRecord in CompletionExpressions +[extract_type]--> found record +--> found type in nested expression completion [{ "label": "online", "kind": 5, @@ -187,9 +235,22 @@ Pexp_apply ...[41:11->41:25] (...[41:26->41:47]) Completable: Cexpression CArgument Value[fnTakingRecord]($0)->recordField(nested) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[fnTakingRecord]($0) +--> function argument: $0 ContextPath Value[fnTakingRecord] Path fnTakingRecord +--> found function type +--> found function argument! +[extract_type]--> digging for type someRecord in CompletionExpressions +[extract_type]--> found record +[nested_expr]--> trying to move into record field +[nested_expr]--> found record field type +[nested_expr]--> extracting from type option in env CompletionExpressions +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion +[extract_type]--> digging for type otherRecord in CompletionExpressions +[extract_type]--> found record [{ "label": "Some(nested)", "kind": 12, @@ -228,9 +289,19 @@ Pexp_apply ...[44:11->44:25] (...[44:26->44:48]) Completable: Cexpression CArgument Value[fnTakingRecord]($0)->recordField(nested), recordBody Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[fnTakingRecord]($0) +--> function argument: $0 ContextPath Value[fnTakingRecord] Path fnTakingRecord +--> found function type +--> found function argument! +[extract_type]--> digging for type someRecord in CompletionExpressions +[extract_type]--> found record +[nested_expr]--> trying to move into record field +[nested_expr]--> found record field type +[nested_expr]--> extracting from type option in env CompletionExpressions +--> could not resolve nested expression path [] Complete src/CompletionExpressions.res 47:51 @@ -239,9 +310,24 @@ Pexp_apply ...[47:11->47:25] (...[47:26->47:54]) Completable: Cexpression CArgument Value[fnTakingRecord]($0)->recordField(nested), variantPayload::Some($0), recordBody Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[fnTakingRecord]($0) +--> function argument: $0 ContextPath Value[fnTakingRecord] Path fnTakingRecord +--> found function type +--> found function argument! +[extract_type]--> digging for type someRecord in CompletionExpressions +[extract_type]--> found record +[nested_expr]--> trying to move into record field +[nested_expr]--> found record field type +[nested_expr]--> extracting from type option in env CompletionExpressions +[nested_expr]--> moving into option Some +[extract_type]--> digging for type otherRecord in CompletionExpressions +[extract_type]--> found record +[extract_type]--> digging for type otherRecord in CompletionExpressions +[extract_type]--> found record +--> found type in nested expression completion [{ "label": "someField", "kind": 5, @@ -262,9 +348,22 @@ Pexp_apply ...[50:11->50:25] (...[50:26->50:48]) Completable: Cexpression CArgument Value[fnTakingRecord]($0)->recordField(variant) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[fnTakingRecord]($0) +--> function argument: $0 ContextPath Value[fnTakingRecord] Path fnTakingRecord +--> found function type +--> found function argument! +[extract_type]--> digging for type someRecord in CompletionExpressions +[extract_type]--> found record +[nested_expr]--> trying to move into record field +[nested_expr]--> found record field type +[nested_expr]--> extracting from type someVariant in env CompletionExpressions +[extract_type]--> digging for type someVariant in CompletionExpressions +[extract_type]--> found variant +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "One", "kind": 4, @@ -297,9 +396,22 @@ Pexp_apply ...[53:11->53:25] (...[53:26->53:49]) Completable: Cexpression CArgument Value[fnTakingRecord]($0)=O->recordField(variant) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[fnTakingRecord]($0) +--> function argument: $0 ContextPath Value[fnTakingRecord] Path fnTakingRecord +--> found function type +--> found function argument! +[extract_type]--> digging for type someRecord in CompletionExpressions +[extract_type]--> found record +[nested_expr]--> trying to move into record field +[nested_expr]--> found record field type +[nested_expr]--> extracting from type someVariant in env CompletionExpressions +[extract_type]--> digging for type someVariant in CompletionExpressions +[extract_type]--> found variant +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "One", "kind": 4, @@ -316,9 +428,24 @@ Pexp_apply ...[56:11->56:25] (...[56:26->56:60]) Completable: Cexpression CArgument Value[fnTakingRecord]($0)->recordField(polyvariant), polyvariantPayload::three($0) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[fnTakingRecord]($0) +--> function argument: $0 ContextPath Value[fnTakingRecord] Path fnTakingRecord +--> found function type +--> found function argument! +[extract_type]--> digging for type someRecord in CompletionExpressions +[extract_type]--> found record +[nested_expr]--> trying to move into record field +[nested_expr]--> found record field type +[nested_expr]--> extracting from type somePolyVariant in env CompletionExpressions +[extract_type]--> digging for type somePolyVariant in CompletionExpressions +[extract_type]--> found type manifest +[extract_type]--> digging for type someRecord in CompletionExpressions +[extract_type]--> found record +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "{}", "kind": 12, @@ -336,9 +463,22 @@ Pexp_apply ...[59:11->59:25] (...[59:26->59:64]) Completable: Cexpression CArgument Value[fnTakingRecord]($0)->recordField(polyvariant), polyvariantPayload::three($1) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[fnTakingRecord]($0) +--> function argument: $0 ContextPath Value[fnTakingRecord] Path fnTakingRecord +--> found function type +--> found function argument! +[extract_type]--> digging for type someRecord in CompletionExpressions +[extract_type]--> found record +[nested_expr]--> trying to move into record field +[nested_expr]--> found record field type +[nested_expr]--> extracting from type somePolyVariant in env CompletionExpressions +[extract_type]--> digging for type somePolyVariant in CompletionExpressions +[extract_type]--> found type manifest +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "true", "kind": 4, @@ -359,9 +499,22 @@ Pexp_apply ...[62:11->62:25] (...[62:26->62:65]) Completable: Cexpression CArgument Value[fnTakingRecord]($0)=t->recordField(polyvariant), polyvariantPayload::three($1) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[fnTakingRecord]($0) +--> function argument: $0 ContextPath Value[fnTakingRecord] Path fnTakingRecord +--> found function type +--> found function argument! +[extract_type]--> digging for type someRecord in CompletionExpressions +[extract_type]--> found record +[nested_expr]--> trying to move into record field +[nested_expr]--> found record field type +[nested_expr]--> extracting from type somePolyVariant in env CompletionExpressions +[extract_type]--> digging for type somePolyVariant in CompletionExpressions +[extract_type]--> found type manifest +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "true", "kind": 4, @@ -376,9 +529,15 @@ Pexp_apply ...[69:11->69:24] (...[69:25->69:26]) Completable: Cexpression CArgument Value[fnTakingArray]($0) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[fnTakingArray]($0) +--> function argument: $0 ContextPath Value[fnTakingArray] Path fnTakingArray +--> found function type +--> found function argument! +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "[]", "kind": 12, @@ -396,9 +555,15 @@ Pexp_apply ...[72:11->72:24] (...[72:25->72:27]) Completable: Cexpression CArgument Value[fnTakingArray]($0)->array Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[fnTakingArray]($0) +--> function argument: $0 ContextPath Value[fnTakingArray] Path fnTakingArray +--> found function type +--> found function argument! +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "None", "kind": 12, @@ -433,9 +598,15 @@ Pexp_apply ...[75:11->75:24] (...[75:25->75:26]) Completable: Cexpression CArgument Value[fnTakingArray]($0)=s Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[fnTakingArray]($0) +--> function argument: $0 ContextPath Value[fnTakingArray] Path fnTakingArray +--> found function type +--> found function argument! +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "s", "kind": 12, @@ -450,9 +621,16 @@ Pexp_apply ...[78:11->78:24] (...[78:25->78:33]) Completable: Cexpression CArgument Value[fnTakingArray]($0)->array, variantPayload::Some($0) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[fnTakingArray]($0) +--> function argument: $0 ContextPath Value[fnTakingArray] Path fnTakingArray +--> found function type +--> found function argument! +[nested_expr]--> moving into option Some +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "true", "kind": 4, @@ -473,9 +651,15 @@ Pexp_apply ...[81:11->81:24] (...[81:25->81:33]) Completable: Cexpression CArgument Value[fnTakingArray]($0)->array Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[fnTakingArray]($0) +--> function argument: $0 ContextPath Value[fnTakingArray] Path fnTakingArray +--> found function type +--> found function argument! +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "None", "kind": 12, @@ -510,9 +694,15 @@ Pexp_apply ...[84:11->84:24] (...[84:25->84:39]) Completable: Cexpression CArgument Value[fnTakingArray]($0)->array Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[fnTakingArray]($0) +--> function argument: $0 ContextPath Value[fnTakingArray] Path fnTakingArray +--> found function type +--> found function argument! +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "None", "kind": 12, @@ -547,9 +737,17 @@ Pexp_apply ...[89:11->89:25] (...[89:26->89:40]) Completable: Cexpression CArgument Value[fnTakingRecord]($0)=so Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[fnTakingRecord]($0) +--> function argument: $0 ContextPath Value[fnTakingRecord] Path fnTakingRecord +--> found function type +--> found function argument! +[extract_type]--> digging for type someRecord in CompletionExpressions +[extract_type]--> found record +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "someBoolVar", "kind": 12, @@ -564,9 +762,20 @@ Pexp_apply ...[96:11->96:30] (...[96:31->96:46]) Completable: Cexpression CArgument Value[fnTakingOtherRecord]($0)->recordField(otherField) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[fnTakingOtherRecord]($0) +--> function argument: $0 ContextPath Value[fnTakingOtherRecord] Path fnTakingOtherRecord +--> found function type +--> found function argument! +[extract_type]--> digging for type otherRecord in CompletionExpressions +[extract_type]--> found record +[nested_expr]--> trying to move into record field +[nested_expr]--> found record field type +[nested_expr]--> extracting from type string in env CompletionExpressions +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "\"\"", "kind": 12, @@ -584,9 +793,20 @@ Pexp_apply ...[108:11->108:42] (...[108:43->108:60]) Completable: Cexpression CArgument Value[fnTakingRecordWithOptionalField]($0)->recordField(someOptField) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[fnTakingRecordWithOptionalField]($0) +--> function argument: $0 ContextPath Value[fnTakingRecordWithOptionalField] Path fnTakingRecordWithOptionalField +--> found function type +--> found function argument! +[extract_type]--> digging for type recordWithOptionalField in CompletionExpressions +[extract_type]--> found record +[nested_expr]--> trying to move into record field +[nested_expr]--> found record field type +[nested_expr]--> extracting from type bool in env CompletionExpressions +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "true", "kind": 4, @@ -607,9 +827,22 @@ Pexp_apply ...[116:11->116:39] (...[116:40->116:56]) Completable: Cexpression CArgument Value[fnTakingRecordWithOptVariant]($0)->recordField(someVariant) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[fnTakingRecordWithOptVariant]($0) +--> function argument: $0 ContextPath Value[fnTakingRecordWithOptVariant] Path fnTakingRecordWithOptVariant +--> found function type +--> found function argument! +[extract_type]--> digging for type recordWithOptVariant in CompletionExpressions +[extract_type]--> found record +[nested_expr]--> trying to move into record field +[nested_expr]--> found record field type +[nested_expr]--> extracting from type option in env CompletionExpressions +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion +[extract_type]--> digging for type someVariant in CompletionExpressions +[extract_type]--> found variant [{ "label": "Some(someVariant)", "kind": 12, @@ -664,9 +897,19 @@ Pexp_apply ...[126:11->126:31] (...[126:32->126:50]) Completable: Cexpression CArgument Value[fnTakingInlineRecord]($0)->variantPayload::WithInlineRecord($0) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[fnTakingInlineRecord]($0) +--> function argument: $0 ContextPath Value[fnTakingInlineRecord] Path fnTakingInlineRecord +--> found function type +--> found function argument! +[extract_type]--> digging for type variantWithInlineRecord in CompletionExpressions +[extract_type]--> found variant +[nested_expr]--> trying to move into variant payload $0 of constructor 'WithInlineRecord' +[nested_expr]--> found constructor (inline record) +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "{}", "kind": 4, @@ -684,9 +927,18 @@ Pexp_apply ...[129:11->129:31] (...[129:32->129:52]) Completable: Cexpression CArgument Value[fnTakingInlineRecord]($0)->variantPayload::WithInlineRecord($0), recordBody Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[fnTakingInlineRecord]($0) +--> function argument: $0 ContextPath Value[fnTakingInlineRecord] Path fnTakingInlineRecord +--> found function type +--> found function argument! +[extract_type]--> digging for type variantWithInlineRecord in CompletionExpressions +[extract_type]--> found variant +[nested_expr]--> trying to move into variant payload $0 of constructor 'WithInlineRecord' +[nested_expr]--> found constructor (inline record) +--> found type in nested expression completion [{ "label": "someBoolField", "kind": 4, @@ -713,9 +965,18 @@ Pexp_apply ...[132:11->132:31] (...[132:32->132:53]) Completable: Cexpression CArgument Value[fnTakingInlineRecord]($0)=s->variantPayload::WithInlineRecord($0), recordBody Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[fnTakingInlineRecord]($0) +--> function argument: $0 ContextPath Value[fnTakingInlineRecord] Path fnTakingInlineRecord +--> found function type +--> found function argument! +[extract_type]--> digging for type variantWithInlineRecord in CompletionExpressions +[extract_type]--> found variant +[nested_expr]--> trying to move into variant payload $0 of constructor 'WithInlineRecord' +[nested_expr]--> found constructor (inline record) +--> found type in nested expression completion [{ "label": "someBoolField", "kind": 4, @@ -730,9 +991,24 @@ Pexp_apply ...[135:11->135:31] (...[135:32->135:66]) Completable: Cexpression CArgument Value[fnTakingInlineRecord]($0)->variantPayload::WithInlineRecord($0), recordField(nestedRecord) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[fnTakingInlineRecord]($0) +--> function argument: $0 ContextPath Value[fnTakingInlineRecord] Path fnTakingInlineRecord +--> found function type +--> found function argument! +[extract_type]--> digging for type variantWithInlineRecord in CompletionExpressions +[extract_type]--> found variant +[nested_expr]--> trying to move into variant payload $0 of constructor 'WithInlineRecord' +[nested_expr]--> found constructor (inline record) +[nested_expr]--> trying to move into record field +[nested_expr]--> found record field type +[nested_expr]--> extracting from type otherRecord in env CompletionExpressions +[extract_type]--> digging for type otherRecord in CompletionExpressions +[extract_type]--> found record +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "{}", "kind": 12, @@ -750,9 +1026,25 @@ Pexp_apply ...[138:11->138:31] (...[138:32->138:69]) Completable: Cexpression CArgument Value[fnTakingInlineRecord]($0)->variantPayload::WithInlineRecord($0), recordField(nestedRecord), recordBody Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[fnTakingInlineRecord]($0) +--> function argument: $0 ContextPath Value[fnTakingInlineRecord] Path fnTakingInlineRecord +--> found function type +--> found function argument! +[extract_type]--> digging for type variantWithInlineRecord in CompletionExpressions +[extract_type]--> found variant +[nested_expr]--> trying to move into variant payload $0 of constructor 'WithInlineRecord' +[nested_expr]--> found constructor (inline record) +[nested_expr]--> trying to move into record field +[nested_expr]--> found record field type +[nested_expr]--> extracting from type otherRecord in env CompletionExpressions +[extract_type]--> digging for type otherRecord in CompletionExpressions +[extract_type]--> found record +[extract_type]--> digging for type otherRecord in CompletionExpressions +[extract_type]--> found record +--> found type in nested expression completion [{ "label": "someField", "kind": 5, @@ -773,9 +1065,17 @@ Pexp_apply ...[159:3->159:19] (...[159:20->159:21]) Completable: Cexpression CArgument Value[fnTakingCallback]($0) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[fnTakingCallback]($0) +--> function argument: $0 ContextPath Value[fnTakingCallback] Path fnTakingCallback +--> found function type +--> found function argument! +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion +[extract_type]--> digging for type unit in CompletionExpressions +[extract_type]--> found nothing when digging [{ "label": "() => {}", "kind": 12, @@ -793,9 +1093,15 @@ Pexp_apply ...[162:3->162:19] (...[162:20->162:21]) Completable: Cexpression CArgument Value[fnTakingCallback]($0)=a Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[fnTakingCallback]($0) +--> function argument: $0 ContextPath Value[fnTakingCallback] Path fnTakingCallback +--> found function type +--> found function argument! +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [] Complete src/CompletionExpressions.res 165:22 @@ -804,9 +1110,17 @@ Pexp_apply ...[165:3->165:19] (...[165:20->165:21]) Completable: Cexpression CArgument Value[fnTakingCallback]($1) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[fnTakingCallback]($1) +--> function argument: $1 ContextPath Value[fnTakingCallback] Path fnTakingCallback +--> found function type +--> found function argument! +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion +[extract_type]--> digging for type unit in CompletionExpressions +[extract_type]--> found nothing when digging [{ "label": "v => {}", "kind": 12, @@ -824,9 +1138,17 @@ Pexp_apply ...[168:3->168:19] (...[168:20->168:21], ...[168:23->168:24]) Completable: Cexpression CArgument Value[fnTakingCallback]($2) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[fnTakingCallback]($2) +--> function argument: $2 ContextPath Value[fnTakingCallback] Path fnTakingCallback +--> found function type +--> found function argument! +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion +[extract_type]--> digging for type unit in CompletionExpressions +[extract_type]--> found nothing when digging [{ "label": "event => {}", "kind": 12, @@ -844,9 +1166,17 @@ Pexp_apply ...[171:3->171:19] (...[171:20->171:21], ...[171:23->171:24], ...[171 Completable: Cexpression CArgument Value[fnTakingCallback]($3) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[fnTakingCallback]($3) +--> function argument: $3 ContextPath Value[fnTakingCallback] Path fnTakingCallback +--> found function type +--> found function argument! +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion +[extract_type]--> digging for type int in CompletionExpressions +[extract_type]--> found nothing when digging [{ "label": "(~on, ~off=?, variant) => {}", "kind": 12, @@ -864,9 +1194,17 @@ Pexp_apply ...[174:3->174:19] (...[174:20->174:21], ...[174:23->174:24], ...[174 Completable: Cexpression CArgument Value[fnTakingCallback]($4) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[fnTakingCallback]($4) +--> function argument: $4 ContextPath Value[fnTakingCallback] Path fnTakingCallback +--> found function type +--> found function argument! +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion +[extract_type]--> digging for type unit in CompletionExpressions +[extract_type]--> found nothing when digging [{ "label": "(v1, v2, v3) => {}", "kind": 12, @@ -884,9 +1222,17 @@ Pexp_apply ...[177:3->177:19] (...[177:20->177:21], ...[177:23->177:24], ...[177 Completable: Cexpression CArgument Value[fnTakingCallback]($5) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[fnTakingCallback]($5) +--> function argument: $5 ContextPath Value[fnTakingCallback] Path fnTakingCallback +--> found function type +--> found function argument! +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion +[extract_type]--> digging for type int in CompletionExpressions +[extract_type]--> found nothing when digging [{ "label": "(~on=?, ~off=?, ()) => {}", "kind": 12, @@ -908,9 +1254,15 @@ Pexp_apply ...[185:2->185:8] (...[185:9->185:10]) Completable: Cexpression CArgument Value[Js, log]($0)=s Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[Js, log]($0) +--> function argument: $0 ContextPath Value[Js, log] Path Js.log +--> found function type +--> found function argument! +[extract_type]--> miss +--> could not get completions for context path [{ "label": "second2", "kind": 12, @@ -960,9 +1312,16 @@ Pexp_apply ...[205:3->205:10] (...[205:11->205:12]) Completable: Cexpression CArgument Value[takesCb]($0) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[takesCb]($0) +--> function argument: $0 ContextPath Value[takesCb] Path takesCb +--> found function type +--> found function argument! +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion +[extract_type]--> miss [{ "label": "someTyp => {}", "kind": 12, @@ -980,9 +1339,16 @@ Pexp_apply ...[216:3->216:11] (...[216:12->216:13]) Completable: Cexpression CArgument Value[takesCb2]($0) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[takesCb2]($0) +--> function argument: $0 ContextPath Value[takesCb2] Path takesCb2 +--> found function type +--> found function argument! +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion +[extract_type]--> miss [{ "label": "environment => {}", "kind": 12, @@ -1000,9 +1366,16 @@ Pexp_apply ...[225:3->225:11] (...[225:12->225:13]) Completable: Cexpression CArgument Value[takesCb3]($0) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[takesCb3]($0) +--> function argument: $0 ContextPath Value[takesCb3] Path takesCb3 +--> found function type +--> found function argument! +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion +[extract_type]--> miss [{ "label": "apiCallResult => {}", "kind": 12, @@ -1020,9 +1393,16 @@ Pexp_apply ...[232:3->232:11] (...[232:12->232:13]) Completable: Cexpression CArgument Value[takesCb4]($0) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[takesCb4]($0) +--> function argument: $0 ContextPath Value[takesCb4] Path takesCb4 +--> found function type +--> found function argument! +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion +[extract_type]--> miss [{ "label": "apiCallResult => {}", "kind": 12, @@ -1040,9 +1420,16 @@ Pexp_apply ...[239:3->239:11] (...[239:12->239:13]) Completable: Cexpression CArgument Value[takesCb5]($0) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[takesCb5]($0) +--> function argument: $0 ContextPath Value[takesCb5] Path takesCb5 +--> found function type +--> found function argument! +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion +[extract_type]--> miss [{ "label": "apiCallResults => {}", "kind": 12, @@ -1060,9 +1447,17 @@ Pexp_apply ...[250:3->250:20] (~updater250:22->250:29=...__ghost__[0:-1->0:-1]) Completable: Cexpression CArgument Value[commitLocalUpdate](~updater) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[commitLocalUpdate](~updater) +--> function argument: updater ContextPath Value[commitLocalUpdate] Path commitLocalUpdate +--> found function type +--> found function argument! +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion +[extract_type]--> digging for type unit in CompletionExpressions +[extract_type]--> found nothing when digging [{ "label": "recordSourceSelectorProxy => {}", "kind": 12, @@ -1080,9 +1475,15 @@ Pexp_apply ...[257:3->257:24] (...[257:25->257:26]) Completable: Cexpression CArgument Value[fnTakingAsyncCallback]($0) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[fnTakingAsyncCallback]($0) +--> function argument: $0 ContextPath Value[fnTakingAsyncCallback] Path fnTakingAsyncCallback +--> found function type +--> found function argument! +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "async () => {}", "kind": 12, @@ -1099,9 +1500,16 @@ posCursor:[262:23] posNoWhite:[262:22] Found expr:[262:3->262:24] Completable: Cexpression CArgument Value[Belt, Array, map]($1) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[Belt, Array, map]($1) +--> function argument: $1 ContextPath Value[Belt, Array, map] Path Belt.Array.map +--> found function type +--> found function argument! +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion +[extract_type]--> miss [{ "label": "v => {}", "kind": 12, @@ -1119,9 +1527,17 @@ Pexp_apply ...[271:3->271:14] (...[271:15->271:16]) Completable: Cexpression CArgument Value[takesExotic]($0) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[takesExotic]($0) +--> function argument: $0 ContextPath Value[takesExotic] Path takesExotic +--> found function type +--> found function argument! +[extract_type]--> digging for type exoticPolyvariant in CompletionExpressions +[extract_type]--> found type manifest +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "#\"some exotic\"", "kind": 4, @@ -1138,9 +1554,17 @@ Pexp_apply ...[278:3->278:22] (...[278:23->278:24]) Completable: Cexpression CArgument Value[fnTakingPolyVariant]($0) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[fnTakingPolyVariant]($0) +--> function argument: $0 ContextPath Value[fnTakingPolyVariant] Path fnTakingPolyVariant +--> found function type +--> found function argument! +[extract_type]--> digging for type somePolyVariant in CompletionExpressions +[extract_type]--> found type manifest +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "#one", "kind": 4, @@ -1173,9 +1597,17 @@ Pexp_apply ...[281:3->281:22] (...[281:23->281:25], ...[290:0->290:16]) Completable: Cexpression CArgument Value[fnTakingPolyVariant]($0)=# Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[fnTakingPolyVariant]($0) +--> function argument: $0 ContextPath Value[fnTakingPolyVariant] Path fnTakingPolyVariant +--> found function type +--> found function argument! +[extract_type]--> digging for type somePolyVariant in CompletionExpressions +[extract_type]--> found type manifest +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "#one", "kind": 4, @@ -1208,9 +1640,17 @@ Pexp_apply ...[284:3->284:22] (...[284:23->284:25]) Completable: Cexpression CArgument Value[fnTakingPolyVariant]($0)=#o Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[fnTakingPolyVariant]($0) +--> function argument: $0 ContextPath Value[fnTakingPolyVariant] Path fnTakingPolyVariant +--> found function type +--> found function argument! +[extract_type]--> digging for type somePolyVariant in CompletionExpressions +[extract_type]--> found type manifest +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "#one", "kind": 4, @@ -1227,9 +1667,17 @@ Pexp_apply ...[287:3->287:22] (...[287:23->287:24]) Completable: Cexpression CArgument Value[fnTakingPolyVariant]($0)=o Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[fnTakingPolyVariant]($0) +--> function argument: $0 ContextPath Value[fnTakingPolyVariant] Path fnTakingPolyVariant +--> found function type +--> found function argument! +[extract_type]--> digging for type somePolyVariant in CompletionExpressions +[extract_type]--> found type manifest +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "#one", "kind": 4, diff --git a/analysis/tests/src/expected/CompletionFunctionArguments.res.txt b/analysis/tests/src/expected/CompletionFunctionArguments.res.txt index 85010ef4f..cd9d25605 100644 --- a/analysis/tests/src/expected/CompletionFunctionArguments.res.txt +++ b/analysis/tests/src/expected/CompletionFunctionArguments.res.txt @@ -4,9 +4,15 @@ Pexp_apply ...[10:11->10:17] (~isOn10:19->10:23=...__ghost__[0:-1->0:-1]) Completable: Cexpression CArgument Value[someFn](~isOn) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[someFn](~isOn) +--> function argument: isOn ContextPath Value[someFn] Path someFn +--> found function type +--> found function argument! +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "true", "kind": 4, @@ -27,9 +33,15 @@ Pexp_apply ...[13:11->13:17] (~isOn13:19->13:23=...[13:24->13:25]) Completable: Cexpression CArgument Value[someFn](~isOn)=t Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[someFn](~isOn) +--> function argument: isOn ContextPath Value[someFn] Path someFn +--> found function type +--> found function argument! +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "true", "kind": 4, @@ -51,9 +63,15 @@ Pexp_apply ...[16:11->16:17] (~isOff16:19->16:24=...__ghost__[0:-1->0:-1]) Completable: Cexpression CArgument Value[someFn](~isOff) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[someFn](~isOff) +--> function argument: isOff ContextPath Value[someFn] Path someFn +--> found function type +--> found function argument! +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "true", "kind": 4, @@ -78,9 +96,15 @@ Pexp_apply ...[21:14->21:20] (~isOn21:22->21:26=...__ghost__[0:-1->0:-1]) Completable: Cexpression CArgument Value[someFn](~isOn) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[someFn](~isOn) +--> function argument: isOn ContextPath Value[someFn] Path someFn +--> found function type +--> found function argument! +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "true", "kind": 4, @@ -101,9 +125,15 @@ Pexp_apply ...[34:11->34:22] (...[34:23->34:24]) Completable: Cexpression CArgument Value[someOtherFn]($0)=f Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[someOtherFn]($0) +--> function argument: $0 ContextPath Value[someOtherFn] Path someOtherFn +--> found function type +--> found function argument! +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "false", "kind": 4, @@ -118,9 +148,17 @@ Pexp_apply ...[51:11->51:30] (~config51:32->51:38=...__ghost__[0:-1->0:-1]) Completable: Cexpression CArgument Value[someFnTakingVariant](~config) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[someFnTakingVariant](~config) +--> function argument: config ContextPath Value[someFnTakingVariant] Path someFnTakingVariant +--> found function type +--> found function argument! +[extract_type]--> digging for type someVariant in CompletionFunctionArguments +[extract_type]--> found variant +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "One", "kind": 4, @@ -153,9 +191,17 @@ Pexp_apply ...[54:11->54:30] (~config54:32->54:38=...[54:39->54:40]) Completable: Cexpression CArgument Value[someFnTakingVariant](~config)=O Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[someFnTakingVariant](~config) +--> function argument: config ContextPath Value[someFnTakingVariant] Path someFnTakingVariant +--> found function type +--> found function argument! +[extract_type]--> digging for type someVariant in CompletionFunctionArguments +[extract_type]--> found variant +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "One", "kind": 4, @@ -191,9 +237,17 @@ Pexp_apply ...[57:11->57:30] (...[57:31->57:33]) Completable: Cexpression CArgument Value[someFnTakingVariant]($0)=So Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[someFnTakingVariant]($0) +--> function argument: $0 ContextPath Value[someFnTakingVariant] Path someFnTakingVariant +--> found function type +--> found function argument! +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion +[extract_type]--> digging for type someVariant in CompletionFunctionArguments +[extract_type]--> found variant [{ "label": "Some(_)", "kind": 12, @@ -217,9 +271,17 @@ Pexp_apply ...[60:11->60:30] (~configOpt260:32->60:42=...[60:43->60:44]) Completable: Cexpression CArgument Value[someFnTakingVariant](~configOpt2)=O Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[someFnTakingVariant](~configOpt2) +--> function argument: configOpt2 ContextPath Value[someFnTakingVariant] Path someFnTakingVariant +--> found function type +--> found function argument! +[extract_type]--> digging for type someVariant in CompletionFunctionArguments +[extract_type]--> found variant +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "One", "kind": 4, @@ -255,9 +317,15 @@ Pexp_apply ...[63:11->63:22] (...[63:23->63:24]) Completable: Cexpression CArgument Value[someOtherFn]($0) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[someOtherFn]($0) +--> function argument: $0 ContextPath Value[someOtherFn] Path someOtherFn +--> found function type +--> found function argument! +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "true", "kind": 4, @@ -278,9 +346,15 @@ Pexp_apply ...[66:11->66:22] (...[66:23->66:24], ...[66:26->66:27]) Completable: Cexpression CArgument Value[someOtherFn]($2) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[someOtherFn]($2) +--> function argument: $2 ContextPath Value[someOtherFn] Path someOtherFn +--> found function type +--> found function argument! +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "true", "kind": 4, @@ -300,9 +374,15 @@ posCursor:[69:30] posNoWhite:[69:29] Found expr:[69:11->69:31] Completable: Cexpression CArgument Value[someOtherFn]($2)=t Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[someOtherFn]($2) +--> function argument: $2 ContextPath Value[someOtherFn] Path someOtherFn +--> found function type +--> found function argument! +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "true", "kind": 4, @@ -324,9 +404,15 @@ Pexp_apply ...[76:11->76:24] (...[76:25->76:26]) Completable: Cexpression CArgument Value[fnTakingTuple]($0) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[fnTakingTuple]($0) +--> function argument: $0 ContextPath Value[fnTakingTuple] Path fnTakingTuple +--> found function type +--> found function argument! +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "(_, _, _)", "kind": 12, @@ -343,9 +429,18 @@ Pexp_apply ...[89:11->89:25] (...[89:26->89:28]) Completable: Cexpression CArgument Value[fnTakingRecord]($0)->recordBody Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[fnTakingRecord]($0) +--> function argument: $0 ContextPath Value[fnTakingRecord] Path fnTakingRecord +--> found function type +--> found function argument! +[extract_type]--> digging for type someRecord in CompletionFunctionArguments +[extract_type]--> found record +[extract_type]--> digging for type someRecord in CompletionFunctionArguments +[extract_type]--> found record +--> found type in nested expression completion [{ "label": "age", "kind": 5, diff --git a/analysis/tests/src/expected/CompletionInferValues.res.txt b/analysis/tests/src/expected/CompletionInferValues.res.txt index d9e28dd9c..d8421680a 100644 --- a/analysis/tests/src/expected/CompletionInferValues.res.txt +++ b/analysis/tests/src/expected/CompletionInferValues.res.txt @@ -94,9 +94,15 @@ ContextPath Value[someRecord]."" ContextPath Value[someRecord] Path someRecord ContextPath CArgument CArgument Value[someFnWithCallback]($0)(~someRecord) +--> function argument: someRecord ContextPath CArgument Value[someFnWithCallback]($0) +--> function argument: $0 ContextPath Value[someFnWithCallback] Path someFnWithCallback +--> found function type +--> found function argument! +--> found function type +--> found function argument! [{ "label": "name", "kind": 5, @@ -126,11 +132,17 @@ ContextPath Value[someRecord]."" ContextPath Value[someRecord] Path someRecord ContextPath CArgument CArgument Value[aliasedFn]($0)(~someRecord) +--> function argument: someRecord ContextPath CArgument Value[aliasedFn]($0) +--> function argument: $0 ContextPath Value[aliasedFn] Path aliasedFn ContextPath Value[someFnWithCallback] Path someFnWithCallback +--> found function type +--> found function argument! +--> found function type +--> found function argument! [{ "label": "name", "kind": 5, @@ -157,9 +169,15 @@ ContextPath Value[event]->pr ContextPath Value[event] Path event ContextPath CArgument CArgument Value[reactEventFn]($0)($0) +--> function argument: $0 ContextPath CArgument Value[reactEventFn]($0) +--> function argument: $0 ContextPath Value[reactEventFn] Path reactEventFn +--> found function type +--> found function argument! +--> found function type +--> found function argument! CPPipe env:CompletionInferValues CPPipe type path:ReactEvent.Mouse.t CPPipe pathFromEnv:ReactEvent.Mouse found:false @@ -184,9 +202,12 @@ ContextPath Value[event]->pr <> ContextPath Value[event] Path event ContextPath CArgument CJsxPropValue [div] onMouseEnter($0) +--> function argument: $0 ContextPath CJsxPropValue [div] onMouseEnter Path ReactDOM.domProps Path Pervasives.JsxDOM.domProps +--> found function type +--> found function argument! CPPipe env:CompletionInferValues CPPipe type path:JsxEventC.Mouse.t CPPipe pathFromEnv:JsxEventC.Mouse found:false @@ -211,8 +232,11 @@ ContextPath Value[event]->pr <> ContextPath Value[event] Path event ContextPath CArgument CJsxPropValue [Div] onMouseEnter($0) +--> function argument: $0 ContextPath CJsxPropValue [Div] onMouseEnter Path Div.make +--> found function type +--> found function argument! CPPipe env:CompletionInferValues envFromCompletionItem:CompletionInferValues.Div CPPipe type path:Pervasives.JsxEvent.Mouse.t CPPipe pathFromEnv:Pervasives.JsxEvent.Mouse found:false @@ -419,6 +443,8 @@ ContextPath Value[x] Path x ContextPath Type[someRecordWithNestedStuff] Path someRecordWithNestedStuff +[extract_type]--> digging for type someNestedRecord in CompletionInferValues +[extract_type]--> found record [{ "label": "name", "kind": 5, @@ -551,6 +577,8 @@ ContextPath Value[x] Path x ContextPath Type[otherNestedRecord] Path otherNestedRecord +[extract_type]--> digging for type someVariant in CompletionInferValues +[extract_type]--> found variant CPPipe env:CompletionInferValues Path Js.String2.slic [{ @@ -580,6 +608,8 @@ ContextPath Value[x] Path x ContextPath Type[otherNestedRecord] Path otherNestedRecord +[extract_type]--> digging for type somePolyVariant in CompletionInferValues +[extract_type]--> found type manifest CPPipe env:CompletionInferValues Path Js.String2.slic [{ @@ -609,6 +639,8 @@ ContextPath Value[x] Path x ContextPath Type[otherNestedRecord] Path otherNestedRecord +[extract_type]--> digging for type someRecord in CompletionInferValues +[extract_type]--> found record CPPipe env:CompletionInferValues Path Js.String2.slic [{ @@ -685,9 +717,19 @@ Completable: Cpattern CArgument CArgument Value[fnWithRecordCallback]($0)($0)->r Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument CArgument Value[fnWithRecordCallback]($0)($0) +--> function argument: $0 ContextPath CArgument Value[fnWithRecordCallback]($0) +--> function argument: $0 ContextPath Value[fnWithRecordCallback] Path fnWithRecordCallback +--> found function type +--> found function argument! +--> found function type +--> found function argument! +[extract_type]--> digging for type someRecord in CompletionInferValues +[extract_type]--> found record +[extract_type]--> digging for type someRecord in CompletionInferValues +[extract_type]--> found record [{ "label": "name", "kind": 5, @@ -716,9 +758,17 @@ ContextPath Value[root] Path root ContextPath CPatternPath(CArgument CArgument Value[fn2](~cb)($0))->recordField(root) ContextPath CArgument CArgument Value[fn2](~cb)($0) +--> function argument: $0 ContextPath CArgument Value[fn2](~cb) +--> function argument: cb ContextPath Value[fn2] Path fn2 +--> found function type +--> found function argument! +--> found function type +--> found function argument! +[extract_type]--> digging for type CompletionSupport.Nested.config in CompletionInferValues +[extract_type]--> found record CPPipe env:CompletionInferValues CPPipe type path:ReactDOM.Client.Root.t CPPipe pathFromEnv:ReactDOM.Client.Root found:false @@ -751,9 +801,17 @@ ContextPath Value[root] Path root ContextPath CPatternPath(CArgument CArgument Value[fn3](~cb)($0))->recordField(root) ContextPath CArgument CArgument Value[fn3](~cb)($0) +--> function argument: $0 ContextPath CArgument Value[fn3](~cb) +--> function argument: cb ContextPath Value[fn3] Path fn3 +--> found function type +--> found function argument! +--> found function type +--> found function argument! +[extract_type]--> digging for type sameFileRecord in CompletionInferValues +[extract_type]--> found record CPPipe env:CompletionInferValues CPPipe type path:CompletionSupport.Test.t CPPipe pathFromEnv:CompletionSupport.Test found:false @@ -786,6 +844,7 @@ Resolved opens 1 pervasives ContextPath Value[Belt, Int, toString](Nolabel) ContextPath Value[Belt, Int, toString] Path Belt.Int.toString +[nested_expr]--> reached end of pattern, returning type [{ "label": "\"\"", "kind": 12, @@ -805,6 +864,7 @@ Resolved opens 1 pervasives ContextPath Value[Js, String2, split](Nolabel, Nolabel) ContextPath Value[Js, String2, split] Path Js.String2.split +[nested_expr]--> reached end of pattern, returning type [{ "label": "[]", "kind": 12, @@ -830,9 +890,17 @@ ContextPath Value[support] Path support ContextPath CPatternPath(CArgument CArgument Value[CompletionSupport2, makeRenderer](~render)($0))->recordField(support) ContextPath CArgument CArgument Value[CompletionSupport2, makeRenderer](~render)($0) +--> function argument: $0 ContextPath CArgument Value[CompletionSupport2, makeRenderer](~render) +--> function argument: render ContextPath Value[CompletionSupport2, makeRenderer] Path CompletionSupport2.makeRenderer +--> found function type +--> found function argument! +--> found function type +--> found function argument! +[extract_type]--> digging for type Internal.prepareProps in CompletionSupport2 +[extract_type]--> found record [{ "label": "root", "kind": 5, @@ -855,9 +923,19 @@ ContextPath Value[root] Path root ContextPath CPatternPath(CArgument CArgument Value[CompletionSupport2, makeRenderer](~render)($0))->recordField(support)->recordField(root) ContextPath CArgument CArgument Value[CompletionSupport2, makeRenderer](~render)($0) +--> function argument: $0 ContextPath CArgument Value[CompletionSupport2, makeRenderer](~render) +--> function argument: render ContextPath Value[CompletionSupport2, makeRenderer] Path CompletionSupport2.makeRenderer +--> found function type +--> found function argument! +--> found function type +--> found function argument! +[extract_type]--> digging for type Internal.prepareProps in CompletionSupport2 +[extract_type]--> found record +[extract_type]--> digging for type CompletionSupport.Nested.config in CompletionSupport2 +[extract_type]--> found record CPPipe env:CompletionInferValues envFromCompletionItem:CompletionSupport2.Internal CPPipe type path:ReactDOM.Client.Root.t CPPipe pathFromEnv:ReactDOM.Client.Root found:false diff --git a/analysis/tests/src/expected/CompletionJsx.res.txt b/analysis/tests/src/expected/CompletionJsx.res.txt index 234b2b221..ab9ed96c5 100644 --- a/analysis/tests/src/expected/CompletionJsx.res.txt +++ b/analysis/tests/src/expected/CompletionJsx.res.txt @@ -479,8 +479,11 @@ JSX 48:17] someProp[48:18->48:26]=...[48:18->48:26]> _chil Completable: Cexpression CJsxPropValue [SomeComponent] someProp Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CJsxPropValue [SomeComponent] someProp Path SomeComponent.make +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "\"\"", "kind": 12, diff --git a/analysis/tests/src/expected/CompletionJsxProps.res.txt b/analysis/tests/src/expected/CompletionJsxProps.res.txt index b4612a73a..621cc47b6 100644 --- a/analysis/tests/src/expected/CompletionJsxProps.res.txt +++ b/analysis/tests/src/expected/CompletionJsxProps.res.txt @@ -4,8 +4,11 @@ JSX 0:43] on[0:44->0:46]=...__ghost__[0: Completable: Cexpression CJsxPropValue [CompletionSupport, TestComponent] on Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CJsxPropValue [CompletionSupport, TestComponent] on Path CompletionSupport.TestComponent.make +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "true", "kind": 4, @@ -26,8 +29,11 @@ JSX 3:43] on[3:44->3:46]=...[3:47->3:48] Completable: Cexpression CJsxPropValue [CompletionSupport, TestComponent] on=t Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CJsxPropValue [CompletionSupport, TestComponent] on Path CompletionSupport.TestComponent.make +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "true", "kind": 4, @@ -42,8 +48,13 @@ JSX 6:43] test[6:44->6:48]=...[6:49->6:5 Completable: Cexpression CJsxPropValue [CompletionSupport, TestComponent] test=T Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CJsxPropValue [CompletionSupport, TestComponent] test Path CompletionSupport.TestComponent.make +[extract_type]--> digging for type testVariant in CompletionSupport +[extract_type]--> found variant +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "Two", "kind": 4, @@ -88,8 +99,11 @@ JSX 9:43] polyArg[9:44->9:51]=...__ghost Completable: Cexpression CJsxPropValue [CompletionSupport, TestComponent] polyArg Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CJsxPropValue [CompletionSupport, TestComponent] polyArg Path CompletionSupport.TestComponent.make +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "#one", "kind": 4, @@ -130,8 +144,11 @@ JSX 12:43] polyArg[12:44->12:51]=...[12 Completable: Cexpression CJsxPropValue [CompletionSupport, TestComponent] polyArg=#t Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CJsxPropValue [CompletionSupport, TestComponent] polyArg Path CompletionSupport.TestComponent.make +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "#three(_, _)", "kind": 4, @@ -164,9 +181,12 @@ JSX 15:15] muted[15:16->15:21]=...__ghost__[0:-1->0:-1]> _children: Completable: Cexpression CJsxPropValue [div] muted Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CJsxPropValue [div] muted Path ReactDOM.domProps Path Pervasives.JsxDOM.domProps +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "true", "kind": 4, @@ -187,9 +207,14 @@ JSX 18:15] onMouseEnter[18:16->18:28]=...__ghost__[0:-1->0:-1]> _ch Completable: Cexpression CJsxPropValue [div] onMouseEnter Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CJsxPropValue [div] onMouseEnter Path ReactDOM.domProps Path Pervasives.JsxDOM.domProps +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion +[extract_type]--> digging for type unit in CompletionJsxProps +[extract_type]--> found nothing when digging [{ "label": "event => {}", "kind": 12, @@ -207,8 +232,11 @@ JSX 22:43] testArr[22:44->22:51]=...__g Completable: Cexpression CJsxPropValue [CompletionSupport, TestComponent] testArr Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CJsxPropValue [CompletionSupport, TestComponent] testArr Path CompletionSupport.TestComponent.make +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "[]", "kind": 12, @@ -226,8 +254,13 @@ JSX 26:43] testArr[26:44->26:51]=...[26 Completable: Cexpression CJsxPropValue [CompletionSupport, TestComponent] testArr->array Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CJsxPropValue [CompletionSupport, TestComponent] testArr Path CompletionSupport.TestComponent.make +[extract_type]--> digging for type testVariant in CompletionSupport +[extract_type]--> found variant +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "One", "kind": 4, diff --git a/analysis/tests/src/expected/CompletionPattern.res.txt b/analysis/tests/src/expected/CompletionPattern.res.txt index 850c64919..a90b66937 100644 --- a/analysis/tests/src/expected/CompletionPattern.res.txt +++ b/analysis/tests/src/expected/CompletionPattern.res.txt @@ -9,6 +9,7 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[v] Path v +[nested_expr]--> reached end of pattern, returning type [{ "label": "(_, _, _)", "kind": 12, @@ -27,6 +28,8 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[v] Path v +[nested_expr]--> trying to move into tuple +[nested_expr]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -44,6 +47,9 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[v] Path v +[nested_expr]--> trying to move into tuple +[nested_expr]--> trying to move into tuple +[nested_expr]--> reached end of pattern, returning type [{ "label": "false", "kind": 4, @@ -59,6 +65,7 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[x] Path x +[nested_expr]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -80,6 +87,7 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[x] Path x +[nested_expr]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -95,6 +103,9 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[f] Path f +[extract_type]--> digging for type someRecord in CompletionPattern +[extract_type]--> found record +[nested_expr]--> reached end of pattern, returning type [{ "label": "{}", "kind": 22, @@ -113,6 +124,10 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[f] Path f +[extract_type]--> digging for type someRecord in CompletionPattern +[extract_type]--> found record +[extract_type]--> digging for type someRecord in CompletionPattern +[extract_type]--> found record [{ "label": "first", "kind": 5, @@ -146,6 +161,10 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[f] Path f +[extract_type]--> digging for type someRecord in CompletionPattern +[extract_type]--> found record +[extract_type]--> digging for type someRecord in CompletionPattern +[extract_type]--> found record [{ "label": "optThird", "kind": 5, @@ -168,6 +187,10 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[f] Path f +[extract_type]--> digging for type someRecord in CompletionPattern +[extract_type]--> found record +[extract_type]--> digging for type someRecord in CompletionPattern +[extract_type]--> found record [{ "label": "first", "kind": 5, @@ -185,6 +208,11 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[z] Path z +[nested_expr]--> trying to move into tuple +[extract_type]--> digging for type someRecord in CompletionPattern +[extract_type]--> found record +[extract_type]--> digging for type someRecord in CompletionPattern +[extract_type]--> found record [{ "label": "optThird", "kind": 5, @@ -200,6 +228,14 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[f] Path f +[extract_type]--> digging for type someRecord in CompletionPattern +[extract_type]--> found record +[nested_expr]--> trying to move into record field +[nested_expr]--> found record field type +[nested_expr]--> extracting from type nestedRecord in env CompletionPattern +[extract_type]--> digging for type nestedRecord in CompletionPattern +[extract_type]--> found record +[nested_expr]--> reached end of pattern, returning type [{ "label": "{}", "kind": 22, @@ -219,6 +255,15 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[f] Path f +[extract_type]--> digging for type someRecord in CompletionPattern +[extract_type]--> found record +[nested_expr]--> trying to move into record field +[nested_expr]--> found record field type +[nested_expr]--> extracting from type nestedRecord in env CompletionPattern +[extract_type]--> digging for type nestedRecord in CompletionPattern +[extract_type]--> found record +[extract_type]--> digging for type nestedRecord in CompletionPattern +[extract_type]--> found record [{ "label": "nested", "kind": 5, @@ -236,6 +281,10 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[nest] Path nest +[extract_type]--> digging for type nestedRecord in CompletionPattern +[extract_type]--> found record +[extract_type]--> digging for type nestedRecord in CompletionPattern +[extract_type]--> found record [{ "label": "nested", "kind": 5, @@ -251,6 +300,10 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[f] Path f +[extract_type]--> digging for type someRecord in CompletionPattern +[extract_type]--> found record +[extract_type]--> digging for type someRecord in CompletionPattern +[extract_type]--> found record [{ "label": "first", "kind": 5, @@ -286,6 +339,15 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[f] Path f +[extract_type]--> digging for type someRecord in CompletionPattern +[extract_type]--> found record +[nested_expr]--> trying to move into record field +[nested_expr]--> found record field type +[nested_expr]--> extracting from type nestedRecord in env CompletionPattern +[extract_type]--> digging for type nestedRecord in CompletionPattern +[extract_type]--> found record +[extract_type]--> digging for type nestedRecord in CompletionPattern +[extract_type]--> found record [{ "label": "nested", "kind": 5, @@ -304,6 +366,13 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[z] Path z +[extract_type]--> digging for type someVariant in CompletionPattern +[extract_type]--> found variant +[nested_expr]--> trying to move into variant payload $0 of constructor 'Two' +[nested_expr]--> found constructor (Args type) +[nested_expr]--> found arg of type: bool +[nested_expr]--> extracted type, continuing descent +[nested_expr]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -327,6 +396,13 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[z] Path z +[extract_type]--> digging for type someVariant in CompletionPattern +[extract_type]--> found variant +[nested_expr]--> trying to move into variant payload $0 of constructor 'Two' +[nested_expr]--> found constructor (Args type) +[nested_expr]--> found arg of type: bool +[nested_expr]--> extracted type, continuing descent +[nested_expr]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -344,6 +420,16 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[z] Path z +[extract_type]--> digging for type someVariant in CompletionPattern +[extract_type]--> found variant +[nested_expr]--> trying to move into variant payload $0 of constructor 'Three' +[nested_expr]--> found constructor (Args type) +[nested_expr]--> found arg of type: someRecord +[extract_type]--> digging for type someRecord in CompletionPattern +[extract_type]--> found record +[nested_expr]--> extracted type, continuing descent +[extract_type]--> digging for type someRecord in CompletionPattern +[extract_type]--> found record [{ "label": "first", "kind": 5, @@ -380,6 +466,13 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[z] Path z +[extract_type]--> digging for type someVariant in CompletionPattern +[extract_type]--> found variant +[nested_expr]--> trying to move into variant payload $1 of constructor 'Three' +[nested_expr]--> found constructor (Args type) +[nested_expr]--> found arg of type: bool +[nested_expr]--> extracted type, continuing descent +[nested_expr]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -397,6 +490,9 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[b] Path b +[extract_type]--> digging for type somePolyVariant in CompletionPattern +[extract_type]--> found type manifest +[nested_expr]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -419,6 +515,9 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[b] Path b +[extract_type]--> digging for type somePolyVariant in CompletionPattern +[extract_type]--> found type manifest +[nested_expr]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -435,6 +534,12 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[b] Path b +[extract_type]--> digging for type somePolyVariant in CompletionPattern +[extract_type]--> found type manifest +[extract_type]--> digging for type someRecord in CompletionPattern +[extract_type]--> found record +[extract_type]--> digging for type someRecord in CompletionPattern +[extract_type]--> found record [{ "label": "first", "kind": 5, @@ -470,6 +575,9 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[b] Path b +[extract_type]--> digging for type somePolyVariant in CompletionPattern +[extract_type]--> found type manifest +[nested_expr]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -485,6 +593,7 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[c] Path c +[nested_expr]--> reached end of pattern, returning type [{ "label": "[]", "kind": 12, @@ -503,6 +612,7 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[c] Path c +[nested_expr]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -527,6 +637,8 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[o] Path o +[nested_expr]--> moving into option Some +[nested_expr]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -549,6 +661,13 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[p] Path p +[extract_type]--> digging for type multiPayloadVariant in CompletionPattern +[extract_type]--> found variant +[nested_expr]--> trying to move into variant payload $1 of constructor 'Test' +[nested_expr]--> found constructor (Args type) +[nested_expr]--> found arg of type: bool +[nested_expr]--> extracted type, continuing descent +[nested_expr]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -572,6 +691,13 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[p] Path p +[extract_type]--> digging for type multiPayloadVariant in CompletionPattern +[extract_type]--> found variant +[nested_expr]--> trying to move into variant payload $2 of constructor 'Test' +[nested_expr]--> found constructor (Args type) +[nested_expr]--> found arg of type: option +[nested_expr]--> extracted type, continuing descent +[nested_expr]--> reached end of pattern, returning type [{ "label": "None", "kind": 12, @@ -609,6 +735,13 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[p] Path p +[extract_type]--> digging for type multiPayloadVariant in CompletionPattern +[extract_type]--> found variant +[nested_expr]--> trying to move into variant payload $1 of constructor 'Test' +[nested_expr]--> found constructor (Args type) +[nested_expr]--> found arg of type: bool +[nested_expr]--> extracted type, continuing descent +[nested_expr]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -632,6 +765,13 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[p] Path p +[extract_type]--> digging for type multiPayloadVariant in CompletionPattern +[extract_type]--> found variant +[nested_expr]--> trying to move into variant payload $3 of constructor 'Test' +[nested_expr]--> found constructor (Args type) +[nested_expr]--> found arg of type: array +[nested_expr]--> extracted type, continuing descent +[nested_expr]--> reached end of pattern, returning type [{ "label": "[]", "kind": 12, @@ -650,6 +790,9 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[v] Path v +[extract_type]--> digging for type multiPayloadPolyVariant in CompletionPattern +[extract_type]--> found type manifest +[nested_expr]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -672,6 +815,9 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[v] Path v +[extract_type]--> digging for type multiPayloadPolyVariant in CompletionPattern +[extract_type]--> found type manifest +[nested_expr]--> reached end of pattern, returning type [{ "label": "None", "kind": 12, @@ -708,6 +854,9 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[v] Path v +[extract_type]--> digging for type multiPayloadPolyVariant in CompletionPattern +[extract_type]--> found type manifest +[nested_expr]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -730,6 +879,9 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[v] Path v +[extract_type]--> digging for type multiPayloadPolyVariant in CompletionPattern +[extract_type]--> found type manifest +[nested_expr]--> reached end of pattern, returning type [{ "label": "[]", "kind": 12, @@ -749,6 +901,8 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[s] Path s +[nested_expr]--> trying to move into tuple +[nested_expr]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -770,6 +924,8 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[s] Path s +[nested_expr]--> trying to move into tuple +[nested_expr]--> reached end of pattern, returning type [{ "label": "None", "kind": 12, @@ -805,6 +961,8 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[s] Path s +[nested_expr]--> trying to move into tuple +[nested_expr]--> reached end of pattern, returning type [{ "label": "None", "kind": 12, @@ -840,6 +998,7 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[s] Path s +[nested_expr]--> reached end of pattern, returning type [{ "label": "(_, _, _)", "kind": 12, @@ -857,6 +1016,8 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[s] Path s +[nested_expr]--> trying to move into tuple +[nested_expr]--> reached end of pattern, returning type [{ "label": "None", "kind": 12, @@ -892,6 +1053,9 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[z] Path z +[extract_type]--> digging for type someVariant in CompletionPattern +[extract_type]--> found variant +[nested_expr]--> reached end of pattern, returning type [{ "label": "One", "kind": 4, @@ -927,6 +1091,13 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[z] Path z +[extract_type]--> digging for type someVariant in CompletionPattern +[extract_type]--> found variant +[nested_expr]--> trying to move into variant payload $0 of constructor 'Two' +[nested_expr]--> found constructor (Args type) +[nested_expr]--> found arg of type: bool +[nested_expr]--> extracted type, continuing descent +[nested_expr]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -951,6 +1122,13 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[z] Path z +[extract_type]--> digging for type someVariant in CompletionPattern +[extract_type]--> found variant +[nested_expr]--> trying to move into variant payload $1 of constructor 'Three' +[nested_expr]--> found constructor (Args type) +[nested_expr]--> found arg of type: bool +[nested_expr]--> extracted type, continuing descent +[nested_expr]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -973,6 +1151,9 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[b] Path b +[extract_type]--> digging for type somePolyVariant in CompletionPattern +[extract_type]--> found type manifest +[nested_expr]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -996,6 +1177,9 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[b] Path b +[extract_type]--> digging for type somePolyVariant in CompletionPattern +[extract_type]--> found type manifest +[nested_expr]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -1018,6 +1202,8 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[s] Path s +[nested_expr]--> trying to move into tuple +[nested_expr]--> reached end of pattern, returning type [{ "label": "None", "kind": 12, @@ -1053,6 +1239,12 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[ff] Path ff +[extract_type]--> digging for type recordWithFn in CompletionPattern +[extract_type]--> found record +[nested_expr]--> trying to move into record field +[nested_expr]--> found record field type +[nested_expr]--> extracting from type unit => unit in env CompletionPattern +[nested_expr]--> reached end of pattern, returning type [] Complete src/CompletionPattern.res 206:16 @@ -1062,6 +1254,7 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[xn] Path xn +[nested_expr]--> reached end of pattern, returning type [{ "label": "Js.Exn.Error(error)", "kind": 4, @@ -1079,6 +1272,9 @@ ContextPath await Value[getThing](Nolabel) ContextPath Value[getThing](Nolabel) ContextPath Value[getThing] Path getThing +[extract_type]--> digging for type someVariant in CompletionPattern +[extract_type]--> found variant +[nested_expr]--> reached end of pattern, returning type [{ "label": "One", "kind": 4, @@ -1115,6 +1311,17 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[res] Path res +[extract_type]--> digging for type Pervasives.result in CompletionPattern +[extract_type]--> found type manifest +[extract_type]--> digging for type Belt.Result.t in CompletionPattern +[extract_type]--> found variant +[nested_expr]--> trying to move into variant payload $0 of constructor 'Ok' +[nested_expr]--> found constructor (Args type) +[nested_expr]--> found arg of type: 'a +[extract_type]--> digging for type someVariant in CompletionPattern +[extract_type]--> found variant +[nested_expr]--> extracted type, continuing descent +[nested_expr]--> reached end of pattern, returning type [{ "label": "One", "kind": 4, @@ -1151,6 +1358,17 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[res] Path res +[extract_type]--> digging for type Pervasives.result in CompletionPattern +[extract_type]--> found type manifest +[extract_type]--> digging for type Belt.Result.t in CompletionPattern +[extract_type]--> found variant +[nested_expr]--> trying to move into variant payload $0 of constructor 'Error' +[nested_expr]--> found constructor (Args type) +[nested_expr]--> found arg of type: 'b +[extract_type]--> digging for type somePolyVariant in CompletionPattern +[extract_type]--> found type manifest +[nested_expr]--> extracted type, continuing descent +[nested_expr]--> reached end of pattern, returning type [{ "label": "#one", "kind": 4, diff --git a/analysis/tests/src/expected/CompletionTypeAnnotation.res.txt b/analysis/tests/src/expected/CompletionTypeAnnotation.res.txt index e2db577b7..f244d8a46 100644 --- a/analysis/tests/src/expected/CompletionTypeAnnotation.res.txt +++ b/analysis/tests/src/expected/CompletionTypeAnnotation.res.txt @@ -3,8 +3,11 @@ XXX Not found! Completable: Cexpression Type[someRecord] Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath Type[someRecord] Path someRecord +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "{}", "kind": 12, @@ -21,8 +24,10 @@ XXX Not found! Completable: Cexpression Type[someRecord]->recordBody Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath Type[someRecord] Path someRecord +--> found type in nested expression completion [{ "label": "age", "kind": 5, @@ -42,8 +47,11 @@ XXX Not found! Completable: Cexpression Type[someVariant] Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath Type[someVariant] Path someVariant +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "One", "kind": 4, @@ -67,8 +75,11 @@ XXX Not found! Completable: Cexpression Type[someVariant]=O Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath Type[someVariant] Path someVariant +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "One", "kind": 4, @@ -97,8 +108,11 @@ XXX Not found! Completable: Cexpression Type[somePolyVariant] Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath Type[somePolyVariant] Path somePolyVariant +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "#one", "kind": 4, @@ -122,8 +136,11 @@ XXX Not found! Completable: Cexpression Type[somePolyVariant]=#o Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath Type[somePolyVariant] Path somePolyVariant +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "#one", "kind": 4, @@ -139,8 +156,11 @@ XXX Not found! Completable: Cexpression Type[someFunc] Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath Type[someFunc] Path someFunc +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "(v1, v2) => {}", "kind": 12, @@ -157,8 +177,11 @@ XXX Not found! Completable: Cexpression Type[someTuple] Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath Type[someTuple] Path someTuple +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "(_, _)", "kind": 12, @@ -174,8 +197,12 @@ XXX Not found! Completable: Cexpression Type[someTuple]->tuple($1) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath Type[someTuple] Path someTuple +[nested_expr]--> trying to move into tuple +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "None", "kind": 12, @@ -209,9 +236,12 @@ XXX Not found! Completable: Cexpression option Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath option ContextPath Type[someVariant] Path someVariant +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "None", "kind": 12, @@ -249,9 +279,13 @@ XXX Not found! Completable: Cexpression option->variantPayload::Some($0) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath option ContextPath Type[someVariant] Path someVariant +[nested_expr]--> moving into option Some +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "One", "kind": 4, @@ -275,9 +309,12 @@ XXX Not found! Completable: Cexpression array Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath array ContextPath Type[someVariant] Path someVariant +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "[]", "kind": 12, @@ -294,9 +331,12 @@ XXX Not found! Completable: Cexpression array->array Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath array ContextPath Type[someVariant] Path someVariant +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "One", "kind": 4, @@ -320,10 +360,13 @@ XXX Not found! Completable: Cexpression array> Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath array> ContextPath option ContextPath Type[someVariant] Path someVariant +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "[]", "kind": 12, @@ -340,10 +383,14 @@ XXX Not found! Completable: Cexpression option>->variantPayload::Some($0), array Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath option> ContextPath array ContextPath Type[someVariant] Path someVariant +[nested_expr]--> moving into option Some +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "One", "kind": 4, diff --git a/analysis/tests/src/expected/Destructuring.res.txt b/analysis/tests/src/expected/Destructuring.res.txt index 978a78816..0f0f5a004 100644 --- a/analysis/tests/src/expected/Destructuring.res.txt +++ b/analysis/tests/src/expected/Destructuring.res.txt @@ -5,6 +5,10 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[x] Path x +[extract_type]--> digging for type x in Destructuring +[extract_type]--> found record +[extract_type]--> digging for type x in Destructuring +[extract_type]--> found record [{ "label": "age", "kind": 5, @@ -20,6 +24,10 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[x] Path x +[extract_type]--> digging for type x in Destructuring +[extract_type]--> found record +[extract_type]--> digging for type x in Destructuring +[extract_type]--> found record [{ "label": "name", "kind": 5, @@ -43,6 +51,10 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[x] Path x +[extract_type]--> digging for type x in Destructuring +[extract_type]--> found record +[extract_type]--> digging for type x in Destructuring +[extract_type]--> found record [{ "label": "age", "kind": 5, @@ -60,6 +72,10 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[x] Path x +[extract_type]--> digging for type x in Destructuring +[extract_type]--> found record +[extract_type]--> digging for type x in Destructuring +[extract_type]--> found record [{ "label": "name", "kind": 5, @@ -81,6 +97,10 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[x] Path x +[extract_type]--> digging for type recordWithOptField in Destructuring +[extract_type]--> found record +[extract_type]--> digging for type recordWithOptField in Destructuring +[extract_type]--> found record [{ "label": "someField", "kind": 5, diff --git a/analysis/tests/src/expected/EnvCompletion.res.txt b/analysis/tests/src/expected/EnvCompletion.res.txt new file mode 100644 index 000000000..dc9fdbe72 --- /dev/null +++ b/analysis/tests/src/expected/EnvCompletion.res.txt @@ -0,0 +1,511 @@ +Complete src/EnvCompletion.res 10:17 +XXX Not found! +Completable: Cpattern Value[res] +Package opens Pervasives.JsxModules.place holder +Resolved opens 1 pervasives +ContextPath Value[res] +Path res +[extract_type]--> digging for type EnvCompletionOtherFile.someResult in EnvCompletion +[extract_type]--> found variant +[nested_expr]--> reached end of pattern, returning type +[{ + "label": "Okay(_)", + "kind": 4, + "tags": [], + "detail": "Okay('a)\n\ntype someResult<'a, 'b> = Okay('a) | Failure('b)", + "documentation": null, + "insertText": "Okay(${1:_})", + "insertTextFormat": 2 + }, { + "label": "Failure(_)", + "kind": 4, + "tags": [], + "detail": "Failure('b)\n\ntype someResult<'a, 'b> = Okay('a) | Failure('b)", + "documentation": null, + "insertText": "Failure(${1:_})", + "insertTextFormat": 2 + }] + +Complete src/EnvCompletion.res 13:23 +posCursor:[13:23] posNoWhite:[13:22] Found pattern:[13:18->13:24] +Ppat_construct Okay:[13:18->13:22] +posCursor:[13:23] posNoWhite:[13:22] Found pattern:[13:22->13:24] +Ppat_construct ():[13:22->13:24] +Completable: Cpattern Value[res]->variantPayload::Okay($0) +Package opens Pervasives.JsxModules.place holder +Resolved opens 1 pervasives +ContextPath Value[res] +Path res +[extract_type]--> digging for type EnvCompletionOtherFile.someResult in EnvCompletion +[extract_type]--> found variant +[nested_expr]--> trying to move into variant payload $0 of constructor 'Okay' +[nested_expr]--> found constructor (Args type) +[nested_expr]--> found arg of type: 'a +[extract_type]--> digging for type things in EnvCompletion +[extract_type]--> found variant +[nested_expr]--> extracted type, continuing descent +[nested_expr]--> reached end of pattern, returning type +[{ + "label": "One", + "kind": 4, + "tags": [], + "detail": "One\n\ntype things = One | Two", + "documentation": null, + "insertText": "One", + "insertTextFormat": 2 + }, { + "label": "Two", + "kind": 4, + "tags": [], + "detail": "Two\n\ntype things = One | Two", + "documentation": null, + "insertText": "Two", + "insertTextFormat": 2 + }] + +Complete src/EnvCompletion.res 16:26 +posCursor:[16:26] posNoWhite:[16:25] Found pattern:[16:18->16:27] +Ppat_construct Failure:[16:18->16:25] +posCursor:[16:26] posNoWhite:[16:25] Found pattern:[16:25->16:27] +Ppat_construct ():[16:25->16:27] +Completable: Cpattern Value[res]->variantPayload::Failure($0) +Package opens Pervasives.JsxModules.place holder +Resolved opens 1 pervasives +ContextPath Value[res] +Path res +[extract_type]--> digging for type EnvCompletionOtherFile.someResult in EnvCompletion +[extract_type]--> found variant +[nested_expr]--> trying to move into variant payload $0 of constructor 'Failure' +[nested_expr]--> found constructor (Args type) +[nested_expr]--> found arg of type: 'b +[nested_expr]--> extracted type, continuing descent +[nested_expr]--> reached end of pattern, returning type +[{ + "label": "\"\"", + "kind": 12, + "tags": [], + "detail": "string", + "documentation": null, + "sortText": "A", + "insertText": "\"$0\"", + "insertTextFormat": 2 + }] + +Complete src/EnvCompletion.res 19:19 +XXX Not found! +Completable: Cpattern Value[use](Nolabel) +Package opens Pervasives.JsxModules.place holder +Resolved opens 1 pervasives +ContextPath Value[use](Nolabel) +ContextPath Value[use] +Path use +[extract_type]--> digging for type EnvCompletionOtherFile.response in EnvCompletion +[extract_type]--> found record +[nested_expr]--> reached end of pattern, returning type +[{ + "label": "{}", + "kind": 22, + "tags": [], + "detail": "EnvCompletionOtherFile.response", + "documentation": null, + "sortText": "A", + "insertText": "{$0}", + "insertTextFormat": 2 + }] + +Complete src/EnvCompletion.res 22:21 +posCursor:[22:21] posNoWhite:[22:20] Found pattern:[22:20->22:22] +Completable: Cpattern Value[use](Nolabel)->recordBody +Package opens Pervasives.JsxModules.place holder +Resolved opens 1 pervasives +ContextPath Value[use](Nolabel) +ContextPath Value[use] +Path use +[extract_type]--> digging for type EnvCompletionOtherFile.response in EnvCompletion +[extract_type]--> found record +[extract_type]--> digging for type EnvCompletionOtherFile.response in EnvCompletionOtherFile +[extract_type]--> found record +[{ + "label": "stuff", + "kind": 5, + "tags": [], + "detail": "stuff: theVariant\n\nEnvCompletionOtherFile.response", + "documentation": null + }, { + "label": "res", + "kind": 5, + "tags": [], + "detail": "res: someResult\n\nEnvCompletionOtherFile.response", + "documentation": null + }] + +Complete src/EnvCompletion.res 25:27 +posCursor:[25:27] posNoWhite:[25:26] Found pattern:[25:20->25:31] +Completable: Cpattern Value[use](Nolabel)->recordField(stuff) +Package opens Pervasives.JsxModules.place holder +Resolved opens 1 pervasives +ContextPath Value[use](Nolabel) +ContextPath Value[use] +Path use +[extract_type]--> digging for type EnvCompletionOtherFile.response in EnvCompletion +[extract_type]--> found record +[nested_expr]--> trying to move into record field +[nested_expr]--> found record field type +[nested_expr]--> extracting from type theVariant in env EnvCompletionOtherFile +[extract_type]--> digging for type theVariant in EnvCompletionOtherFile +[extract_type]--> found variant +[nested_expr]--> reached end of pattern, returning type +[{ + "label": "First", + "kind": 4, + "tags": [], + "detail": "First\n\ntype theVariant = First | Second(r1)", + "documentation": null, + "insertText": "First", + "insertTextFormat": 2 + }, { + "label": "Second(_)", + "kind": 4, + "tags": [], + "detail": "Second(r1)\n\ntype theVariant = First | Second(r1)", + "documentation": null, + "insertText": "Second(${1:_})", + "insertTextFormat": 2 + }] + +Complete src/EnvCompletion.res 28:35 +posCursor:[28:35] posNoWhite:[28:34] Found pattern:[28:20->28:38] +posCursor:[28:35] posNoWhite:[28:34] Found pattern:[28:28->28:36] +Ppat_construct Second:[28:28->28:34] +posCursor:[28:35] posNoWhite:[28:34] Found pattern:[28:34->28:36] +Ppat_construct ():[28:34->28:36] +Completable: Cpattern Value[use](Nolabel)->recordField(stuff), variantPayload::Second($0) +Package opens Pervasives.JsxModules.place holder +Resolved opens 1 pervasives +ContextPath Value[use](Nolabel) +ContextPath Value[use] +Path use +[extract_type]--> digging for type EnvCompletionOtherFile.response in EnvCompletion +[extract_type]--> found record +[nested_expr]--> trying to move into record field +[nested_expr]--> found record field type +[nested_expr]--> extracting from type theVariant in env EnvCompletionOtherFile +[extract_type]--> digging for type theVariant in EnvCompletionOtherFile +[extract_type]--> found variant +[nested_expr]--> trying to move into variant payload $0 of constructor 'Second' +[nested_expr]--> found constructor (Args type) +[nested_expr]--> found arg of type: r1 +[extract_type]--> digging for type r1 in EnvCompletionOtherFile +[extract_type]--> found record +[nested_expr]--> extracted type, continuing descent +[nested_expr]--> reached end of pattern, returning type +[{ + "label": "{}", + "kind": 22, + "tags": [], + "detail": "r1", + "documentation": null, + "sortText": "A", + "insertText": "{$0}", + "insertTextFormat": 2 + }] + +Complete src/EnvCompletion.res 31:36 +posCursor:[31:36] posNoWhite:[31:35] Found pattern:[31:20->31:40] +posCursor:[31:36] posNoWhite:[31:35] Found pattern:[31:28->31:38] +Ppat_construct Second:[31:28->31:34] +posCursor:[31:36] posNoWhite:[31:35] Found pattern:[31:35->31:37] +Completable: Cpattern Value[use](Nolabel)->recordField(stuff), variantPayload::Second($0), recordBody +Package opens Pervasives.JsxModules.place holder +Resolved opens 1 pervasives +ContextPath Value[use](Nolabel) +ContextPath Value[use] +Path use +[extract_type]--> digging for type EnvCompletionOtherFile.response in EnvCompletion +[extract_type]--> found record +[nested_expr]--> trying to move into record field +[nested_expr]--> found record field type +[nested_expr]--> extracting from type theVariant in env EnvCompletionOtherFile +[extract_type]--> digging for type theVariant in EnvCompletionOtherFile +[extract_type]--> found variant +[nested_expr]--> trying to move into variant payload $0 of constructor 'Second' +[nested_expr]--> found constructor (Args type) +[nested_expr]--> found arg of type: r1 +[extract_type]--> digging for type r1 in EnvCompletionOtherFile +[extract_type]--> found record +[nested_expr]--> extracted type, continuing descent +[extract_type]--> digging for type r1 in EnvCompletionOtherFile +[extract_type]--> found record +[{ + "label": "age", + "kind": 5, + "tags": [], + "detail": "age: int\n\nr1", + "documentation": null + }] + +Complete src/EnvCompletion.res 34:25 +posCursor:[34:25] posNoWhite:[34:24] Found pattern:[34:20->34:29] +Completable: Cpattern Value[use](Nolabel)->recordField(res) +Package opens Pervasives.JsxModules.place holder +Resolved opens 1 pervasives +ContextPath Value[use](Nolabel) +ContextPath Value[use] +Path use +[extract_type]--> digging for type EnvCompletionOtherFile.response in EnvCompletion +[extract_type]--> found record +[nested_expr]--> trying to move into record field +[nested_expr]--> found record field type +[nested_expr]--> extracting from type someResult in env EnvCompletionOtherFile +[extract_type]--> digging for type someResult in EnvCompletionOtherFile +[extract_type]--> found variant +[nested_expr]--> reached end of pattern, returning type +[{ + "label": "Okay(_)", + "kind": 4, + "tags": [], + "detail": "Okay('a)\n\ntype someResult<'a, 'b> = Okay('a) | Failure('b)", + "documentation": null, + "insertText": "Okay(${1:_})", + "insertTextFormat": 2 + }, { + "label": "Failure(_)", + "kind": 4, + "tags": [], + "detail": "Failure('b)\n\ntype someResult<'a, 'b> = Okay('a) | Failure('b)", + "documentation": null, + "insertText": "Failure(${1:_})", + "insertTextFormat": 2 + }] + +Complete src/EnvCompletion.res 37:31 +posCursor:[37:31] posNoWhite:[37:30] Found pattern:[37:20->37:34] +posCursor:[37:31] posNoWhite:[37:30] Found pattern:[37:26->37:32] +Ppat_construct Okay:[37:26->37:30] +posCursor:[37:31] posNoWhite:[37:30] Found pattern:[37:30->37:32] +Ppat_construct ():[37:30->37:32] +Completable: Cpattern Value[use](Nolabel)->recordField(res), variantPayload::Okay($0) +Package opens Pervasives.JsxModules.place holder +Resolved opens 1 pervasives +ContextPath Value[use](Nolabel) +ContextPath Value[use] +Path use +[extract_type]--> digging for type EnvCompletionOtherFile.response in EnvCompletion +[extract_type]--> found record +[nested_expr]--> trying to move into record field +[nested_expr]--> found record field type +[nested_expr]--> extracting from type someResult in env EnvCompletionOtherFile +[extract_type]--> digging for type someResult in EnvCompletionOtherFile +[extract_type]--> found variant +[nested_expr]--> trying to move into variant payload $0 of constructor 'Okay' +[nested_expr]--> found constructor (Args type) +[nested_expr]--> found arg of type: 'a +[extract_type]--> digging for type theVariant in EnvCompletionOtherFile +[extract_type]--> found variant +[nested_expr]--> extracted type, continuing descent +[nested_expr]--> reached end of pattern, returning type +[{ + "label": "First", + "kind": 4, + "tags": [], + "detail": "First\n\ntype theVariant = First | Second(r1)", + "documentation": null, + "insertText": "First", + "insertTextFormat": 2 + }, { + "label": "Second(_)", + "kind": 4, + "tags": [], + "detail": "Second(r1)\n\ntype theVariant = First | Second(r1)", + "documentation": null, + "insertText": "Second(${1:_})", + "insertTextFormat": 2 + }] + +Complete src/EnvCompletion.res 40:38 +posCursor:[40:38] posNoWhite:[40:37] Found pattern:[40:20->40:42] +posCursor:[40:38] posNoWhite:[40:37] Found pattern:[40:26->40:40] +Ppat_construct Okay:[40:26->40:30] +posCursor:[40:38] posNoWhite:[40:37] Found pattern:[40:31->40:39] +Ppat_construct Second:[40:31->40:37] +posCursor:[40:38] posNoWhite:[40:37] Found pattern:[40:37->40:39] +Ppat_construct ():[40:37->40:39] +Completable: Cpattern Value[use](Nolabel)->recordField(res), variantPayload::Okay($0), variantPayload::Second($0) +Package opens Pervasives.JsxModules.place holder +Resolved opens 1 pervasives +ContextPath Value[use](Nolabel) +ContextPath Value[use] +Path use +[extract_type]--> digging for type EnvCompletionOtherFile.response in EnvCompletion +[extract_type]--> found record +[nested_expr]--> trying to move into record field +[nested_expr]--> found record field type +[nested_expr]--> extracting from type someResult in env EnvCompletionOtherFile +[extract_type]--> digging for type someResult in EnvCompletionOtherFile +[extract_type]--> found variant +[nested_expr]--> trying to move into variant payload $0 of constructor 'Okay' +[nested_expr]--> found constructor (Args type) +[nested_expr]--> found arg of type: 'a +[extract_type]--> digging for type theVariant in EnvCompletionOtherFile +[extract_type]--> found variant +[nested_expr]--> extracted type, continuing descent +[nested_expr]--> trying to move into variant payload $0 of constructor 'Second' +[nested_expr]--> found constructor (Args type) +[nested_expr]--> found arg of type: r1 +[extract_type]--> digging for type r1 in EnvCompletionOtherFile +[extract_type]--> found record +[nested_expr]--> extracted type, continuing descent +[nested_expr]--> reached end of pattern, returning type +[{ + "label": "{}", + "kind": 22, + "tags": [], + "detail": "r1", + "documentation": null, + "sortText": "A", + "insertText": "{$0}", + "insertTextFormat": 2 + }] + +Complete src/EnvCompletion.res 43:39 +posCursor:[43:39] posNoWhite:[43:38] Found pattern:[43:20->43:44] +posCursor:[43:39] posNoWhite:[43:38] Found pattern:[43:26->43:42] +Ppat_construct Okay:[43:26->43:30] +posCursor:[43:39] posNoWhite:[43:38] Found pattern:[43:31->43:41] +Ppat_construct Second:[43:31->43:37] +posCursor:[43:39] posNoWhite:[43:38] Found pattern:[43:38->43:40] +Completable: Cpattern Value[use](Nolabel)->recordField(res), variantPayload::Okay($0), variantPayload::Second($0), recordBody +Package opens Pervasives.JsxModules.place holder +Resolved opens 1 pervasives +ContextPath Value[use](Nolabel) +ContextPath Value[use] +Path use +[extract_type]--> digging for type EnvCompletionOtherFile.response in EnvCompletion +[extract_type]--> found record +[nested_expr]--> trying to move into record field +[nested_expr]--> found record field type +[nested_expr]--> extracting from type someResult in env EnvCompletionOtherFile +[extract_type]--> digging for type someResult in EnvCompletionOtherFile +[extract_type]--> found variant +[nested_expr]--> trying to move into variant payload $0 of constructor 'Okay' +[nested_expr]--> found constructor (Args type) +[nested_expr]--> found arg of type: 'a +[extract_type]--> digging for type theVariant in EnvCompletionOtherFile +[extract_type]--> found variant +[nested_expr]--> extracted type, continuing descent +[nested_expr]--> trying to move into variant payload $0 of constructor 'Second' +[nested_expr]--> found constructor (Args type) +[nested_expr]--> found arg of type: r1 +[extract_type]--> digging for type r1 in EnvCompletionOtherFile +[extract_type]--> found record +[nested_expr]--> extracted type, continuing descent +[extract_type]--> digging for type r1 in EnvCompletionOtherFile +[extract_type]--> found record +[{ + "label": "age", + "kind": 5, + "tags": [], + "detail": "age: int\n\nr1", + "documentation": null + }] + +Complete src/EnvCompletion.res 52:18 +XXX Not found! +Completable: Cpattern Value[res2] +Package opens Pervasives.JsxModules.place holder +Resolved opens 1 pervasives +ContextPath Value[res2] +Path res2 +[extract_type]--> digging for type EnvCompletionOtherFile.someRecord in EnvCompletion +[extract_type]--> found record +[nested_expr]--> reached end of pattern, returning type +[{ + "label": "{}", + "kind": 22, + "tags": [], + "detail": "EnvCompletionOtherFile.someRecord", + "documentation": null, + "sortText": "A", + "insertText": "{$0}", + "insertTextFormat": 2 + }] + +Complete src/EnvCompletion.res 55:20 +posCursor:[55:20] posNoWhite:[55:19] Found pattern:[55:19->55:21] +Completable: Cpattern Value[res2]->recordBody +Package opens Pervasives.JsxModules.place holder +Resolved opens 1 pervasives +ContextPath Value[res2] +Path res2 +[extract_type]--> digging for type EnvCompletionOtherFile.someRecord in EnvCompletion +[extract_type]--> found record +[extract_type]--> digging for type EnvCompletionOtherFile.someRecord in EnvCompletionOtherFile +[extract_type]--> found record +[{ + "label": "name", + "kind": 5, + "tags": [], + "detail": "name: string\n\nEnvCompletionOtherFile.someRecord", + "documentation": null + }, { + "label": "theThing", + "kind": 5, + "tags": [], + "detail": "theThing: 'thing\n\nEnvCompletionOtherFile.someRecord", + "documentation": null + }, { + "label": "theVariant", + "kind": 5, + "tags": [], + "detail": "theVariant: theVariant\n\nEnvCompletionOtherFile.someRecord", + "documentation": null + }] + +Complete src/EnvCompletion.res 58:29 +posCursor:[58:29] posNoWhite:[58:28] Found pattern:[58:19->58:33] +Completable: Cpattern Value[res2]->recordField(theThing) +Package opens Pervasives.JsxModules.place holder +Resolved opens 1 pervasives +ContextPath Value[res2] +Path res2 +[extract_type]--> digging for type EnvCompletionOtherFile.someRecord in EnvCompletion +[extract_type]--> found record +[nested_expr]--> trying to move into record field +[nested_expr]--> found record field type +[nested_expr]--> extracting from type 'thing in env EnvCompletionOtherFile +[extract_type]--> miss +[] + +Complete src/EnvCompletion.res 61:31 +posCursor:[61:31] posNoWhite:[61:30] Found pattern:[61:19->61:35] +Completable: Cpattern Value[res2]->recordField(theVariant) +Package opens Pervasives.JsxModules.place holder +Resolved opens 1 pervasives +ContextPath Value[res2] +Path res2 +[extract_type]--> digging for type EnvCompletionOtherFile.someRecord in EnvCompletion +[extract_type]--> found record +[nested_expr]--> trying to move into record field +[nested_expr]--> found record field type +[nested_expr]--> extracting from type theVariant in env EnvCompletionOtherFile +[extract_type]--> digging for type theVariant in EnvCompletionOtherFile +[extract_type]--> found variant +[nested_expr]--> reached end of pattern, returning type +[{ + "label": "First", + "kind": 4, + "tags": [], + "detail": "First\n\ntype theVariant = First | Second(r1)", + "documentation": null, + "insertText": "First", + "insertTextFormat": 2 + }, { + "label": "Second(_)", + "kind": 4, + "tags": [], + "detail": "Second(r1)\n\ntype theVariant = First | Second(r1)", + "documentation": null, + "insertText": "Second(${1:_})", + "insertTextFormat": 2 + }] + diff --git a/analysis/tests/src/expected/EnvCompletionOtherFile.res.txt b/analysis/tests/src/expected/EnvCompletionOtherFile.res.txt new file mode 100644 index 000000000..e69de29bb diff --git a/analysis/tests/src/expected/ExhaustiveSwitch.res.txt b/analysis/tests/src/expected/ExhaustiveSwitch.res.txt index 71285318b..6d1f614cd 100644 --- a/analysis/tests/src/expected/ExhaustiveSwitch.res.txt +++ b/analysis/tests/src/expected/ExhaustiveSwitch.res.txt @@ -5,6 +5,8 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[withSomeVarian] Path withSomeVarian +[extract_type]--> digging for type someVariant in ExhaustiveSwitch +[extract_type]--> found variant [{ "label": "withSomeVariant", "kind": 12, @@ -29,6 +31,8 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[withSomePol] Path withSomePol +[extract_type]--> digging for type somePolyVariant in ExhaustiveSwitch +[extract_type]--> found type manifest [{ "label": "withSomePoly", "kind": 12, @@ -118,6 +122,8 @@ ContextPath Value[getV] Path getV Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +[extract_type]--> digging for type someVariant in ExhaustiveSwitch +[extract_type]--> found variant Hit: Exhaustive switch {"start": {"line": 33, "character": 3}, "end": {"line": 33, "character": 10}} newText: @@ -137,6 +143,8 @@ ContextPath Value[vvv] Path vvv Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +[extract_type]--> digging for type someVariant in ExhaustiveSwitch +[extract_type]--> found variant Hit: Exhaustive switch {"start": {"line": 36, "character": 3}, "end": {"line": 36, "character": 6}} newText: diff --git a/analysis/tests/src/expected/Fragment.res.txt b/analysis/tests/src/expected/Fragment.res.txt index adb67f8d8..bd32bb999 100644 --- a/analysis/tests/src/expected/Fragment.res.txt +++ b/analysis/tests/src/expected/Fragment.res.txt @@ -15,6 +15,12 @@ Pexp_construct []:__ghost__[9:10->9:67] None Completable: Cexpression CTypeAtPos()=[]->variantPayload::::($1) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CTypeAtPos() +[extract_type]--> digging for type React.element in Fragment +[extract_type]--> found type manifest +[extract_type]--> digging for type Pervasives.Jsx.element in Fragment +[extract_type]--> found something else when digging +--> could not get completions for context path null diff --git a/analysis/tests/src/expected/Hover.res.txt b/analysis/tests/src/expected/Hover.res.txt index 773bd50f3..28d476779 100644 --- a/analysis/tests/src/expected/Hover.res.txt +++ b/analysis/tests/src/expected/Hover.res.txt @@ -259,6 +259,8 @@ Resolved opens 1 pervasives ContextPath CPatternPath(Value[x])->recordField(someField) ContextPath Value[x] Path x +[extract_type]--> digging for type recordWithDocstringField in Hover +[extract_type]--> found record {"contents": {"kind": "markdown", "value": "```rescript\nbool\n```"}} Hover src/Hover.res 263:8 diff --git a/analysis/tests/src/expected/Jsx2.res.txt b/analysis/tests/src/expected/Jsx2.res.txt index b6f0c10e3..26eb76d27 100644 --- a/analysis/tests/src/expected/Jsx2.res.txt +++ b/analysis/tests/src/expected/Jsx2.res.txt @@ -9,8 +9,11 @@ JSX 8:5] second[8:6->8:12]=...[8:13->8:15]> _children:None Completable: Cexpression CJsxPropValue [M] second=fi Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CJsxPropValue [M] second Path M.make +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [] Complete src/Jsx2.res 11:20 diff --git a/analysis/tests/src/expected/QueryFile.res.txt b/analysis/tests/src/expected/QueryFile.res.txt new file mode 100644 index 000000000..e69de29bb diff --git a/analysis/tests/src/expected/Reprod.res.txt b/analysis/tests/src/expected/Reprod.res.txt new file mode 100644 index 000000000..0c5bc124c --- /dev/null +++ b/analysis/tests/src/expected/Reprod.res.txt @@ -0,0 +1,41 @@ +Complete src/Reprod.res 7:53 +posCursor:[7:53] posNoWhite:[7:52] Found expr:[7:11->7:56] +Pexp_apply ...[7:11->7:20] (~variables7:22->7:31=...[7:32->7:55]) +Completable: Cexpression CArgument Value[Query, use](~variables)->recordField(location), variantPayload::ByAddress($0) +Package opens Pervasives.JsxModules.place holder +Resolved opens 1 pervasives +--> expression completion +ContextPath CArgument Value[Query, use](~variables) +--> function argument: variables +ContextPath Value[Query, use] +Path Query.use +--> found function type +--> found function argument! +[extract_type]--> digging for type QueryFile.Types.variables in Reprod +[extract_type]--> found record +[nested_expr]--> trying to move into record field +[nested_expr]--> found record field type +[nested_expr]--> extracting from type location in env QueryFile +[extract_type]--> digging for type location in QueryFile +[extract_type]--> found type manifest +[extract_type]--> digging for type SchemaAssets.input_Location in QueryFile +[extract_type]--> found variant +[nested_expr]--> trying to move into variant payload $0 of constructor 'ByAddress' +[nested_expr]--> found constructor (Args type) +[nested_expr]--> found arg of type: input_ByAddress +[extract_type]--> digging for type input_ByAddress in SchemaAssets +[extract_type]--> found record +[nested_expr]--> extracted type, continuing descent +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion +[{ + "label": "{}", + "kind": 12, + "tags": [], + "detail": "input_ByAddress", + "documentation": null, + "sortText": "A", + "insertText": "{$0}", + "insertTextFormat": 2 + }] + diff --git a/analysis/tests/src/expected/SchemaAssets.res.txt b/analysis/tests/src/expected/SchemaAssets.res.txt new file mode 100644 index 000000000..e69de29bb diff --git a/analysis/tests/src/expected/TypeAtPosCompletion.res.txt b/analysis/tests/src/expected/TypeAtPosCompletion.res.txt index 8a334e9c6..7d5733702 100644 --- a/analysis/tests/src/expected/TypeAtPosCompletion.res.txt +++ b/analysis/tests/src/expected/TypeAtPosCompletion.res.txt @@ -3,7 +3,13 @@ posCursor:[7:17] posNoWhite:[7:15] Found expr:[6:16->9:1] Completable: Cexpression CTypeAtPos()->recordBody Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CTypeAtPos() +[extract_type]--> digging for type optRecord in TypeAtPosCompletion +[extract_type]--> found record +[extract_type]--> digging for type optRecord in TypeAtPosCompletion +[extract_type]--> found record +--> found type in nested expression completion [{ "label": "age", "kind": 5, @@ -26,7 +32,19 @@ posCursor:[16:18] posNoWhite:[16:16] Found expr:[15:2->18:3] Completable: Cexpression CTypeAtPos()->variantPayload::One($1), recordBody Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CTypeAtPos() +[extract_type]--> digging for type someVariant in TypeAtPosCompletion +[extract_type]--> found variant +[nested_expr]--> trying to move into variant payload $1 of constructor 'One' +[nested_expr]--> found constructor (Args type) +[nested_expr]--> found arg of type: optRecord +[extract_type]--> digging for type optRecord in TypeAtPosCompletion +[extract_type]--> found record +[nested_expr]--> extracted type, continuing descent +[extract_type]--> digging for type optRecord in TypeAtPosCompletion +[extract_type]--> found record +--> found type in nested expression completion [{ "label": "age", "kind": 5, @@ -46,7 +64,12 @@ posCursor:[22:12] posNoWhite:[22:11] Found expr:[21:10->24:1] Completable: Cexpression CTypeAtPos()->array Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CTypeAtPos() +[extract_type]--> digging for type optRecord in TypeAtPosCompletion +[extract_type]--> found record +[nested_expr]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "{}", "kind": 12, diff --git a/analysis/tests/src/expected/Xform.res.txt b/analysis/tests/src/expected/Xform.res.txt index 0af705bff..79a0e52a6 100644 --- a/analysis/tests/src/expected/Xform.res.txt +++ b/analysis/tests/src/expected/Xform.res.txt @@ -7,6 +7,7 @@ ContextPath Value[kind] Path kind Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +[extract_type]--> miss Hit: Replace with switch {"start": {"line": 6, "character": 0}, "end": {"line": 11, "character": 1}} newText: From 36719aa20c653d3ce8c238648435b811bc4f820f Mon Sep 17 00:00:00 2001 From: Gabriel Nordeborn Date: Tue, 2 Jan 2024 20:23:55 +0100 Subject: [PATCH 02/17] wip --- analysis/src/TypeUtils.ml | 1 + 1 file changed, 1 insertion(+) diff --git a/analysis/src/TypeUtils.ml b/analysis/src/TypeUtils.ml index c43e89aa6..30da22752 100644 --- a/analysis/src/TypeUtils.ml +++ b/analysis/src/TypeUtils.ml @@ -563,6 +563,7 @@ let findTypeOfPolyvariantArg constructors ~constructorName ~payloadNum = | None -> None let rec resolveNestedPatternPath (typ : innerType) ~env ~full ~nested = + let extractType = extractType ~instantiateTypes:false in let t = match typ with | TypeExpr t -> t |> extractType ~env ~package:full.package From d8da2f4cdbd8615901954c9e885414fbddf0d78f Mon Sep 17 00:00:00 2001 From: Gabriel Nordeborn Date: Sun, 7 Jan 2024 12:45:42 +0100 Subject: [PATCH 03/17] break it again --- analysis/src/TypeUtils.ml | 3 - analysis/tests/src/Reprod.res | 21 +++ .../src/expected/CompletionPattern.res.txt | 72 ++-------- .../tests/src/expected/EnvCompletion.res.txt | 127 +++++------------- analysis/tests/src/expected/Reprod.res.txt | 50 +++++++ 5 files changed, 120 insertions(+), 153 deletions(-) diff --git a/analysis/src/TypeUtils.ml b/analysis/src/TypeUtils.ml index 30da22752..0cce5b864 100644 --- a/analysis/src/TypeUtils.ml +++ b/analysis/src/TypeUtils.ml @@ -479,9 +479,6 @@ let rec resolveNested ~env ~full ~nested ?ctx (typ : completionType) = (Printf.sprintf "[nested_expr]--> found arg of type: %s" (Shared.typeToString typ)); - let typ, env = - typ |> instantiateVar ~env ~typeParamsEnv ~typeParams ~typeArgs - in typ |> extractType ~env ~package:full.package |> Utils.Option.flatMap (fun typ -> diff --git a/analysis/tests/src/Reprod.res b/analysis/tests/src/Reprod.res index 633aa7fa6..c339e82e6 100644 --- a/analysis/tests/src/Reprod.res +++ b/analysis/tests/src/Reprod.res @@ -7,3 +7,24 @@ module Query = { // let x = Query.use(~variables={location: ByAddress()}) // ^com + +type nestedRecord = {nested: bool} + +type rec someRecord = { + first: int, + second: (bool, option), + optThird: option<[#first | #second(someRecord)]>, + nest: nestedRecord, +} + +type somePolyVariant = [#one | #two(bool) | #three(someRecord, bool)] + +type someVariant = One | Two(bool) | Three(someRecord, bool) + +let res: result = Ok(One) + +// switch res { | Ok() } +// ^com + +// switch res { | Error() } +// ^com diff --git a/analysis/tests/src/expected/CompletionPattern.res.txt b/analysis/tests/src/expected/CompletionPattern.res.txt index a90b66937..867aa6073 100644 --- a/analysis/tests/src/expected/CompletionPattern.res.txt +++ b/analysis/tests/src/expected/CompletionPattern.res.txt @@ -1318,35 +1318,13 @@ Path res [nested_expr]--> trying to move into variant payload $0 of constructor 'Ok' [nested_expr]--> found constructor (Args type) [nested_expr]--> found arg of type: 'a -[extract_type]--> digging for type someVariant in CompletionPattern -[extract_type]--> found variant -[nested_expr]--> extracted type, continuing descent -[nested_expr]--> reached end of pattern, returning type -[{ - "label": "One", - "kind": 4, - "tags": [], - "detail": "One\n\ntype someVariant = One | Two(bool) | Three(someRecord, bool)", - "documentation": null, - "insertText": "One", - "insertTextFormat": 2 - }, { - "label": "Two(_)", - "kind": 4, - "tags": [], - "detail": "Two(bool)\n\ntype someVariant = One | Two(bool) | Three(someRecord, bool)", - "documentation": null, - "insertText": "Two(${1:_})", - "insertTextFormat": 2 - }, { - "label": "Three(_, _)", - "kind": 4, - "tags": [], - "detail": "Three(someRecord, bool)\n\ntype someVariant = One | Two(bool) | Three(someRecord, bool)", - "documentation": null, - "insertText": "Three(${1:_}, ${2:_})", - "insertTextFormat": 2 - }] +[extract_type]--> miss +Completable: Cpath Value[()] +Package opens Pervasives.JsxModules.place holder +Resolved opens 1 pervasives +ContextPath Value[()] +Path () +[] Complete src/CompletionPattern.res 219:24 posCursor:[219:24] posNoWhite:[219:23] Found pattern:[219:18->219:25] @@ -1365,33 +1343,11 @@ Path res [nested_expr]--> trying to move into variant payload $0 of constructor 'Error' [nested_expr]--> found constructor (Args type) [nested_expr]--> found arg of type: 'b -[extract_type]--> digging for type somePolyVariant in CompletionPattern -[extract_type]--> found type manifest -[nested_expr]--> extracted type, continuing descent -[nested_expr]--> reached end of pattern, returning type -[{ - "label": "#one", - "kind": 4, - "tags": [], - "detail": "#one\n\n[#one | #three(someRecord, bool) | #two(bool)]", - "documentation": null, - "insertText": "#one", - "insertTextFormat": 2 - }, { - "label": "#three(_, _)", - "kind": 4, - "tags": [], - "detail": "#three(someRecord, bool)\n\n[#one | #three(someRecord, bool) | #two(bool)]", - "documentation": null, - "insertText": "#three(${1:_}, ${2:_})", - "insertTextFormat": 2 - }, { - "label": "#two(_)", - "kind": 4, - "tags": [], - "detail": "#two(bool)\n\n[#one | #three(someRecord, bool) | #two(bool)]", - "documentation": null, - "insertText": "#two(${1:_})", - "insertTextFormat": 2 - }] +[extract_type]--> miss +Completable: Cpath Value[()] +Package opens Pervasives.JsxModules.place holder +Resolved opens 1 pervasives +ContextPath Value[()] +Path () +[] diff --git a/analysis/tests/src/expected/EnvCompletion.res.txt b/analysis/tests/src/expected/EnvCompletion.res.txt index dc9fdbe72..8d26156e6 100644 --- a/analysis/tests/src/expected/EnvCompletion.res.txt +++ b/analysis/tests/src/expected/EnvCompletion.res.txt @@ -41,27 +41,13 @@ Path res [nested_expr]--> trying to move into variant payload $0 of constructor 'Okay' [nested_expr]--> found constructor (Args type) [nested_expr]--> found arg of type: 'a -[extract_type]--> digging for type things in EnvCompletion -[extract_type]--> found variant -[nested_expr]--> extracted type, continuing descent -[nested_expr]--> reached end of pattern, returning type -[{ - "label": "One", - "kind": 4, - "tags": [], - "detail": "One\n\ntype things = One | Two", - "documentation": null, - "insertText": "One", - "insertTextFormat": 2 - }, { - "label": "Two", - "kind": 4, - "tags": [], - "detail": "Two\n\ntype things = One | Two", - "documentation": null, - "insertText": "Two", - "insertTextFormat": 2 - }] +[extract_type]--> miss +Completable: Cpath Value[()] +Package opens Pervasives.JsxModules.place holder +Resolved opens 1 pervasives +ContextPath Value[()] +Path () +[] Complete src/EnvCompletion.res 16:26 posCursor:[16:26] posNoWhite:[16:25] Found pattern:[16:18->16:27] @@ -78,18 +64,13 @@ Path res [nested_expr]--> trying to move into variant payload $0 of constructor 'Failure' [nested_expr]--> found constructor (Args type) [nested_expr]--> found arg of type: 'b -[nested_expr]--> extracted type, continuing descent -[nested_expr]--> reached end of pattern, returning type -[{ - "label": "\"\"", - "kind": 12, - "tags": [], - "detail": "string", - "documentation": null, - "sortText": "A", - "insertText": "\"$0\"", - "insertTextFormat": 2 - }] +[extract_type]--> miss +Completable: Cpath Value[()] +Package opens Pervasives.JsxModules.place holder +Resolved opens 1 pervasives +ContextPath Value[()] +Path () +[] Complete src/EnvCompletion.res 19:19 XXX Not found! @@ -300,27 +281,13 @@ Path use [nested_expr]--> trying to move into variant payload $0 of constructor 'Okay' [nested_expr]--> found constructor (Args type) [nested_expr]--> found arg of type: 'a -[extract_type]--> digging for type theVariant in EnvCompletionOtherFile -[extract_type]--> found variant -[nested_expr]--> extracted type, continuing descent -[nested_expr]--> reached end of pattern, returning type -[{ - "label": "First", - "kind": 4, - "tags": [], - "detail": "First\n\ntype theVariant = First | Second(r1)", - "documentation": null, - "insertText": "First", - "insertTextFormat": 2 - }, { - "label": "Second(_)", - "kind": 4, - "tags": [], - "detail": "Second(r1)\n\ntype theVariant = First | Second(r1)", - "documentation": null, - "insertText": "Second(${1:_})", - "insertTextFormat": 2 - }] +[extract_type]--> miss +Completable: Cpath Value[()] +Package opens Pervasives.JsxModules.place holder +Resolved opens 1 pervasives +ContextPath Value[()] +Path () +[] Complete src/EnvCompletion.res 40:38 posCursor:[40:38] posNoWhite:[40:37] Found pattern:[40:20->40:42] @@ -346,26 +313,13 @@ Path use [nested_expr]--> trying to move into variant payload $0 of constructor 'Okay' [nested_expr]--> found constructor (Args type) [nested_expr]--> found arg of type: 'a -[extract_type]--> digging for type theVariant in EnvCompletionOtherFile -[extract_type]--> found variant -[nested_expr]--> extracted type, continuing descent -[nested_expr]--> trying to move into variant payload $0 of constructor 'Second' -[nested_expr]--> found constructor (Args type) -[nested_expr]--> found arg of type: r1 -[extract_type]--> digging for type r1 in EnvCompletionOtherFile -[extract_type]--> found record -[nested_expr]--> extracted type, continuing descent -[nested_expr]--> reached end of pattern, returning type -[{ - "label": "{}", - "kind": 22, - "tags": [], - "detail": "r1", - "documentation": null, - "sortText": "A", - "insertText": "{$0}", - "insertTextFormat": 2 - }] +[extract_type]--> miss +Completable: Cpath Value[()] +Package opens Pervasives.JsxModules.place holder +Resolved opens 1 pervasives +ContextPath Value[()] +Path () +[] Complete src/EnvCompletion.res 43:39 posCursor:[43:39] posNoWhite:[43:38] Found pattern:[43:20->43:44] @@ -390,24 +344,13 @@ Path use [nested_expr]--> trying to move into variant payload $0 of constructor 'Okay' [nested_expr]--> found constructor (Args type) [nested_expr]--> found arg of type: 'a -[extract_type]--> digging for type theVariant in EnvCompletionOtherFile -[extract_type]--> found variant -[nested_expr]--> extracted type, continuing descent -[nested_expr]--> trying to move into variant payload $0 of constructor 'Second' -[nested_expr]--> found constructor (Args type) -[nested_expr]--> found arg of type: r1 -[extract_type]--> digging for type r1 in EnvCompletionOtherFile -[extract_type]--> found record -[nested_expr]--> extracted type, continuing descent -[extract_type]--> digging for type r1 in EnvCompletionOtherFile -[extract_type]--> found record -[{ - "label": "age", - "kind": 5, - "tags": [], - "detail": "age: int\n\nr1", - "documentation": null - }] +[extract_type]--> miss +Completable: Cpath Value[Second] +Package opens Pervasives.JsxModules.place holder +Resolved opens 1 pervasives +ContextPath Value[Second] +Path Second +[] Complete src/EnvCompletion.res 52:18 XXX Not found! diff --git a/analysis/tests/src/expected/Reprod.res.txt b/analysis/tests/src/expected/Reprod.res.txt index 0c5bc124c..c77cc0a15 100644 --- a/analysis/tests/src/expected/Reprod.res.txt +++ b/analysis/tests/src/expected/Reprod.res.txt @@ -39,3 +39,53 @@ Path Query.use "insertTextFormat": 2 }] +Complete src/Reprod.res 25:21 +posCursor:[25:21] posNoWhite:[25:20] Found pattern:[25:18->25:22] +Ppat_construct Ok:[25:18->25:20] +posCursor:[25:21] posNoWhite:[25:20] Found pattern:[25:20->25:22] +Ppat_construct ():[25:20->25:22] +Completable: Cpattern Value[res]->variantPayload::Ok($0) +Package opens Pervasives.JsxModules.place holder +Resolved opens 1 pervasives +ContextPath Value[res] +Path res +[extract_type]--> digging for type Pervasives.result in Reprod +[extract_type]--> found type manifest +[extract_type]--> digging for type Belt.Result.t in Reprod +[extract_type]--> found variant +[nested_expr]--> trying to move into variant payload $0 of constructor 'Ok' +[nested_expr]--> found constructor (Args type) +[nested_expr]--> found arg of type: 'a +[extract_type]--> miss +Completable: Cpath Value[()] +Package opens Pervasives.JsxModules.place holder +Resolved opens 1 pervasives +ContextPath Value[()] +Path () +[] + +Complete src/Reprod.res 28:24 +posCursor:[28:24] posNoWhite:[28:23] Found pattern:[28:18->28:25] +Ppat_construct Error:[28:18->28:23] +posCursor:[28:24] posNoWhite:[28:23] Found pattern:[28:23->28:25] +Ppat_construct ():[28:23->28:25] +Completable: Cpattern Value[res]->variantPayload::Error($0) +Package opens Pervasives.JsxModules.place holder +Resolved opens 1 pervasives +ContextPath Value[res] +Path res +[extract_type]--> digging for type Pervasives.result in Reprod +[extract_type]--> found type manifest +[extract_type]--> digging for type Belt.Result.t in Reprod +[extract_type]--> found variant +[nested_expr]--> trying to move into variant payload $0 of constructor 'Error' +[nested_expr]--> found constructor (Args type) +[nested_expr]--> found arg of type: 'b +[extract_type]--> miss +Completable: Cpath Value[()] +Package opens Pervasives.JsxModules.place holder +Resolved opens 1 pervasives +ContextPath Value[()] +Path () +[] + From da9cbf8869c893bf8130148000cab5d7abef11c0 Mon Sep 17 00:00:00 2001 From: Gabriel Nordeborn Date: Sun, 7 Jan 2024 20:41:48 +0100 Subject: [PATCH 04/17] revert a few tests --- analysis/src/SharedTypes.ml | 12 +- analysis/src/TypeUtils.ml | 90 ++------ .../expected/CompletionInferValues.res.txt | 2 +- .../src/expected/CompletionPattern.res.txt | 72 +++++-- .../tests/src/expected/EnvCompletion.res.txt | 196 +++++++----------- analysis/tests/src/expected/Reprod.res.txt | 100 +++++---- 6 files changed, 214 insertions(+), 258 deletions(-) diff --git a/analysis/src/SharedTypes.ml b/analysis/src/SharedTypes.ml index 8707a70a7..2528b6021 100644 --- a/analysis/src/SharedTypes.ml +++ b/analysis/src/SharedTypes.ml @@ -334,7 +334,6 @@ and completionType = | TtypeT of {env: QueryEnv.t; path: Path.t} | Tvariant of { env: QueryEnv.t; - typeParamsEnv: QueryEnv.t; constructors: Constructor.t list; variantDecl: Types.type_declaration; variantName: string; @@ -348,9 +347,6 @@ and completionType = } | Trecord of { env: QueryEnv.t; - typeParamsEnv: QueryEnv.t; - typeArgs: Types.type_expr list; - typeParams: Types.type_expr list; fields: field list; definition: [ `NameOnly of string @@ -358,13 +354,7 @@ and completionType = | `TypeExpr of Types.type_expr (** When we have the full type expr from the compiler. *) ]; } - | TinlineRecord of { - env: QueryEnv.t; - typeParamsEnv: QueryEnv.t; - fields: field list; - typeArgs: Types.type_expr list; - typeParams: Types.type_expr list; - } + | TinlineRecord of {env: QueryEnv.t; fields: field list} | Tfunction of { env: QueryEnv.t; args: typedFnArg list; diff --git a/analysis/src/TypeUtils.ml b/analysis/src/TypeUtils.ml index 0cce5b864..1e6f43d12 100644 --- a/analysis/src/TypeUtils.ml +++ b/analysis/src/TypeUtils.ml @@ -110,32 +110,8 @@ let rec extractFunctionType ~env ~package typ = in loop ~env [] typ -let rec findInPairs pred lst1 lst2 = - match (lst1, lst2) with - | [], _ | _, [] -> None - | x :: xs, y :: ys -> if pred x then Some y else findInPairs pred xs ys - -let rec instantiateVar ~typeParams ~typeArgs ~typeParamsEnv ~env - (t : Types.type_expr) = - match t.desc with - | Tlink t1 | Tsubst t1 | Tpoly (t1, []) -> - instantiateVar ~typeParams ~typeArgs ~typeParamsEnv ~env t1 - | Tvar (Some varName) -> - let rec findTypeArg params args = - match (params, args) with - | [], _ | _, [] -> (t, env) - | {Types.desc = Tvar (Some currentArgName)} :: _, arg :: _ - when currentArgName = varName -> - (arg, typeParamsEnv) - | _ :: params, _ :: args -> findTypeArg params args - in - findTypeArg typeParams typeArgs - | _ -> (t, env) - (** Pulls out a type we can complete from a type expr. *) -let rec extractType ?(instantiateTypes = true) ~env ~package - (t : Types.type_expr) = - let instantiateType = instantiateType ~instantiateTypes in +let rec extractType ~env ~package (t : Types.type_expr) = match t.desc with | Tlink t1 | Tsubst t1 | Tpoly (t1, []) -> extractType ~env ~package t1 | Tconstr (Path.Pident {name = "option"}, [payloadTypeExpr], _) -> @@ -167,34 +143,21 @@ let rec extractType ?(instantiateTypes = true) ~env ~package t1 |> instantiateType ~typeParams:type_params ~typeArgs |> extractType ~env ~package - | Some - ( envFromDeclaration, - {name; item = {decl; kind = Type.Variant constructors}} ) -> + | Some (_env, {name; item = {decl; kind = Type.Variant constructors}}) -> Debug.logVerbose "[extract_type]--> found variant"; Some (Tvariant { - typeParamsEnv = env; - env = envFromDeclaration; + env; constructors; variantName = name.txt; variantDecl = decl; typeArgs; typeParams = decl.type_params; }) - | Some (envFromDeclaration, {item = {kind = Record fields; decl}}) -> + | Some (_env, {item = {kind = Record fields}}) -> Debug.logVerbose "[extract_type]--> found record"; - Some - (Trecord - { - typeParamsEnv = env; - env = envFromDeclaration; - fields; - definition = `TypeExpr t; - typeArgs; - typeParams = decl.type_params; - }) - | Some (env, {item = {name = "t"}}) -> Some (TtypeT {env; path}) + Some (Trecord {env; fields; definition = `TypeExpr t}) | None -> Debug.logVerbose "[extract_type]--> found nothing when digging"; None @@ -342,22 +305,12 @@ let extractTypeFromResolvedType (typ : Type.t) ~env ~full = match typ.kind with | Tuple items -> Some (Tuple (env, items, Ctype.newty (Ttuple items))) | Record fields -> - Some - (Trecord - { - env; - typeParamsEnv = env; - fields; - definition = `NameOnly typ.name; - typeParams = typ.decl.type_params; - typeArgs = []; - }) + Some (Trecord {env; fields; definition = `NameOnly typ.name}) | Variant constructors -> Some (Tvariant { env; - typeParamsEnv = env; constructors; variantName = typ.name; variantDecl = typ.decl; @@ -374,7 +327,7 @@ type ctx = Rfield of string (** A record field of name *) (** This moves through a nested path via a set of instructions, trying to resolve the type at the end of the path. *) let rec resolveNested ~env ~full ~nested ?ctx (typ : completionType) = - let extractType = extractType ~instantiateTypes:false in + let extractType = extractType in match nested with | [] -> Debug.logVerbose "[nested_expr]--> reached end of pattern, returning type"; @@ -399,8 +352,7 @@ let rec resolveNested ~env ~full ~nested ?ctx (typ : completionType) = |> Utils.Option.flatMap (fun typ -> typ |> resolveNested ~env ~full ~nested)) | ( NFollowRecordField {fieldName}, - ( TinlineRecord {env; typeParamsEnv; fields; typeParams; typeArgs} - | Trecord {env; typeParamsEnv; fields; typeParams; typeArgs} ) ) -> ( + (TinlineRecord {env; fields} | Trecord {env; fields}) ) -> ( Debug.logVerbose "[nested_expr]--> trying to move into record field"; match fields @@ -429,10 +381,9 @@ let rec resolveNested ~env ~full ~nested ?ctx (typ : completionType) = | ( NRecordBody {seenFields}, (Trecord {env; definition = `NameOnly _} as extractedType) ) -> Some (extractedType, env, Some (Completable.RecordField {seenFields})) - | ( NRecordBody {seenFields}, - TinlineRecord {env; typeParamsEnv; typeArgs; typeParams; fields} ) -> + | NRecordBody {seenFields}, TinlineRecord {env; fields} -> Some - ( TinlineRecord {fields; env; typeParamsEnv; typeArgs; typeParams}, + ( TinlineRecord {fields; env}, env, Some (Completable.RecordField {seenFields}) ) | ( NVariantPayload {constructorName = "Some"; itemNum = 0}, @@ -457,7 +408,7 @@ let rec resolveNested ~env ~full ~nested ?ctx (typ : completionType) = |> extractType ~env ~package:full.package |> Utils.Option.flatMap (fun t -> t |> resolveNested ~env ~full ~nested) | ( NVariantPayload {constructorName; itemNum}, - Tvariant {env; typeParamsEnv; constructors; typeParams; typeArgs} ) -> ( + Tvariant {env; constructors; typeParams; typeArgs} ) -> ( Debug.logVerbose (Printf.sprintf "[nested_expr]--> trying to move into variant payload $%i of \ @@ -480,6 +431,7 @@ let rec resolveNested ~env ~full ~nested ?ctx (typ : completionType) = (Shared.typeToString typ)); typ + |> instantiateType ~typeParams ~typeArgs |> extractType ~env ~package:full.package |> Utils.Option.flatMap (fun typ -> Debug.logVerbose @@ -487,9 +439,7 @@ let rec resolveNested ~env ~full ~nested ?ctx (typ : completionType) = typ |> resolveNested ~env ~full ~nested)) | Some {args = InlineRecord fields} when itemNum = 0 -> Debug.logVerbose "[nested_expr]--> found constructor (inline record)"; - TinlineRecord - {env; typeParamsEnv = env; typeArgs = []; typeParams = []; fields} - |> resolveNested ~env ~full ~nested + TinlineRecord {env; fields} |> resolveNested ~env ~full ~nested | _ -> None) | ( NPolyvariantPayload {constructorName; itemNum}, Tpolyvariant {env; constructors} ) -> ( @@ -534,17 +484,8 @@ let findTypeOfConstructorArg constructors ~constructorName ~payloadNum ~env = match List.nth_opt args payloadNum with | None -> None | Some (typ, _) -> Some (TypeExpr typ)) - | Some {args = InlineRecord fields; typeDecl = _, decl} when payloadNum = 0 -> - Some - (ExtractedType - (TinlineRecord - { - env; - typeParamsEnv = env; - typeParams = decl.type_params; - typeArgs = []; - fields; - })) + | Some {args = InlineRecord fields} when payloadNum = 0 -> + Some (ExtractedType (TinlineRecord {env; fields})) | _ -> None let findTypeOfPolyvariantArg constructors ~constructorName ~payloadNum = @@ -560,7 +501,6 @@ let findTypeOfPolyvariantArg constructors ~constructorName ~payloadNum = | None -> None let rec resolveNestedPatternPath (typ : innerType) ~env ~full ~nested = - let extractType = extractType ~instantiateTypes:false in let t = match typ with | TypeExpr t -> t |> extractType ~env ~package:full.package diff --git a/analysis/tests/src/expected/CompletionInferValues.res.txt b/analysis/tests/src/expected/CompletionInferValues.res.txt index d8421680a..83c026fcc 100644 --- a/analysis/tests/src/expected/CompletionInferValues.res.txt +++ b/analysis/tests/src/expected/CompletionInferValues.res.txt @@ -936,7 +936,7 @@ Path CompletionSupport2.makeRenderer [extract_type]--> found record [extract_type]--> digging for type CompletionSupport.Nested.config in CompletionSupport2 [extract_type]--> found record -CPPipe env:CompletionInferValues envFromCompletionItem:CompletionSupport2.Internal +CPPipe env:CompletionInferValues envFromCompletionItem:CompletionSupport2 CPPipe type path:ReactDOM.Client.Root.t CPPipe pathFromEnv:ReactDOM.Client.Root found:false Path ReactDOM.Client.Root. diff --git a/analysis/tests/src/expected/CompletionPattern.res.txt b/analysis/tests/src/expected/CompletionPattern.res.txt index 867aa6073..a90b66937 100644 --- a/analysis/tests/src/expected/CompletionPattern.res.txt +++ b/analysis/tests/src/expected/CompletionPattern.res.txt @@ -1318,13 +1318,35 @@ Path res [nested_expr]--> trying to move into variant payload $0 of constructor 'Ok' [nested_expr]--> found constructor (Args type) [nested_expr]--> found arg of type: 'a -[extract_type]--> miss -Completable: Cpath Value[()] -Package opens Pervasives.JsxModules.place holder -Resolved opens 1 pervasives -ContextPath Value[()] -Path () -[] +[extract_type]--> digging for type someVariant in CompletionPattern +[extract_type]--> found variant +[nested_expr]--> extracted type, continuing descent +[nested_expr]--> reached end of pattern, returning type +[{ + "label": "One", + "kind": 4, + "tags": [], + "detail": "One\n\ntype someVariant = One | Two(bool) | Three(someRecord, bool)", + "documentation": null, + "insertText": "One", + "insertTextFormat": 2 + }, { + "label": "Two(_)", + "kind": 4, + "tags": [], + "detail": "Two(bool)\n\ntype someVariant = One | Two(bool) | Three(someRecord, bool)", + "documentation": null, + "insertText": "Two(${1:_})", + "insertTextFormat": 2 + }, { + "label": "Three(_, _)", + "kind": 4, + "tags": [], + "detail": "Three(someRecord, bool)\n\ntype someVariant = One | Two(bool) | Three(someRecord, bool)", + "documentation": null, + "insertText": "Three(${1:_}, ${2:_})", + "insertTextFormat": 2 + }] Complete src/CompletionPattern.res 219:24 posCursor:[219:24] posNoWhite:[219:23] Found pattern:[219:18->219:25] @@ -1343,11 +1365,33 @@ Path res [nested_expr]--> trying to move into variant payload $0 of constructor 'Error' [nested_expr]--> found constructor (Args type) [nested_expr]--> found arg of type: 'b -[extract_type]--> miss -Completable: Cpath Value[()] -Package opens Pervasives.JsxModules.place holder -Resolved opens 1 pervasives -ContextPath Value[()] -Path () -[] +[extract_type]--> digging for type somePolyVariant in CompletionPattern +[extract_type]--> found type manifest +[nested_expr]--> extracted type, continuing descent +[nested_expr]--> reached end of pattern, returning type +[{ + "label": "#one", + "kind": 4, + "tags": [], + "detail": "#one\n\n[#one | #three(someRecord, bool) | #two(bool)]", + "documentation": null, + "insertText": "#one", + "insertTextFormat": 2 + }, { + "label": "#three(_, _)", + "kind": 4, + "tags": [], + "detail": "#three(someRecord, bool)\n\n[#one | #three(someRecord, bool) | #two(bool)]", + "documentation": null, + "insertText": "#three(${1:_}, ${2:_})", + "insertTextFormat": 2 + }, { + "label": "#two(_)", + "kind": 4, + "tags": [], + "detail": "#two(bool)\n\n[#one | #three(someRecord, bool) | #two(bool)]", + "documentation": null, + "insertText": "#two(${1:_})", + "insertTextFormat": 2 + }] diff --git a/analysis/tests/src/expected/EnvCompletion.res.txt b/analysis/tests/src/expected/EnvCompletion.res.txt index 8d26156e6..72bee04ff 100644 --- a/analysis/tests/src/expected/EnvCompletion.res.txt +++ b/analysis/tests/src/expected/EnvCompletion.res.txt @@ -41,13 +41,27 @@ Path res [nested_expr]--> trying to move into variant payload $0 of constructor 'Okay' [nested_expr]--> found constructor (Args type) [nested_expr]--> found arg of type: 'a -[extract_type]--> miss -Completable: Cpath Value[()] -Package opens Pervasives.JsxModules.place holder -Resolved opens 1 pervasives -ContextPath Value[()] -Path () -[] +[extract_type]--> digging for type things in EnvCompletion +[extract_type]--> found variant +[nested_expr]--> extracted type, continuing descent +[nested_expr]--> reached end of pattern, returning type +[{ + "label": "One", + "kind": 4, + "tags": [], + "detail": "One\n\ntype things = One | Two", + "documentation": null, + "insertText": "One", + "insertTextFormat": 2 + }, { + "label": "Two", + "kind": 4, + "tags": [], + "detail": "Two\n\ntype things = One | Two", + "documentation": null, + "insertText": "Two", + "insertTextFormat": 2 + }] Complete src/EnvCompletion.res 16:26 posCursor:[16:26] posNoWhite:[16:25] Found pattern:[16:18->16:27] @@ -64,13 +78,18 @@ Path res [nested_expr]--> trying to move into variant payload $0 of constructor 'Failure' [nested_expr]--> found constructor (Args type) [nested_expr]--> found arg of type: 'b -[extract_type]--> miss -Completable: Cpath Value[()] -Package opens Pervasives.JsxModules.place holder -Resolved opens 1 pervasives -ContextPath Value[()] -Path () -[] +[nested_expr]--> extracted type, continuing descent +[nested_expr]--> reached end of pattern, returning type +[{ + "label": "\"\"", + "kind": 12, + "tags": [], + "detail": "string", + "documentation": null, + "sortText": "A", + "insertText": "\"$0\"", + "insertTextFormat": 2 + }] Complete src/EnvCompletion.res 19:19 XXX Not found! @@ -104,7 +123,7 @@ ContextPath Value[use] Path use [extract_type]--> digging for type EnvCompletionOtherFile.response in EnvCompletion [extract_type]--> found record -[extract_type]--> digging for type EnvCompletionOtherFile.response in EnvCompletionOtherFile +[extract_type]--> digging for type EnvCompletionOtherFile.response in EnvCompletion [extract_type]--> found record [{ "label": "stuff", @@ -132,27 +151,10 @@ Path use [extract_type]--> found record [nested_expr]--> trying to move into record field [nested_expr]--> found record field type -[nested_expr]--> extracting from type theVariant in env EnvCompletionOtherFile -[extract_type]--> digging for type theVariant in EnvCompletionOtherFile -[extract_type]--> found variant -[nested_expr]--> reached end of pattern, returning type -[{ - "label": "First", - "kind": 4, - "tags": [], - "detail": "First\n\ntype theVariant = First | Second(r1)", - "documentation": null, - "insertText": "First", - "insertTextFormat": 2 - }, { - "label": "Second(_)", - "kind": 4, - "tags": [], - "detail": "Second(r1)\n\ntype theVariant = First | Second(r1)", - "documentation": null, - "insertText": "Second(${1:_})", - "insertTextFormat": 2 - }] +[nested_expr]--> extracting from type theVariant in env EnvCompletion +[extract_type]--> digging for type theVariant in EnvCompletion +[extract_type]--> found nothing when digging +[] Complete src/EnvCompletion.res 28:35 posCursor:[28:35] posNoWhite:[28:34] Found pattern:[28:20->28:38] @@ -170,26 +172,15 @@ Path use [extract_type]--> found record [nested_expr]--> trying to move into record field [nested_expr]--> found record field type -[nested_expr]--> extracting from type theVariant in env EnvCompletionOtherFile -[extract_type]--> digging for type theVariant in EnvCompletionOtherFile -[extract_type]--> found variant -[nested_expr]--> trying to move into variant payload $0 of constructor 'Second' -[nested_expr]--> found constructor (Args type) -[nested_expr]--> found arg of type: r1 -[extract_type]--> digging for type r1 in EnvCompletionOtherFile -[extract_type]--> found record -[nested_expr]--> extracted type, continuing descent -[nested_expr]--> reached end of pattern, returning type -[{ - "label": "{}", - "kind": 22, - "tags": [], - "detail": "r1", - "documentation": null, - "sortText": "A", - "insertText": "{$0}", - "insertTextFormat": 2 - }] +[nested_expr]--> extracting from type theVariant in env EnvCompletion +[extract_type]--> digging for type theVariant in EnvCompletion +[extract_type]--> found nothing when digging +Completable: Cpath Value[()] +Package opens Pervasives.JsxModules.place holder +Resolved opens 1 pervasives +ContextPath Value[()] +Path () +[] Complete src/EnvCompletion.res 31:36 posCursor:[31:36] posNoWhite:[31:35] Found pattern:[31:20->31:40] @@ -206,24 +197,15 @@ Path use [extract_type]--> found record [nested_expr]--> trying to move into record field [nested_expr]--> found record field type -[nested_expr]--> extracting from type theVariant in env EnvCompletionOtherFile -[extract_type]--> digging for type theVariant in EnvCompletionOtherFile -[extract_type]--> found variant -[nested_expr]--> trying to move into variant payload $0 of constructor 'Second' -[nested_expr]--> found constructor (Args type) -[nested_expr]--> found arg of type: r1 -[extract_type]--> digging for type r1 in EnvCompletionOtherFile -[extract_type]--> found record -[nested_expr]--> extracted type, continuing descent -[extract_type]--> digging for type r1 in EnvCompletionOtherFile -[extract_type]--> found record -[{ - "label": "age", - "kind": 5, - "tags": [], - "detail": "age: int\n\nr1", - "documentation": null - }] +[nested_expr]--> extracting from type theVariant in env EnvCompletion +[extract_type]--> digging for type theVariant in EnvCompletion +[extract_type]--> found nothing when digging +Completable: Cpath Value[Second] +Package opens Pervasives.JsxModules.place holder +Resolved opens 1 pervasives +ContextPath Value[Second] +Path Second +[] Complete src/EnvCompletion.res 34:25 posCursor:[34:25] posNoWhite:[34:24] Found pattern:[34:20->34:29] @@ -237,25 +219,25 @@ Path use [extract_type]--> found record [nested_expr]--> trying to move into record field [nested_expr]--> found record field type -[nested_expr]--> extracting from type someResult in env EnvCompletionOtherFile -[extract_type]--> digging for type someResult in EnvCompletionOtherFile +[nested_expr]--> extracting from type someResult in env EnvCompletion +[extract_type]--> digging for type someResult in EnvCompletion [extract_type]--> found variant [nested_expr]--> reached end of pattern, returning type [{ - "label": "Okay(_)", + "label": "One", "kind": 4, "tags": [], - "detail": "Okay('a)\n\ntype someResult<'a, 'b> = Okay('a) | Failure('b)", + "detail": "One\n\ntype things = One | Two", "documentation": null, - "insertText": "Okay(${1:_})", + "insertText": "One", "insertTextFormat": 2 }, { - "label": "Failure(_)", + "label": "Two", "kind": 4, "tags": [], - "detail": "Failure('b)\n\ntype someResult<'a, 'b> = Okay('a) | Failure('b)", + "detail": "Two\n\ntype things = One | Two", "documentation": null, - "insertText": "Failure(${1:_})", + "insertText": "Two", "insertTextFormat": 2 }] @@ -275,13 +257,10 @@ Path use [extract_type]--> found record [nested_expr]--> trying to move into record field [nested_expr]--> found record field type -[nested_expr]--> extracting from type someResult in env EnvCompletionOtherFile -[extract_type]--> digging for type someResult in EnvCompletionOtherFile +[nested_expr]--> extracting from type someResult in env EnvCompletion +[extract_type]--> digging for type someResult in EnvCompletion [extract_type]--> found variant [nested_expr]--> trying to move into variant payload $0 of constructor 'Okay' -[nested_expr]--> found constructor (Args type) -[nested_expr]--> found arg of type: 'a -[extract_type]--> miss Completable: Cpath Value[()] Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives @@ -307,13 +286,10 @@ Path use [extract_type]--> found record [nested_expr]--> trying to move into record field [nested_expr]--> found record field type -[nested_expr]--> extracting from type someResult in env EnvCompletionOtherFile -[extract_type]--> digging for type someResult in EnvCompletionOtherFile +[nested_expr]--> extracting from type someResult in env EnvCompletion +[extract_type]--> digging for type someResult in EnvCompletion [extract_type]--> found variant [nested_expr]--> trying to move into variant payload $0 of constructor 'Okay' -[nested_expr]--> found constructor (Args type) -[nested_expr]--> found arg of type: 'a -[extract_type]--> miss Completable: Cpath Value[()] Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives @@ -338,13 +314,10 @@ Path use [extract_type]--> found record [nested_expr]--> trying to move into record field [nested_expr]--> found record field type -[nested_expr]--> extracting from type someResult in env EnvCompletionOtherFile -[extract_type]--> digging for type someResult in EnvCompletionOtherFile +[nested_expr]--> extracting from type someResult in env EnvCompletion +[extract_type]--> digging for type someResult in EnvCompletion [extract_type]--> found variant [nested_expr]--> trying to move into variant payload $0 of constructor 'Okay' -[nested_expr]--> found constructor (Args type) -[nested_expr]--> found arg of type: 'a -[extract_type]--> miss Completable: Cpath Value[Second] Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives @@ -382,7 +355,7 @@ ContextPath Value[res2] Path res2 [extract_type]--> digging for type EnvCompletionOtherFile.someRecord in EnvCompletion [extract_type]--> found record -[extract_type]--> digging for type EnvCompletionOtherFile.someRecord in EnvCompletionOtherFile +[extract_type]--> digging for type EnvCompletionOtherFile.someRecord in EnvCompletion [extract_type]--> found record [{ "label": "name", @@ -415,7 +388,7 @@ Path res2 [extract_type]--> found record [nested_expr]--> trying to move into record field [nested_expr]--> found record field type -[nested_expr]--> extracting from type 'thing in env EnvCompletionOtherFile +[nested_expr]--> extracting from type 'thing in env EnvCompletion [extract_type]--> miss [] @@ -430,25 +403,8 @@ Path res2 [extract_type]--> found record [nested_expr]--> trying to move into record field [nested_expr]--> found record field type -[nested_expr]--> extracting from type theVariant in env EnvCompletionOtherFile -[extract_type]--> digging for type theVariant in EnvCompletionOtherFile -[extract_type]--> found variant -[nested_expr]--> reached end of pattern, returning type -[{ - "label": "First", - "kind": 4, - "tags": [], - "detail": "First\n\ntype theVariant = First | Second(r1)", - "documentation": null, - "insertText": "First", - "insertTextFormat": 2 - }, { - "label": "Second(_)", - "kind": 4, - "tags": [], - "detail": "Second(r1)\n\ntype theVariant = First | Second(r1)", - "documentation": null, - "insertText": "Second(${1:_})", - "insertTextFormat": 2 - }] +[nested_expr]--> extracting from type theVariant in env EnvCompletion +[extract_type]--> digging for type theVariant in EnvCompletion +[extract_type]--> found nothing when digging +[] diff --git a/analysis/tests/src/expected/Reprod.res.txt b/analysis/tests/src/expected/Reprod.res.txt index c77cc0a15..86314de7a 100644 --- a/analysis/tests/src/expected/Reprod.res.txt +++ b/analysis/tests/src/expected/Reprod.res.txt @@ -15,29 +15,11 @@ Path Query.use [extract_type]--> found record [nested_expr]--> trying to move into record field [nested_expr]--> found record field type -[nested_expr]--> extracting from type location in env QueryFile -[extract_type]--> digging for type location in QueryFile -[extract_type]--> found type manifest -[extract_type]--> digging for type SchemaAssets.input_Location in QueryFile -[extract_type]--> found variant -[nested_expr]--> trying to move into variant payload $0 of constructor 'ByAddress' -[nested_expr]--> found constructor (Args type) -[nested_expr]--> found arg of type: input_ByAddress -[extract_type]--> digging for type input_ByAddress in SchemaAssets -[extract_type]--> found record -[nested_expr]--> extracted type, continuing descent -[nested_expr]--> reached end of pattern, returning type ---> found type in nested expression completion -[{ - "label": "{}", - "kind": 12, - "tags": [], - "detail": "input_ByAddress", - "documentation": null, - "sortText": "A", - "insertText": "{$0}", - "insertTextFormat": 2 - }] +[nested_expr]--> extracting from type location in env Reprod +[extract_type]--> digging for type location in Reprod +[extract_type]--> found nothing when digging +--> could not resolve nested expression path +[] Complete src/Reprod.res 25:21 posCursor:[25:21] posNoWhite:[25:20] Found pattern:[25:18->25:22] @@ -56,13 +38,35 @@ Path res [nested_expr]--> trying to move into variant payload $0 of constructor 'Ok' [nested_expr]--> found constructor (Args type) [nested_expr]--> found arg of type: 'a -[extract_type]--> miss -Completable: Cpath Value[()] -Package opens Pervasives.JsxModules.place holder -Resolved opens 1 pervasives -ContextPath Value[()] -Path () -[] +[extract_type]--> digging for type someVariant in Reprod +[extract_type]--> found variant +[nested_expr]--> extracted type, continuing descent +[nested_expr]--> reached end of pattern, returning type +[{ + "label": "One", + "kind": 4, + "tags": [], + "detail": "One\n\ntype someVariant = One | Two(bool) | Three(someRecord, bool)", + "documentation": null, + "insertText": "One", + "insertTextFormat": 2 + }, { + "label": "Two(_)", + "kind": 4, + "tags": [], + "detail": "Two(bool)\n\ntype someVariant = One | Two(bool) | Three(someRecord, bool)", + "documentation": null, + "insertText": "Two(${1:_})", + "insertTextFormat": 2 + }, { + "label": "Three(_, _)", + "kind": 4, + "tags": [], + "detail": "Three(someRecord, bool)\n\ntype someVariant = One | Two(bool) | Three(someRecord, bool)", + "documentation": null, + "insertText": "Three(${1:_}, ${2:_})", + "insertTextFormat": 2 + }] Complete src/Reprod.res 28:24 posCursor:[28:24] posNoWhite:[28:23] Found pattern:[28:18->28:25] @@ -81,11 +85,33 @@ Path res [nested_expr]--> trying to move into variant payload $0 of constructor 'Error' [nested_expr]--> found constructor (Args type) [nested_expr]--> found arg of type: 'b -[extract_type]--> miss -Completable: Cpath Value[()] -Package opens Pervasives.JsxModules.place holder -Resolved opens 1 pervasives -ContextPath Value[()] -Path () -[] +[extract_type]--> digging for type somePolyVariant in Reprod +[extract_type]--> found type manifest +[nested_expr]--> extracted type, continuing descent +[nested_expr]--> reached end of pattern, returning type +[{ + "label": "#one", + "kind": 4, + "tags": [], + "detail": "#one\n\n[#one | #three(someRecord, bool) | #two(bool)]", + "documentation": null, + "insertText": "#one", + "insertTextFormat": 2 + }, { + "label": "#three(_, _)", + "kind": 4, + "tags": [], + "detail": "#three(someRecord, bool)\n\n[#one | #three(someRecord, bool) | #two(bool)]", + "documentation": null, + "insertText": "#three(${1:_}, ${2:_})", + "insertTextFormat": 2 + }, { + "label": "#two(_)", + "kind": 4, + "tags": [], + "detail": "#two(bool)\n\n[#one | #three(someRecord, bool) | #two(bool)]", + "documentation": null, + "insertText": "#two(${1:_})", + "insertTextFormat": 2 + }] From 97cee7f8c9642b039bf66a4b84e89c0940f7411b Mon Sep 17 00:00:00 2001 From: Gabriel Nordeborn Date: Sun, 7 Jan 2024 20:44:29 +0100 Subject: [PATCH 05/17] more cleanup --- analysis/src/TypeUtils.ml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/analysis/src/TypeUtils.ml b/analysis/src/TypeUtils.ml index 1e6f43d12..bf6f07898 100644 --- a/analysis/src/TypeUtils.ml +++ b/analysis/src/TypeUtils.ml @@ -1,8 +1,7 @@ open SharedTypes -let instantiateType ?(instantiateTypes = true) ~typeParams ~typeArgs - (t : Types.type_expr) = - if typeParams = [] || typeArgs = [] || instantiateTypes = false then t +let instantiateType ~typeParams ~typeArgs (t : Types.type_expr) = + if typeParams = [] || typeArgs = [] then t else let rec applySub tp ta t = match (tp, ta) with @@ -136,9 +135,7 @@ let rec extractType ~env ~package (t : Types.type_expr) = (Printf.sprintf "[extract_type]--> digging for type %s in %s" (Path.name path) env.file.moduleName); match References.digConstructor ~env ~package path with - | Some - (_envFromItem, {item = {decl = {type_manifest = Some t1; type_params}}}) - -> + | Some (_env, {item = {decl = {type_manifest = Some t1; type_params}}}) -> Debug.logVerbose "[extract_type]--> found type manifest"; t1 |> instantiateType ~typeParams:type_params ~typeArgs @@ -155,7 +152,7 @@ let rec extractType ~env ~package (t : Types.type_expr) = typeArgs; typeParams = decl.type_params; }) - | Some (_env, {item = {kind = Record fields}}) -> + | Some (env, {item = {kind = Record fields}}) -> Debug.logVerbose "[extract_type]--> found record"; Some (Trecord {env; fields; definition = `TypeExpr t}) | None -> @@ -327,7 +324,6 @@ type ctx = Rfield of string (** A record field of name *) (** This moves through a nested path via a set of instructions, trying to resolve the type at the end of the path. *) let rec resolveNested ~env ~full ~nested ?ctx (typ : completionType) = - let extractType = extractType in match nested with | [] -> Debug.logVerbose "[nested_expr]--> reached end of pattern, returning type"; From 29fad7f9df2597736d568910dc5cc5fe43f0b542 Mon Sep 17 00:00:00 2001 From: Gabriel Nordeborn Date: Mon, 8 Jan 2024 16:53:53 +0100 Subject: [PATCH 06/17] pass type arg ctx around properly --- analysis/src/CompletionBackEnd.ml | 10 +- analysis/src/Debug.ml | 5 + analysis/src/SharedTypes.ml | 3 +- analysis/src/TypeUtils.ml | 480 ++++++++++++++++-- analysis/tests/src/Reprod.res | 26 + .../tests/src/expected/Completion.res.txt | 21 +- .../expected/CompletionExpressions.res.txt | 315 ++++++++---- .../CompletionFunctionArguments.res.txt | 41 +- .../expected/CompletionInferValues.res.txt | 40 +- .../tests/src/expected/CompletionJsx.res.txt | 3 +- .../src/expected/CompletionJsxProps.res.txt | 33 +- .../src/expected/CompletionPattern.res.txt | 479 +++++++++++++---- .../expected/CompletionTypeAnnotation.res.txt | 55 +- .../tests/src/expected/Destructuring.res.txt | 17 + .../tests/src/expected/EnvCompletion.res.txt | 370 ++++++++++---- analysis/tests/src/expected/Fragment.res.txt | 2 +- analysis/tests/src/expected/Hover.res.txt | 1 + analysis/tests/src/expected/Jsx2.res.txt | 3 +- analysis/tests/src/expected/Reprod.res.txt | 359 +++++++++++-- .../src/expected/TypeAtPosCompletion.res.txt | 20 +- 20 files changed, 1821 insertions(+), 462 deletions(-) diff --git a/analysis/src/CompletionBackEnd.ml b/analysis/src/CompletionBackEnd.ml index 236939d81..a245e060f 100644 --- a/analysis/src/CompletionBackEnd.ml +++ b/analysis/src/CompletionBackEnd.ml @@ -1111,6 +1111,7 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~pos ~env ~exact (if expandOption then Utils.unwrapIfOption typ else typ)); ]) | CPatternPath {rootCtxPath; nested} -> ( + (* TODO(env-stuff) Get rid of innerType etc *) match rootCtxPath |> getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~pos ~env @@ -1823,9 +1824,10 @@ let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover completable = | Some (typ, env) -> ( match typ - |> TypeUtils.extractType ~env ~package:full.package - |> Utils.Option.flatMap (fun typ -> - typ |> TypeUtils.resolveNested ~env ~full ~nested) + |> TypeUtils.extractType2 ~env ~package:full.package + |> Utils.Option.flatMap (fun (typ, typeArgContext) -> + typ + |> TypeUtils.resolveNested2 ?typeArgContext ~env ~full ~nested) with | None -> fallbackOrEmpty () | Some (typ, _env, completionContext) -> @@ -1858,7 +1860,7 @@ let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover completable = Debug.logVerbose "--> could not get completions for context path"; regularCompletions | Some (typ, env) -> ( - match typ |> TypeUtils.resolveNested ~env ~full ~nested with + match typ |> TypeUtils.resolveNested2 ~env ~full ~nested with | None -> Debug.logVerbose "--> could not resolve nested expression path"; regularCompletions diff --git a/analysis/src/Debug.ml b/analysis/src/Debug.ml index 383ba1f67..69565a6cb 100644 --- a/analysis/src/Debug.ml +++ b/analysis/src/Debug.ml @@ -8,3 +8,8 @@ let log s = | Off -> () let logVerbose s = if !debugLevel = Verbose then print_endline s + +let debugPrintEnv (env : SharedTypes.QueryEnv.t) = + env.pathRev @ [env.file.moduleName] |> List.rev |> String.concat "." + +let verbose () = !debugLevel = Verbose diff --git a/analysis/src/SharedTypes.ml b/analysis/src/SharedTypes.ml index 2528b6021..a4554b941 100644 --- a/analysis/src/SharedTypes.ml +++ b/analysis/src/SharedTypes.ml @@ -317,6 +317,7 @@ type polyVariantConstructor = { args: Types.type_expr list; } +(* TODO(env-stuff) All envs for bool string etc can be removed. *) type innerType = TypeExpr of Types.type_expr | ExtractedType of completionType and completionType = | Tuple of QueryEnv.t * Types.type_expr list * Types.type_expr @@ -337,8 +338,6 @@ and completionType = constructors: Constructor.t list; variantDecl: Types.type_declaration; variantName: string; - typeArgs: Types.type_expr list; - typeParams: Types.type_expr list; } | Tpolyvariant of { env: QueryEnv.t; diff --git a/analysis/src/TypeUtils.ml b/analysis/src/TypeUtils.ml index bf6f07898..869c5df10 100644 --- a/analysis/src/TypeUtils.ml +++ b/analysis/src/TypeUtils.ml @@ -1,7 +1,14 @@ open SharedTypes -let instantiateType ~typeParams ~typeArgs (t : Types.type_expr) = - if typeParams = [] || typeArgs = [] then t +type typeArgContext = { + env: QueryEnv.t; + typeArgs: Types.type_expr list; + typeParams: Types.type_expr list; +} + +let instantiateType ?(instantiateTypes = true) ~typeParams ~typeArgs + (t : Types.type_expr) = + if typeParams = [] || typeArgs = [] || instantiateTypes = false then t else let rec applySub tp ta t = match (tp, ta) with @@ -48,6 +55,59 @@ let instantiateType ~typeParams ~typeArgs (t : Types.type_expr) = in loop t +let instantiateType2 ?(typeArgContext : typeArgContext option) + (t : Types.type_expr) = + match typeArgContext with + | None | Some {typeArgs = []} | Some {typeParams = []} -> t + | Some {typeArgs; typeParams} -> + let rec applySub tp ta name = + match (tp, ta) with + | {Types.desc = Tvar (Some varName)} :: tRest1, t2 :: tRest2 -> + if varName = name then t2 else applySub tRest1 tRest2 name + | _ :: tRest1, _ :: tRest2 -> applySub tRest1 tRest2 name + | [], _ | _, [] -> t + in + + let rec loop (t : Types.type_expr) = + match t.desc with + | Tlink t -> loop t + | Tvar (Some name) -> applySub typeParams typeArgs name + | Tvar _ -> t + | Tunivar _ -> t + | Tconstr (path, args, memo) -> + {t with desc = Tconstr (path, args |> List.map loop, memo)} + | Tsubst t -> loop t + | Tvariant rd -> {t with desc = Tvariant (rowDesc rd)} + | Tnil -> t + | Tarrow (lbl, t1, t2, c) -> + {t with desc = Tarrow (lbl, loop t1, loop t2, c)} + | Ttuple tl -> {t with desc = Ttuple (tl |> List.map loop)} + | Tobject (t, r) -> {t with desc = Tobject (loop t, r)} + | Tfield (n, k, t1, t2) -> {t with desc = Tfield (n, k, loop t1, loop t2)} + | Tpoly (t, []) -> loop t + | Tpoly (t, tl) -> {t with desc = Tpoly (loop t, tl |> List.map loop)} + | Tpackage (p, l, tl) -> + {t with desc = Tpackage (p, l, tl |> List.map loop)} + and rowDesc (rd : Types.row_desc) = + let row_fields = + rd.row_fields |> List.map (fun (l, rf) -> (l, rowField rf)) + in + let row_more = loop rd.row_more in + let row_name = + match rd.row_name with + | None -> None + | Some (p, tl) -> Some (p, tl |> List.map loop) + in + {rd with row_fields; row_more; row_name} + and rowField (rf : Types.row_field) = + match rf with + | Rpresent None -> rf + | Rpresent (Some t) -> Rpresent (Some (loop t)) + | Reither (b1, tl, b2, r) -> Reither (b1, tl |> List.map loop, b2, r) + | Rabsent -> Rabsent + in + loop t + let rec extractRecordType ~env ~package (t : Types.type_expr) = match t.desc with | Tlink t1 | Tsubst t1 | Tpoly (t1, []) -> extractRecordType ~env ~package t1 @@ -88,13 +148,13 @@ let rec extractObjectType ~env ~package (t : Types.type_expr) = | _ -> None) | _ -> None -let rec extractFunctionType ~env ~package typ = +let rec extractFunctionType ?(instantiateTypes = true) ~env ~package typ = let rec loop ~env acc (t : Types.type_expr) = match t.desc with | Tlink t1 | Tsubst t1 | Tpoly (t1, []) -> loop ~env acc t1 | Tarrow (label, tArg, tRet, _) -> loop ~env ((label, tArg) :: acc) tRet | Tconstr (Pident {name = "function$"}, [t; _], _) -> - extractFunctionType ~env ~package t + extractFunctionType ~instantiateTypes ~env ~package t | Tconstr (path, typeArgs, _) -> ( match References.digConstructor ~env ~package path with | Some @@ -102,15 +162,45 @@ let rec extractFunctionType ~env ~package typ = { item = {decl = {type_manifest = Some t1; type_params = typeParams}}; } ) -> - let t1 = t1 |> instantiateType ~typeParams ~typeArgs in + let t1 = + t1 |> instantiateType ~instantiateTypes ~typeParams ~typeArgs + in loop ~env acc t1 | _ -> (List.rev acc, t)) | _ -> (List.rev acc, t) in loop ~env [] typ +let rec extractFunctionType2 ?typeArgContext ~env ~package typ = + let rec loop ?typeArgContext ~env acc (t : Types.type_expr) = + match t.desc with + | Tlink t1 | Tsubst t1 | Tpoly (t1, []) -> loop ?typeArgContext ~env acc t1 + | Tarrow (label, tArg, tRet, _) -> + loop ?typeArgContext ~env ((label, tArg) :: acc) tRet + | Tconstr (Pident {name = "function$"}, [t; _], _) -> + extractFunctionType2 ?typeArgContext ~env ~package t + | Tconstr (path, typeArgs, _) -> ( + match References.digConstructor ~env ~package path with + | Some + ( env, + { + item = {decl = {type_manifest = Some t1; type_params = typeParams}}; + } ) -> + let typeArgContext = + if List.length typeParams > 0 then Some {env; typeParams; typeArgs} + else None + in + loop ?typeArgContext ~env acc t1 + | _ -> (List.rev acc, t, typeArgContext)) + | _ -> (List.rev acc, t, typeArgContext) + in + loop ?typeArgContext ~env [] typ + (** Pulls out a type we can complete from a type expr. *) -let rec extractType ~env ~package (t : Types.type_expr) = +let rec extractType ?(instantiateTypes = true) ~env ~package + (t : Types.type_expr) = + let extractType = extractType ~instantiateTypes in + let instantiateType = instantiateType ~instantiateTypes in match t.desc with | Tlink t1 | Tsubst t1 | Tpoly (t1, []) -> extractType ~env ~package t1 | Tconstr (Path.Pident {name = "option"}, [payloadTypeExpr], _) -> @@ -126,32 +216,26 @@ let rec extractType ~env ~package (t : Types.type_expr) = | Tconstr (Path.Pident {name = "exn"}, [], _) -> Some (Texn env) | Tconstr (Pident {name = "function$"}, [t; _], _) -> ( (* Uncurried functions. *) - match extractFunctionType t ~env ~package with + match extractFunctionType ~instantiateTypes t ~env ~package with | args, tRet when args <> [] -> Some (Tfunction {env; args; typ = t; uncurried = true; returnType = tRet}) | _args, _tRet -> None) | Tconstr (path, typeArgs, _) -> ( Debug.logVerbose (Printf.sprintf "[extract_type]--> digging for type %s in %s" - (Path.name path) env.file.moduleName); + (Path.name path) (Debug.debugPrintEnv env)); match References.digConstructor ~env ~package path with - | Some (_env, {item = {decl = {type_manifest = Some t1; type_params}}}) -> + | Some (env, {item = {decl = {type_manifest = Some t1; type_params}}}) -> Debug.logVerbose "[extract_type]--> found type manifest"; t1 - |> instantiateType ~typeParams:type_params ~typeArgs + |> instantiateType ~typeParams:type_params + ~typeArgs (* TODO: Can remove instantiate here? *) |> extractType ~env ~package - | Some (_env, {name; item = {decl; kind = Type.Variant constructors}}) -> + | Some (env, {name; item = {decl; kind = Type.Variant constructors}}) -> Debug.logVerbose "[extract_type]--> found variant"; Some (Tvariant - { - env; - constructors; - variantName = name.txt; - variantDecl = decl; - typeArgs; - typeParams = decl.type_params; - }) + {env; constructors; variantName = name.txt; variantDecl = decl}) | Some (env, {item = {kind = Record fields}}) -> Debug.logVerbose "[extract_type]--> found record"; Some (Trecord {env; fields; definition = `TypeExpr t}) @@ -181,11 +265,157 @@ let rec extractType ~env ~package (t : Types.type_expr) = in Some (Tpolyvariant {env; constructors; typeExpr = t}) | Tarrow _ -> ( - match extractFunctionType t ~env ~package with + match extractFunctionType t ~instantiateTypes ~env ~package with | args, tRet when args <> [] -> Some (Tfunction {env; args; typ = t; uncurried = false; returnType = tRet}) | _args, _tRet -> None) + | Tvar (Some varName) -> + Debug.logVerbose + (Printf.sprintf "[extract_type]--> found type variable: '%s" varName); + None + | _ -> + Debug.logVerbose "[extract_type]--> miss"; + None + +let debugLogTypeArgContext {env; typeArgs; typeParams} = + Printf.sprintf "Type arg context. env: %s, typeArgs: %s, typeParams: %s" + (Debug.debugPrintEnv env) + (typeArgs |> List.map Shared.typeToString |> String.concat ", ") + (typeParams |> List.map Shared.typeToString |> String.concat ", ") + +let rec extractType2 ?(typeArgContext : typeArgContext option) ~env ~package + (t : Types.type_expr) = + Debug.logVerbose + (Printf.sprintf + "[extract_type]--> starting extraction of type: %s, in env: %s. Has \ + type arg ctx: %b" + (Shared.typeToString t) (Debug.debugPrintEnv env) + (Option.is_some typeArgContext)); + (match typeArgContext with + | None -> () + | Some typeArgContext -> + Debug.logVerbose + (Printf.sprintf "[extract_type]--> %s" + (debugLogTypeArgContext typeArgContext))); + let extractType = extractType2 in + let instantiateType = instantiateType2 in + match t.desc with + | Tlink t1 | Tsubst t1 | Tpoly (t1, []) -> + extractType ?typeArgContext ~env ~package t1 + | Tconstr (Path.Pident {name = "option"}, [payloadTypeExpr], _) -> + Some (Toption (env, TypeExpr payloadTypeExpr), typeArgContext) + | Tconstr (Path.Pident {name = "promise"}, [payloadTypeExpr], _) -> + Some (Tpromise (env, payloadTypeExpr), typeArgContext) + | Tconstr (Path.Pident {name = "array"}, [payloadTypeExpr], _) -> + Some (Tarray (env, TypeExpr payloadTypeExpr), typeArgContext) + | Tconstr (Path.Pident {name = "result"}, [okType; errorType], _) -> + Some (Tresult {env; okType; errorType}, typeArgContext) + | Tconstr (Path.Pident {name = "bool"}, [], _) -> + Some (Tbool env, typeArgContext) + | Tconstr (Path.Pident {name = "string"}, [], _) -> + Some (Tstring env, typeArgContext) + | Tconstr (Path.Pident {name = "exn"}, [], _) -> + Some (Texn env, typeArgContext) + | Tconstr (Pident {name = "function$"}, [t; _], _) -> + extractType ?typeArgContext ~env ~package t + | Tconstr (path, typeArgs, _) -> ( + Debug.logVerbose + (Printf.sprintf "[extract_type]--> digging for type %s in %s" + (Path.name path) (Debug.debugPrintEnv env)); + match References.digConstructor ~env ~package path with + | Some + ( envFromDeclaration, + {item = {decl = {type_manifest = Some t1; type_params}}} ) -> + Debug.logVerbose "[extract_type]--> found type manifest"; + let typeArgContext = + if List.length type_params > 0 then + Some {env; typeParams = type_params; typeArgs} + else None + in + t1 |> extractType ?typeArgContext ~env:envFromDeclaration ~package + | Some (env, {name; item = {decl; kind = Type.Variant constructors}}) -> + Debug.logVerbose "[extract_type]--> found variant"; + Some + ( Tvariant + {env; constructors; variantName = name.txt; variantDecl = decl}, + typeArgContext ) + | Some (env, {item = {kind = Record fields; decl}}) -> + Debug.logVerbose "[extract_type]--> found record"; + (* Need to create a new type arg context here because we're sending along a type expr that might have type vars. *) + let typeArgContext = + if List.length typeArgs > 0 then + Some {env; typeParams = decl.type_params; typeArgs} + else None + in + Some (Trecord {env; fields; definition = `TypeExpr t}, typeArgContext) + | None -> + Debug.logVerbose "[extract_type]--> found nothing when digging"; + None + | _ -> + Debug.logVerbose "[extract_type]--> found something else when digging"; + None) + | Ttuple expressions -> Some (Tuple (env, expressions, t), typeArgContext) + | Tvariant {row_fields} -> + let constructors = + row_fields + |> List.map (fun (label, field) -> + { + name = label; + displayName = Utils.printMaybeExoticIdent ~allowUident:true label; + args = + (* Multiple arguments are represented as a Ttuple, while a single argument is just the type expression itself. *) + (match field with + | Types.Rpresent (Some typeExpr) -> ( + match typeExpr.desc with + | Ttuple args -> args + | _ -> [typeExpr]) + | _ -> []); + }) + in + Some (Tpolyvariant {env; constructors; typeExpr = t}, typeArgContext) + | Tarrow _ -> ( + match extractFunctionType2 ?typeArgContext t ~env ~package with + | args, tRet, typeArgContext when args <> [] -> + Some + ( Tfunction {env; args; typ = t; uncurried = true; returnType = tRet}, + typeArgContext ) + | _args, _tRet, _typeArgContext -> None) + | Tvar (Some varName) -> ( + Debug.logVerbose + (Printf.sprintf + "[extract_type]--> found type variable: '%s. Trying to instantiate %s" + varName + (match typeArgContext with + | None -> "with no type args ctx" + | Some typeArgContext -> + Printf.sprintf "with %s" (debugLogTypeArgContext typeArgContext))); + + let instantiated = t |> instantiateType ?typeArgContext in + let rec extractInstantiated t = + match t.Types.desc with + | Tlink t1 | Tsubst t1 | Tpoly (t1, []) -> extractInstantiated t1 + | _ -> t + in + match extractInstantiated instantiated with + | {desc = Tvar _} -> + Debug.logVerbose + (Printf.sprintf "[extract_type]--> could not instantiate '%s. Skipping." + varName); + None + | _ -> + Debug.logVerbose + (Printf.sprintf + "[extract_type]--> SUCCEEDED instantiation, new type is: %s" + (Shared.typeToString instantiated)); + + (* Use the env from instantiation if we managed to instantiate the type param *) + let nextEnv = + match typeArgContext with + | Some {env} -> env + | None -> env + in + instantiated |> extractType ?typeArgContext ~env:nextEnv ~package) | _ -> Debug.logVerbose "[extract_type]--> miss"; None @@ -306,14 +536,7 @@ let extractTypeFromResolvedType (typ : Type.t) ~env ~full = | Variant constructors -> Some (Tvariant - { - env; - constructors; - variantName = typ.name; - variantDecl = typ.decl; - typeParams = typ.decl.type_params; - typeArgs = []; - }) + {env; constructors; variantName = typ.name; variantDecl = typ.decl}) | Abstract _ | Open -> ( match typ.decl.type_manifest with | None -> None @@ -326,7 +549,7 @@ type ctx = Rfield of string (** A record field of name *) let rec resolveNested ~env ~full ~nested ?ctx (typ : completionType) = match nested with | [] -> - Debug.logVerbose "[nested_expr]--> reached end of pattern, returning type"; + Debug.logVerbose "[nested]--> reached end of pattern, returning type"; Some ( typ, env, @@ -337,10 +560,10 @@ let rec resolveNested ~env ~full ~nested ?ctx (typ : completionType) = | patternPath :: nested -> ( match (patternPath, typ) with | Completable.NTupleItem {itemNum}, Tuple (env, tupleItems, _) -> ( - Debug.logVerbose "[nested_expr]--> trying to move into tuple"; + Debug.logVerbose "[nested]--> trying to move into tuple"; match List.nth_opt tupleItems itemNum with | None -> - Debug.logVerbose "[nested_expr]--> tuple element not found"; + Debug.logVerbose "[nested]--> tuple element not found"; None | Some typ -> typ @@ -349,21 +572,21 @@ let rec resolveNested ~env ~full ~nested ?ctx (typ : completionType) = typ |> resolveNested ~env ~full ~nested)) | ( NFollowRecordField {fieldName}, (TinlineRecord {env; fields} | Trecord {env; fields}) ) -> ( - Debug.logVerbose "[nested_expr]--> trying to move into record field"; + Debug.logVerbose "[nested]--> trying to move into record field"; match fields |> List.find_opt (fun (field : field) -> field.fname.txt = fieldName) with | None -> - Debug.logVerbose "[nested_expr]--> did not find record field"; + Debug.logVerbose "[nested]--> did not find record field"; None | Some {typ; optional} -> - Debug.logVerbose "[nested_expr]--> found record field type"; + Debug.logVerbose "[nested]--> found record field type"; let typ = if optional then Utils.unwrapIfOption typ else typ in Debug.logVerbose - (Printf.sprintf "[nested_expr]--> extracting from type %s in env %s" - (Shared.typeToString typ) env.file.moduleName); + (Printf.sprintf "[nested]--> extracting from type %s in env %s" + (Shared.typeToString typ) (Debug.debugPrintEnv env)); typ |> extractType ~env ~package:full.package |> Utils.Option.flatMap (fun typ -> @@ -384,31 +607,31 @@ let rec resolveNested ~env ~full ~nested ?ctx (typ : completionType) = Some (Completable.RecordField {seenFields}) ) | ( NVariantPayload {constructorName = "Some"; itemNum = 0}, Toption (env, ExtractedType typ) ) -> - Debug.logVerbose "[nested_expr]--> moving into option Some"; + Debug.logVerbose "[nested]--> moving into option Some"; typ |> resolveNested ~env ~full ~nested | ( NVariantPayload {constructorName = "Some"; itemNum = 0}, Toption (env, TypeExpr typ) ) -> - Debug.logVerbose "[nested_expr]--> moving into option Some"; + Debug.logVerbose "[nested]--> moving into option Some"; typ |> extractType ~env ~package:full.package |> Utils.Option.flatMap (fun t -> t |> resolveNested ~env ~full ~nested) | NVariantPayload {constructorName = "Ok"; itemNum = 0}, Tresult {okType} -> - Debug.logVerbose "[nested_expr]--> moving into result Ok"; + Debug.logVerbose "[nested]--> moving into result Ok"; okType |> extractType ~env ~package:full.package |> Utils.Option.flatMap (fun t -> t |> resolveNested ~env ~full ~nested) | ( NVariantPayload {constructorName = "Error"; itemNum = 0}, Tresult {errorType} ) -> - Debug.logVerbose "[nested_expr]--> moving into result Error"; + Debug.logVerbose "[nested]--> moving into result Error"; errorType |> extractType ~env ~package:full.package |> Utils.Option.flatMap (fun t -> t |> resolveNested ~env ~full ~nested) - | ( NVariantPayload {constructorName; itemNum}, - Tvariant {env; constructors; typeParams; typeArgs} ) -> ( + | NVariantPayload {constructorName; itemNum}, Tvariant {env; constructors} + -> ( Debug.logVerbose (Printf.sprintf - "[nested_expr]--> trying to move into variant payload $%i of \ - constructor '%s'" + "[nested]--> trying to move into variant payload $%i of constructor \ + '%s'" itemNum constructorName); match constructors @@ -416,25 +639,24 @@ let rec resolveNested ~env ~full ~nested ?ctx (typ : completionType) = c.cname.txt = constructorName) with | Some {args = Args args} -> ( - Debug.logVerbose "[nested_expr]--> found constructor (Args type)"; + Debug.logVerbose "[nested]--> found constructor (Args type)"; match List.nth_opt args itemNum with | None -> - Debug.logVerbose "[nested_expr]--> did not find relevant args num"; + Debug.logVerbose "[nested]--> did not find relevant args num"; None | Some (typ, _) -> Debug.logVerbose - (Printf.sprintf "[nested_expr]--> found arg of type: %s" + (Printf.sprintf "[nested]--> found arg of type: %s" (Shared.typeToString typ)); typ - |> instantiateType ~typeParams ~typeArgs |> extractType ~env ~package:full.package |> Utils.Option.flatMap (fun typ -> Debug.logVerbose - "[nested_expr]--> extracted type, continuing descent"; + "[nested]--> extracted type, continuing descent"; typ |> resolveNested ~env ~full ~nested)) | Some {args = InlineRecord fields} when itemNum = 0 -> - Debug.logVerbose "[nested_expr]--> found constructor (inline record)"; + Debug.logVerbose "[nested]--> found constructor (inline record)"; TinlineRecord {env; fields} |> resolveNested ~env ~full ~nested | _ -> None) | ( NPolyvariantPayload {constructorName; itemNum}, @@ -462,6 +684,163 @@ let rec resolveNested ~env ~full ~nested ?ctx (typ : completionType) = typ |> resolveNested ~env ~full ~nested) | _ -> None) +let rec resolveNested2 ?typeArgContext ~env ~full ~nested ?ctx + (typ : completionType) = + let extractType = extractType2 ?typeArgContext in + let resolveNested = resolveNested2 in + Debug.logVerbose + (Printf.sprintf + "[nested]--> running nested in env: %s. Has type arg ctx: %b" + (Debug.debugPrintEnv env) + (Option.is_some typeArgContext)); + (match typeArgContext with + | None -> () + | Some typeArgContext -> + Debug.logVerbose + (Printf.sprintf "[nested]--> %s" (debugLogTypeArgContext typeArgContext))); + match nested with + | [] -> + Debug.logVerbose "[nested]--> reached end of pattern, returning type"; + Some + ( typ, + env, + match ctx with + | None -> None + | Some (Rfield fieldName) -> + Some (Completable.CameFromRecordField fieldName) ) + | patternPath :: nested -> ( + match (patternPath, typ) with + | Completable.NTupleItem {itemNum}, Tuple (env, tupleItems, _) -> ( + Debug.logVerbose "[nested]--> trying to move into tuple"; + match List.nth_opt tupleItems itemNum with + | None -> + Debug.logVerbose "[nested]--> tuple element not found"; + None + | Some typ -> + typ + |> extractType ~env ~package:full.package + |> Utils.Option.flatMap (fun (typ, typeArgContext) -> + typ |> resolveNested ?typeArgContext ~env ~full ~nested)) + | ( NFollowRecordField {fieldName}, + (TinlineRecord {env; fields} | Trecord {env; fields}) ) -> ( + Debug.logVerbose "[nested]--> trying to move into record field"; + match + fields + |> List.find_opt (fun (field : field) -> field.fname.txt = fieldName) + with + | None -> + Debug.logVerbose "[nested]--> did not find record field"; + None + | Some {typ; optional} -> + Debug.logVerbose "[nested]--> found record field type"; + let typ = if optional then Utils.unwrapIfOption typ else typ in + + Debug.logVerbose + (Printf.sprintf "[nested]--> extracting from type %s in env %s" + (Shared.typeToString typ) (Debug.debugPrintEnv env)); + typ + |> extractType ~env ~package:full.package + |> Utils.Option.flatMap (fun (typ, typeArgContext) -> + typ + |> resolveNested ?typeArgContext ~ctx:(Rfield fieldName) ~env + ~full ~nested)) + | NRecordBody {seenFields}, Trecord {env; definition = `TypeExpr typeExpr} + -> + typeExpr + |> extractType ~env ~package:full.package + |> Option.map (fun (typ, _typeArgContext) -> + (* TODO: Do we need to do anything here with typeArgContext? *) + (typ, env, Some (Completable.RecordField {seenFields}))) + | ( NRecordBody {seenFields}, + (Trecord {env; definition = `NameOnly _} as extractedType) ) -> + Some (extractedType, env, Some (Completable.RecordField {seenFields})) + | NRecordBody {seenFields}, TinlineRecord {env; fields} -> + Some + ( TinlineRecord {fields; env}, + env, + Some (Completable.RecordField {seenFields}) ) + | ( NVariantPayload {constructorName = "Some"; itemNum = 0}, + Toption (env, ExtractedType typ) ) -> + Debug.logVerbose "[nested]--> moving into option Some"; + typ |> resolveNested ~env ~full ~nested + | ( NVariantPayload {constructorName = "Some"; itemNum = 0}, + Toption (env, TypeExpr typ) ) -> + Debug.logVerbose "[nested]--> moving into option Some"; + typ + |> extractType ~env ~package:full.package + |> Utils.Option.flatMap (fun (t, typeArgContext) -> + t |> resolveNested ?typeArgContext ~env ~full ~nested) + | NVariantPayload {constructorName = "Ok"; itemNum = 0}, Tresult {okType} -> + Debug.logVerbose "[nested]--> moving into result Ok"; + okType + |> extractType ~env ~package:full.package + |> Utils.Option.flatMap (fun (t, typeArgContext) -> + t |> resolveNested ?typeArgContext ~env ~full ~nested) + | ( NVariantPayload {constructorName = "Error"; itemNum = 0}, + Tresult {errorType} ) -> + Debug.logVerbose "[nested]--> moving into result Error"; + errorType + |> extractType ~env ~package:full.package + |> Utils.Option.flatMap (fun (t, typeArgContext) -> + t |> resolveNested ?typeArgContext ~env ~full ~nested) + | NVariantPayload {constructorName; itemNum}, Tvariant {env; constructors} + -> ( + Debug.logVerbose + (Printf.sprintf + "[nested]--> trying to move into variant payload $%i of constructor \ + '%s'" + itemNum constructorName); + match + constructors + |> List.find_opt (fun (c : Constructor.t) -> + c.cname.txt = constructorName) + with + | Some {args = Args args} -> ( + Debug.logVerbose "[nested]--> found constructor (Args type)"; + match List.nth_opt args itemNum with + | None -> + Debug.logVerbose "[nested]--> did not find relevant args num"; + None + | Some (typ, _) -> + Debug.logVerbose + (Printf.sprintf "[nested]--> found arg of type: %s" + (Shared.typeToString typ)); + + typ + |> extractType ~env ~package:full.package + |> Utils.Option.flatMap (fun (typ, typeArgContext) -> + Debug.logVerbose + "[nested]--> extracted type, continuing descent"; + typ |> resolveNested ?typeArgContext ~env ~full ~nested)) + | Some {args = InlineRecord fields} when itemNum = 0 -> + Debug.logVerbose "[nested]--> found constructor (inline record)"; + TinlineRecord {env; fields} |> resolveNested ~env ~full ~nested + | _ -> None) + | ( NPolyvariantPayload {constructorName; itemNum}, + Tpolyvariant {env; constructors} ) -> ( + match + constructors + |> List.find_opt (fun (c : polyVariantConstructor) -> + c.name = constructorName) + with + | None -> None + | Some constructor -> ( + match List.nth_opt constructor.args itemNum with + | None -> None + | Some typ -> + typ + |> extractType ~env ~package:full.package + |> Utils.Option.flatMap (fun (typ, typeArgContext) -> + typ |> resolveNested ?typeArgContext ~env ~full ~nested))) + | NArray, Tarray (env, ExtractedType typ) -> + typ |> resolveNested ~env ~full ~nested + | NArray, Tarray (env, TypeExpr typ) -> + typ + |> extractType ~env ~package:full.package + |> Utils.Option.flatMap (fun (typ, typeArgContext) -> + typ |> resolveNested ?typeArgContext ~env ~full ~nested) + | _ -> None) + let findTypeOfRecordField fields ~fieldName = match fields |> List.find_opt (fun (field : field) -> field.fname.txt = fieldName) @@ -497,6 +876,7 @@ let findTypeOfPolyvariantArg constructors ~constructorName ~payloadNum = | None -> None let rec resolveNestedPatternPath (typ : innerType) ~env ~full ~nested = + Debug.logVerbose "[nested_pattern_path]"; let t = match typ with | TypeExpr t -> t |> extractType ~env ~package:full.package diff --git a/analysis/tests/src/Reprod.res b/analysis/tests/src/Reprod.res index c339e82e6..e617686fc 100644 --- a/analysis/tests/src/Reprod.res +++ b/analysis/tests/src/Reprod.res @@ -21,6 +21,24 @@ type somePolyVariant = [#one | #two(bool) | #three(someRecord, bool)] type someVariant = One | Two(bool) | Three(someRecord, bool) +type paramRecord<'a, 'b> = { + first: 'a, + second: 'b, +} + +let record: paramRecord = { + first: One, + second: {city: "city"}, +} + +// switch record { | {first: }} +// ^com + +// switch record { | {second: }} +// ^com + +// TODO: Functions, aliases/definitions, records, variants, polyvariants, tuples + let res: result = Ok(One) // switch res { | Ok() } @@ -28,3 +46,11 @@ let res: result = Ok(One) // switch res { | Error() } // ^com + +let resOpt: result, unit> = Ok(None) + +// switch resOpt { | Ok() } +// ^com + +// switch resOpt { | Ok(Some()) } +// ^com diff --git a/analysis/tests/src/expected/Completion.res.txt b/analysis/tests/src/expected/Completion.res.txt index 33945e0c4..6ec4c104b 100644 --- a/analysis/tests/src/expected/Completion.res.txt +++ b/analysis/tests/src/expected/Completion.res.txt @@ -521,7 +521,8 @@ Resolved opens 1 pervasives --> expression completion ContextPath CJsxPropValue [O, Comp] second Path O.Comp.make -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: Completion.O.Comp. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "zzz", @@ -1745,6 +1746,8 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 3 pervasives Completion.res Completion.res ContextPath Value[x] Path x +[extract_type]--> starting extraction of type: 'a, in env: Completion. Has type arg ctx: false +[extract_type]--> starting extraction of type: 'a, in env: Completion. Has type arg ctx: false [extract_type]--> miss Completable: Cpath Value[T] Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder @@ -2148,7 +2151,8 @@ Resolved opens 3 pervasives Completion.res Completion.res --> expression completion ContextPath Type[someVariantWithDeprecated] Path someVariantWithDeprecated -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: Completion. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "DoNotUseMe", @@ -2205,10 +2209,15 @@ Resolved opens 3 pervasives Completion.res Completion.res --> expression completion ContextPath Type[withUncurried] Path withUncurried -[nested_expr]--> trying to move into record field -[nested_expr]--> found record field type -[nested_expr]--> extracting from type (. int) => unit in env Completion -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: Completion. Has type arg ctx: false +[nested]--> trying to move into record field +[nested]--> found record field type +[nested]--> extracting from type (. int) => unit in env Completion +[extract_type]--> starting extraction of type: (. int) => unit, in env: Completion. Has type arg ctx: false +[extract_type]--> starting extraction of type: (. int) => unit, in env: Completion. Has type arg ctx: false +[extract_type]--> starting extraction of type: int => unit, in env: Completion. Has type arg ctx: false +[nested]--> running nested in env: Completion. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [extract_type]--> digging for type unit in Completion [extract_type]--> found nothing when digging diff --git a/analysis/tests/src/expected/CompletionExpressions.res.txt b/analysis/tests/src/expected/CompletionExpressions.res.txt index 351ca51ad..283c272ad 100644 --- a/analysis/tests/src/expected/CompletionExpressions.res.txt +++ b/analysis/tests/src/expected/CompletionExpressions.res.txt @@ -8,7 +8,9 @@ ContextPath Value[s] Path s ContextPath Value[f] Path f -[nested_expr]--> reached end of pattern, returning type +[extract_type]--> starting extraction of type: (bool, option>), in env: CompletionExpressions. Has type arg ctx: false +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> reached end of pattern, returning type [{ "label": "(_, _)", "kind": 12, @@ -34,6 +36,8 @@ Path fnTakingRecord --> found function argument! [extract_type]--> digging for type someRecord in CompletionExpressions [extract_type]--> found record +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false [extract_type]--> digging for type someRecord in CompletionExpressions [extract_type]--> found record --> found type in nested expression completion @@ -90,6 +94,8 @@ Path fnTakingRecord --> found function argument! [extract_type]--> digging for type someRecord in CompletionExpressions [extract_type]--> found record +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false [extract_type]--> digging for type someRecord in CompletionExpressions [extract_type]--> found record --> found type in nested expression completion @@ -116,10 +122,14 @@ Path fnTakingRecord --> found function argument! [extract_type]--> digging for type someRecord in CompletionExpressions [extract_type]--> found record -[nested_expr]--> trying to move into record field -[nested_expr]--> found record field type -[nested_expr]--> extracting from type bool in env CompletionExpressions -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> trying to move into record field +[nested]--> found record field type +[nested]--> extracting from type bool in env CompletionExpressions +[extract_type]--> starting extraction of type: bool, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: bool, in env: CompletionExpressions. Has type arg ctx: false +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "true", @@ -150,6 +160,8 @@ Path fnTakingRecord --> found function argument! [extract_type]--> digging for type someRecord in CompletionExpressions [extract_type]--> found record +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false [extract_type]--> digging for type someRecord in CompletionExpressions [extract_type]--> found record --> found type in nested expression completion @@ -200,6 +212,8 @@ Path fnTakingRecord --> found function argument! [extract_type]--> digging for type someRecord in CompletionExpressions [extract_type]--> found record +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false [extract_type]--> digging for type someRecord in CompletionExpressions [extract_type]--> found record --> found type in nested expression completion @@ -244,10 +258,14 @@ Path fnTakingRecord --> found function argument! [extract_type]--> digging for type someRecord in CompletionExpressions [extract_type]--> found record -[nested_expr]--> trying to move into record field -[nested_expr]--> found record field type -[nested_expr]--> extracting from type option in env CompletionExpressions -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> trying to move into record field +[nested]--> found record field type +[nested]--> extracting from type option in env CompletionExpressions +[extract_type]--> starting extraction of type: option, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: option, in env: CompletionExpressions. Has type arg ctx: false +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [extract_type]--> digging for type otherRecord in CompletionExpressions [extract_type]--> found record @@ -298,9 +316,13 @@ Path fnTakingRecord --> found function argument! [extract_type]--> digging for type someRecord in CompletionExpressions [extract_type]--> found record -[nested_expr]--> trying to move into record field -[nested_expr]--> found record field type -[nested_expr]--> extracting from type option in env CompletionExpressions +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> trying to move into record field +[nested]--> found record field type +[nested]--> extracting from type option in env CompletionExpressions +[extract_type]--> starting extraction of type: option, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: option, in env: CompletionExpressions. Has type arg ctx: false +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false --> could not resolve nested expression path [] @@ -319,12 +341,19 @@ Path fnTakingRecord --> found function argument! [extract_type]--> digging for type someRecord in CompletionExpressions [extract_type]--> found record -[nested_expr]--> trying to move into record field -[nested_expr]--> found record field type -[nested_expr]--> extracting from type option in env CompletionExpressions -[nested_expr]--> moving into option Some +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> trying to move into record field +[nested]--> found record field type +[nested]--> extracting from type option in env CompletionExpressions +[extract_type]--> starting extraction of type: option, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: option, in env: CompletionExpressions. Has type arg ctx: false +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> moving into option Some +[extract_type]--> starting extraction of type: otherRecord, in env: CompletionExpressions. Has type arg ctx: false [extract_type]--> digging for type otherRecord in CompletionExpressions [extract_type]--> found record +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: otherRecord, in env: CompletionExpressions. Has type arg ctx: false [extract_type]--> digging for type otherRecord in CompletionExpressions [extract_type]--> found record --> found type in nested expression completion @@ -357,12 +386,16 @@ Path fnTakingRecord --> found function argument! [extract_type]--> digging for type someRecord in CompletionExpressions [extract_type]--> found record -[nested_expr]--> trying to move into record field -[nested_expr]--> found record field type -[nested_expr]--> extracting from type someVariant in env CompletionExpressions +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> trying to move into record field +[nested]--> found record field type +[nested]--> extracting from type someVariant in env CompletionExpressions +[extract_type]--> starting extraction of type: someVariant, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: someVariant, in env: CompletionExpressions. Has type arg ctx: false [extract_type]--> digging for type someVariant in CompletionExpressions [extract_type]--> found variant -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "One", @@ -405,12 +438,16 @@ Path fnTakingRecord --> found function argument! [extract_type]--> digging for type someRecord in CompletionExpressions [extract_type]--> found record -[nested_expr]--> trying to move into record field -[nested_expr]--> found record field type -[nested_expr]--> extracting from type someVariant in env CompletionExpressions +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> trying to move into record field +[nested]--> found record field type +[nested]--> extracting from type someVariant in env CompletionExpressions +[extract_type]--> starting extraction of type: someVariant, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: someVariant, in env: CompletionExpressions. Has type arg ctx: false [extract_type]--> digging for type someVariant in CompletionExpressions [extract_type]--> found variant -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "One", @@ -437,14 +474,21 @@ Path fnTakingRecord --> found function argument! [extract_type]--> digging for type someRecord in CompletionExpressions [extract_type]--> found record -[nested_expr]--> trying to move into record field -[nested_expr]--> found record field type -[nested_expr]--> extracting from type somePolyVariant in env CompletionExpressions +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> trying to move into record field +[nested]--> found record field type +[nested]--> extracting from type somePolyVariant in env CompletionExpressions +[extract_type]--> starting extraction of type: somePolyVariant, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: somePolyVariant, in env: CompletionExpressions. Has type arg ctx: false [extract_type]--> digging for type somePolyVariant in CompletionExpressions [extract_type]--> found type manifest +[extract_type]--> starting extraction of type: [#one | #three(someRecord, bool) | #two(bool)], in env: CompletionExpressions. Has type arg ctx: false +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false [extract_type]--> digging for type someRecord in CompletionExpressions [extract_type]--> found record -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "{}", @@ -472,12 +516,19 @@ Path fnTakingRecord --> found function argument! [extract_type]--> digging for type someRecord in CompletionExpressions [extract_type]--> found record -[nested_expr]--> trying to move into record field -[nested_expr]--> found record field type -[nested_expr]--> extracting from type somePolyVariant in env CompletionExpressions +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> trying to move into record field +[nested]--> found record field type +[nested]--> extracting from type somePolyVariant in env CompletionExpressions +[extract_type]--> starting extraction of type: somePolyVariant, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: somePolyVariant, in env: CompletionExpressions. Has type arg ctx: false [extract_type]--> digging for type somePolyVariant in CompletionExpressions [extract_type]--> found type manifest -[nested_expr]--> reached end of pattern, returning type +[extract_type]--> starting extraction of type: [#one | #three(someRecord, bool) | #two(bool)], in env: CompletionExpressions. Has type arg ctx: false +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: bool, in env: CompletionExpressions. Has type arg ctx: false +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "true", @@ -508,12 +559,19 @@ Path fnTakingRecord --> found function argument! [extract_type]--> digging for type someRecord in CompletionExpressions [extract_type]--> found record -[nested_expr]--> trying to move into record field -[nested_expr]--> found record field type -[nested_expr]--> extracting from type somePolyVariant in env CompletionExpressions +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> trying to move into record field +[nested]--> found record field type +[nested]--> extracting from type somePolyVariant in env CompletionExpressions +[extract_type]--> starting extraction of type: somePolyVariant, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: somePolyVariant, in env: CompletionExpressions. Has type arg ctx: false [extract_type]--> digging for type somePolyVariant in CompletionExpressions [extract_type]--> found type manifest -[nested_expr]--> reached end of pattern, returning type +[extract_type]--> starting extraction of type: [#one | #three(someRecord, bool) | #two(bool)], in env: CompletionExpressions. Has type arg ctx: false +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: bool, in env: CompletionExpressions. Has type arg ctx: false +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "true", @@ -536,7 +594,8 @@ ContextPath Value[fnTakingArray] Path fnTakingArray --> found function type --> found function argument! -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "[]", @@ -562,7 +621,10 @@ ContextPath Value[fnTakingArray] Path fnTakingArray --> found function type --> found function argument! -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: option, in env: CompletionExpressions. Has type arg ctx: false +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "None", @@ -605,7 +667,8 @@ ContextPath Value[fnTakingArray] Path fnTakingArray --> found function type --> found function argument! -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "s", @@ -628,8 +691,13 @@ ContextPath Value[fnTakingArray] Path fnTakingArray --> found function type --> found function argument! -[nested_expr]--> moving into option Some -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: option, in env: CompletionExpressions. Has type arg ctx: false +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> moving into option Some +[extract_type]--> starting extraction of type: bool, in env: CompletionExpressions. Has type arg ctx: false +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "true", @@ -658,7 +726,10 @@ ContextPath Value[fnTakingArray] Path fnTakingArray --> found function type --> found function argument! -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: option, in env: CompletionExpressions. Has type arg ctx: false +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "None", @@ -701,7 +772,10 @@ ContextPath Value[fnTakingArray] Path fnTakingArray --> found function type --> found function argument! -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: option, in env: CompletionExpressions. Has type arg ctx: false +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "None", @@ -746,7 +820,8 @@ Path fnTakingRecord --> found function argument! [extract_type]--> digging for type someRecord in CompletionExpressions [extract_type]--> found record -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "someBoolVar", @@ -771,10 +846,14 @@ Path fnTakingOtherRecord --> found function argument! [extract_type]--> digging for type otherRecord in CompletionExpressions [extract_type]--> found record -[nested_expr]--> trying to move into record field -[nested_expr]--> found record field type -[nested_expr]--> extracting from type string in env CompletionExpressions -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> trying to move into record field +[nested]--> found record field type +[nested]--> extracting from type string in env CompletionExpressions +[extract_type]--> starting extraction of type: string, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: string, in env: CompletionExpressions. Has type arg ctx: false +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "\"\"", @@ -802,10 +881,13 @@ Path fnTakingRecordWithOptionalField --> found function argument! [extract_type]--> digging for type recordWithOptionalField in CompletionExpressions [extract_type]--> found record -[nested_expr]--> trying to move into record field -[nested_expr]--> found record field type -[nested_expr]--> extracting from type bool in env CompletionExpressions -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> trying to move into record field +[nested]--> found record field type +[nested]--> extracting from type bool in env CompletionExpressions +[extract_type]--> starting extraction of type: bool, in env: CompletionExpressions. Has type arg ctx: false +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "true", @@ -836,10 +918,14 @@ Path fnTakingRecordWithOptVariant --> found function argument! [extract_type]--> digging for type recordWithOptVariant in CompletionExpressions [extract_type]--> found record -[nested_expr]--> trying to move into record field -[nested_expr]--> found record field type -[nested_expr]--> extracting from type option in env CompletionExpressions -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> trying to move into record field +[nested]--> found record field type +[nested]--> extracting from type option in env CompletionExpressions +[extract_type]--> starting extraction of type: option, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: option, in env: CompletionExpressions. Has type arg ctx: false +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [extract_type]--> digging for type someVariant in CompletionExpressions [extract_type]--> found variant @@ -906,9 +992,11 @@ Path fnTakingInlineRecord --> found function argument! [extract_type]--> digging for type variantWithInlineRecord in CompletionExpressions [extract_type]--> found variant -[nested_expr]--> trying to move into variant payload $0 of constructor 'WithInlineRecord' -[nested_expr]--> found constructor (inline record) -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> trying to move into variant payload $0 of constructor 'WithInlineRecord' +[nested]--> found constructor (inline record) +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "{}", @@ -936,8 +1024,10 @@ Path fnTakingInlineRecord --> found function argument! [extract_type]--> digging for type variantWithInlineRecord in CompletionExpressions [extract_type]--> found variant -[nested_expr]--> trying to move into variant payload $0 of constructor 'WithInlineRecord' -[nested_expr]--> found constructor (inline record) +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> trying to move into variant payload $0 of constructor 'WithInlineRecord' +[nested]--> found constructor (inline record) +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false --> found type in nested expression completion [{ "label": "someBoolField", @@ -974,8 +1064,10 @@ Path fnTakingInlineRecord --> found function argument! [extract_type]--> digging for type variantWithInlineRecord in CompletionExpressions [extract_type]--> found variant -[nested_expr]--> trying to move into variant payload $0 of constructor 'WithInlineRecord' -[nested_expr]--> found constructor (inline record) +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> trying to move into variant payload $0 of constructor 'WithInlineRecord' +[nested]--> found constructor (inline record) +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false --> found type in nested expression completion [{ "label": "someBoolField", @@ -1000,14 +1092,19 @@ Path fnTakingInlineRecord --> found function argument! [extract_type]--> digging for type variantWithInlineRecord in CompletionExpressions [extract_type]--> found variant -[nested_expr]--> trying to move into variant payload $0 of constructor 'WithInlineRecord' -[nested_expr]--> found constructor (inline record) -[nested_expr]--> trying to move into record field -[nested_expr]--> found record field type -[nested_expr]--> extracting from type otherRecord in env CompletionExpressions +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> trying to move into variant payload $0 of constructor 'WithInlineRecord' +[nested]--> found constructor (inline record) +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> trying to move into record field +[nested]--> found record field type +[nested]--> extracting from type otherRecord in env CompletionExpressions +[extract_type]--> starting extraction of type: otherRecord, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: otherRecord, in env: CompletionExpressions. Has type arg ctx: false [extract_type]--> digging for type otherRecord in CompletionExpressions [extract_type]--> found record -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "{}", @@ -1035,13 +1132,19 @@ Path fnTakingInlineRecord --> found function argument! [extract_type]--> digging for type variantWithInlineRecord in CompletionExpressions [extract_type]--> found variant -[nested_expr]--> trying to move into variant payload $0 of constructor 'WithInlineRecord' -[nested_expr]--> found constructor (inline record) -[nested_expr]--> trying to move into record field -[nested_expr]--> found record field type -[nested_expr]--> extracting from type otherRecord in env CompletionExpressions +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> trying to move into variant payload $0 of constructor 'WithInlineRecord' +[nested]--> found constructor (inline record) +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> trying to move into record field +[nested]--> found record field type +[nested]--> extracting from type otherRecord in env CompletionExpressions +[extract_type]--> starting extraction of type: otherRecord, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: otherRecord, in env: CompletionExpressions. Has type arg ctx: false [extract_type]--> digging for type otherRecord in CompletionExpressions [extract_type]--> found record +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: otherRecord, in env: CompletionExpressions. Has type arg ctx: false [extract_type]--> digging for type otherRecord in CompletionExpressions [extract_type]--> found record --> found type in nested expression completion @@ -1072,7 +1175,8 @@ ContextPath Value[fnTakingCallback] Path fnTakingCallback --> found function type --> found function argument! -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [extract_type]--> digging for type unit in CompletionExpressions [extract_type]--> found nothing when digging @@ -1100,7 +1204,8 @@ ContextPath Value[fnTakingCallback] Path fnTakingCallback --> found function type --> found function argument! -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [] @@ -1117,7 +1222,8 @@ ContextPath Value[fnTakingCallback] Path fnTakingCallback --> found function type --> found function argument! -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [extract_type]--> digging for type unit in CompletionExpressions [extract_type]--> found nothing when digging @@ -1145,7 +1251,8 @@ ContextPath Value[fnTakingCallback] Path fnTakingCallback --> found function type --> found function argument! -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [extract_type]--> digging for type unit in CompletionExpressions [extract_type]--> found nothing when digging @@ -1173,7 +1280,8 @@ ContextPath Value[fnTakingCallback] Path fnTakingCallback --> found function type --> found function argument! -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [extract_type]--> digging for type int in CompletionExpressions [extract_type]--> found nothing when digging @@ -1201,7 +1309,8 @@ ContextPath Value[fnTakingCallback] Path fnTakingCallback --> found function type --> found function argument! -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [extract_type]--> digging for type unit in CompletionExpressions [extract_type]--> found nothing when digging @@ -1229,7 +1338,8 @@ ContextPath Value[fnTakingCallback] Path fnTakingCallback --> found function type --> found function argument! -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [extract_type]--> digging for type int in CompletionExpressions [extract_type]--> found nothing when digging @@ -1261,7 +1371,7 @@ ContextPath Value[Js, log] Path Js.log --> found function type --> found function argument! -[extract_type]--> miss +[extract_type]--> found type variable: 'a --> could not get completions for context path [{ "label": "second2", @@ -1319,7 +1429,8 @@ ContextPath Value[takesCb] Path takesCb --> found function type --> found function argument! -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [extract_type]--> miss [{ @@ -1346,7 +1457,8 @@ ContextPath Value[takesCb2] Path takesCb2 --> found function type --> found function argument! -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [extract_type]--> miss [{ @@ -1373,7 +1485,8 @@ ContextPath Value[takesCb3] Path takesCb3 --> found function type --> found function argument! -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [extract_type]--> miss [{ @@ -1400,7 +1513,8 @@ ContextPath Value[takesCb4] Path takesCb4 --> found function type --> found function argument! -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [extract_type]--> miss [{ @@ -1427,7 +1541,8 @@ ContextPath Value[takesCb5] Path takesCb5 --> found function type --> found function argument! -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [extract_type]--> miss [{ @@ -1454,7 +1569,8 @@ ContextPath Value[commitLocalUpdate] Path commitLocalUpdate --> found function type --> found function argument! -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [extract_type]--> digging for type unit in CompletionExpressions [extract_type]--> found nothing when digging @@ -1482,7 +1598,8 @@ ContextPath Value[fnTakingAsyncCallback] Path fnTakingAsyncCallback --> found function type --> found function argument! -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "async () => {}", @@ -1507,9 +1624,10 @@ ContextPath Value[Belt, Array, map] Path Belt.Array.map --> found function type --> found function argument! -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: Belt_Array. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion -[extract_type]--> miss +[extract_type]--> found type variable: 'b [{ "label": "v => {}", "kind": 12, @@ -1536,7 +1654,8 @@ Path takesExotic --> found function argument! [extract_type]--> digging for type exoticPolyvariant in CompletionExpressions [extract_type]--> found type manifest -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "#\"some exotic\"", @@ -1563,7 +1682,8 @@ Path fnTakingPolyVariant --> found function argument! [extract_type]--> digging for type somePolyVariant in CompletionExpressions [extract_type]--> found type manifest -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "#one", @@ -1606,7 +1726,8 @@ Path fnTakingPolyVariant --> found function argument! [extract_type]--> digging for type somePolyVariant in CompletionExpressions [extract_type]--> found type manifest -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "#one", @@ -1649,7 +1770,8 @@ Path fnTakingPolyVariant --> found function argument! [extract_type]--> digging for type somePolyVariant in CompletionExpressions [extract_type]--> found type manifest -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "#one", @@ -1676,7 +1798,8 @@ Path fnTakingPolyVariant --> found function argument! [extract_type]--> digging for type somePolyVariant in CompletionExpressions [extract_type]--> found type manifest -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "#one", diff --git a/analysis/tests/src/expected/CompletionFunctionArguments.res.txt b/analysis/tests/src/expected/CompletionFunctionArguments.res.txt index cd9d25605..a46cc1ac8 100644 --- a/analysis/tests/src/expected/CompletionFunctionArguments.res.txt +++ b/analysis/tests/src/expected/CompletionFunctionArguments.res.txt @@ -11,7 +11,8 @@ ContextPath Value[someFn] Path someFn --> found function type --> found function argument! -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionFunctionArguments. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "true", @@ -40,7 +41,8 @@ ContextPath Value[someFn] Path someFn --> found function type --> found function argument! -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionFunctionArguments. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "true", @@ -70,7 +72,8 @@ ContextPath Value[someFn] Path someFn --> found function type --> found function argument! -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionFunctionArguments. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "true", @@ -103,7 +106,8 @@ ContextPath Value[someFn] Path someFn --> found function type --> found function argument! -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionFunctionArguments. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "true", @@ -132,7 +136,8 @@ ContextPath Value[someOtherFn] Path someOtherFn --> found function type --> found function argument! -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionFunctionArguments. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "false", @@ -157,7 +162,8 @@ Path someFnTakingVariant --> found function argument! [extract_type]--> digging for type someVariant in CompletionFunctionArguments [extract_type]--> found variant -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionFunctionArguments. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "One", @@ -200,7 +206,8 @@ Path someFnTakingVariant --> found function argument! [extract_type]--> digging for type someVariant in CompletionFunctionArguments [extract_type]--> found variant -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionFunctionArguments. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "One", @@ -244,7 +251,8 @@ ContextPath Value[someFnTakingVariant] Path someFnTakingVariant --> found function type --> found function argument! -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionFunctionArguments. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [extract_type]--> digging for type someVariant in CompletionFunctionArguments [extract_type]--> found variant @@ -280,7 +288,8 @@ Path someFnTakingVariant --> found function argument! [extract_type]--> digging for type someVariant in CompletionFunctionArguments [extract_type]--> found variant -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionFunctionArguments. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "One", @@ -324,7 +333,8 @@ ContextPath Value[someOtherFn] Path someOtherFn --> found function type --> found function argument! -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionFunctionArguments. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "true", @@ -353,7 +363,8 @@ ContextPath Value[someOtherFn] Path someOtherFn --> found function type --> found function argument! -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionFunctionArguments. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "true", @@ -381,7 +392,8 @@ ContextPath Value[someOtherFn] Path someOtherFn --> found function type --> found function argument! -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionFunctionArguments. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "true", @@ -411,7 +423,8 @@ ContextPath Value[fnTakingTuple] Path fnTakingTuple --> found function type --> found function argument! -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionFunctionArguments. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "(_, _, _)", @@ -438,6 +451,8 @@ Path fnTakingRecord --> found function argument! [extract_type]--> digging for type someRecord in CompletionFunctionArguments [extract_type]--> found record +[nested]--> running nested in env: CompletionFunctionArguments. Has type arg ctx: false +[extract_type]--> starting extraction of type: someRecord, in env: CompletionFunctionArguments. Has type arg ctx: false [extract_type]--> digging for type someRecord in CompletionFunctionArguments [extract_type]--> found record --> found type in nested expression completion diff --git a/analysis/tests/src/expected/CompletionInferValues.res.txt b/analysis/tests/src/expected/CompletionInferValues.res.txt index 83c026fcc..2a94767a9 100644 --- a/analysis/tests/src/expected/CompletionInferValues.res.txt +++ b/analysis/tests/src/expected/CompletionInferValues.res.txt @@ -393,6 +393,7 @@ ContextPath Value[x] Path x ContextPath Type[someRecordWithNestedStuff] Path someRecordWithNestedStuff +[nested_pattern_path] [{ "label": "name", "kind": 5, @@ -421,6 +422,7 @@ ContextPath Value[x] Path x ContextPath Type[someRecordWithNestedStuff] Path someRecordWithNestedStuff +[nested_pattern_path] [{ "label": "someRecord", "kind": 5, @@ -443,8 +445,10 @@ ContextPath Value[x] Path x ContextPath Type[someRecordWithNestedStuff] Path someRecordWithNestedStuff +[nested_pattern_path] [extract_type]--> digging for type someNestedRecord in CompletionInferValues [extract_type]--> found record +[nested_pattern_path] [{ "label": "name", "kind": 5, @@ -472,6 +476,7 @@ ContextPath Value[x] Path x ContextPath Type[someRecordWithNestedStuff] Path someRecordWithNestedStuff +[nested_pattern_path] CPPipe env:CompletionInferValues Path Js.String2.slic [{ @@ -501,6 +506,7 @@ ContextPath Value[x] Path x ContextPath Type[someRecordWithNestedStuff] Path someRecordWithNestedStuff +[nested_pattern_path] CPPipe env:CompletionInferValues Path Belt.Int.toS [{ @@ -527,6 +533,8 @@ ContextPath Value[x] Path x ContextPath Type[otherNestedRecord] Path otherNestedRecord +[nested_pattern_path] +[nested_pattern_path] CPPipe env:CompletionInferValues Path Belt.Int.toS [{ @@ -554,6 +562,8 @@ ContextPath Value[x] Path x ContextPath Type[otherNestedRecord] Path otherNestedRecord +[nested_pattern_path] +[nested_pattern_path] CPPipe env:CompletionInferValues Path Belt.Int.toS [{ @@ -577,8 +587,11 @@ ContextPath Value[x] Path x ContextPath Type[otherNestedRecord] Path otherNestedRecord +[nested_pattern_path] +[nested_pattern_path] [extract_type]--> digging for type someVariant in CompletionInferValues [extract_type]--> found variant +[nested_pattern_path] CPPipe env:CompletionInferValues Path Js.String2.slic [{ @@ -608,8 +621,11 @@ ContextPath Value[x] Path x ContextPath Type[otherNestedRecord] Path otherNestedRecord +[nested_pattern_path] +[nested_pattern_path] [extract_type]--> digging for type somePolyVariant in CompletionInferValues [extract_type]--> found type manifest +[nested_pattern_path] CPPipe env:CompletionInferValues Path Js.String2.slic [{ @@ -639,6 +655,9 @@ ContextPath Value[x] Path x ContextPath Type[otherNestedRecord] Path otherNestedRecord +[nested_pattern_path] +[nested_pattern_path] +[nested_pattern_path] [extract_type]--> digging for type someRecord in CompletionInferValues [extract_type]--> found record CPPipe env:CompletionInferValues @@ -672,6 +691,7 @@ Path x ContextPath array ContextPath Type[otherNestedRecord] Path otherNestedRecord +[nested_pattern_path] [{ "label": "someRecord", "kind": 5, @@ -726,8 +746,11 @@ Path fnWithRecordCallback --> found function argument! --> found function type --> found function argument! +[extract_type]--> starting extraction of type: someRecord, in env: CompletionInferValues. Has type arg ctx: false [extract_type]--> digging for type someRecord in CompletionInferValues [extract_type]--> found record +[nested]--> running nested in env: CompletionInferValues. Has type arg ctx: false +[extract_type]--> starting extraction of type: someRecord, in env: CompletionInferValues. Has type arg ctx: false [extract_type]--> digging for type someRecord in CompletionInferValues [extract_type]--> found record [{ @@ -767,6 +790,7 @@ Path fn2 --> found function argument! --> found function type --> found function argument! +[nested_pattern_path] [extract_type]--> digging for type CompletionSupport.Nested.config in CompletionInferValues [extract_type]--> found record CPPipe env:CompletionInferValues @@ -810,6 +834,7 @@ Path fn3 --> found function argument! --> found function type --> found function argument! +[nested_pattern_path] [extract_type]--> digging for type sameFileRecord in CompletionInferValues [extract_type]--> found record CPPipe env:CompletionInferValues @@ -844,7 +869,9 @@ Resolved opens 1 pervasives ContextPath Value[Belt, Int, toString](Nolabel) ContextPath Value[Belt, Int, toString] Path Belt.Int.toString -[nested_expr]--> reached end of pattern, returning type +[extract_type]--> starting extraction of type: string, in env: Belt_Int. Has type arg ctx: false +[nested]--> running nested in env: Belt_Int. Has type arg ctx: false +[nested]--> reached end of pattern, returning type [{ "label": "\"\"", "kind": 12, @@ -864,7 +891,9 @@ Resolved opens 1 pervasives ContextPath Value[Js, String2, split](Nolabel, Nolabel) ContextPath Value[Js, String2, split] Path Js.String2.split -[nested_expr]--> reached end of pattern, returning type +[extract_type]--> starting extraction of type: array, in env: Js_string2. Has type arg ctx: false +[nested]--> running nested in env: Js_string2. Has type arg ctx: false +[nested]--> reached end of pattern, returning type [{ "label": "[]", "kind": 12, @@ -899,6 +928,7 @@ Path CompletionSupport2.makeRenderer --> found function argument! --> found function type --> found function argument! +[nested_pattern_path] [extract_type]--> digging for type Internal.prepareProps in CompletionSupport2 [extract_type]--> found record [{ @@ -932,11 +962,13 @@ Path CompletionSupport2.makeRenderer --> found function argument! --> found function type --> found function argument! +[nested_pattern_path] [extract_type]--> digging for type Internal.prepareProps in CompletionSupport2 [extract_type]--> found record -[extract_type]--> digging for type CompletionSupport.Nested.config in CompletionSupport2 +[extract_type]--> digging for type CompletionSupport.Nested.config in CompletionSupport2.Internal [extract_type]--> found record -CPPipe env:CompletionInferValues envFromCompletionItem:CompletionSupport2 +[nested_pattern_path] +CPPipe env:CompletionInferValues envFromCompletionItem:CompletionSupport2.Internal CPPipe type path:ReactDOM.Client.Root.t CPPipe pathFromEnv:ReactDOM.Client.Root found:false Path ReactDOM.Client.Root. diff --git a/analysis/tests/src/expected/CompletionJsx.res.txt b/analysis/tests/src/expected/CompletionJsx.res.txt index ab9ed96c5..54348f778 100644 --- a/analysis/tests/src/expected/CompletionJsx.res.txt +++ b/analysis/tests/src/expected/CompletionJsx.res.txt @@ -482,7 +482,8 @@ Resolved opens 1 pervasives --> expression completion ContextPath CJsxPropValue [SomeComponent] someProp Path SomeComponent.make -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionJsx.SomeComponent. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "\"\"", diff --git a/analysis/tests/src/expected/CompletionJsxProps.res.txt b/analysis/tests/src/expected/CompletionJsxProps.res.txt index 621cc47b6..852276939 100644 --- a/analysis/tests/src/expected/CompletionJsxProps.res.txt +++ b/analysis/tests/src/expected/CompletionJsxProps.res.txt @@ -7,7 +7,8 @@ Resolved opens 1 pervasives --> expression completion ContextPath CJsxPropValue [CompletionSupport, TestComponent] on Path CompletionSupport.TestComponent.make -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionSupport.TestComponent. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "true", @@ -32,7 +33,8 @@ Resolved opens 1 pervasives --> expression completion ContextPath CJsxPropValue [CompletionSupport, TestComponent] on Path CompletionSupport.TestComponent.make -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionSupport.TestComponent. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "true", @@ -51,9 +53,10 @@ Resolved opens 1 pervasives --> expression completion ContextPath CJsxPropValue [CompletionSupport, TestComponent] test Path CompletionSupport.TestComponent.make -[extract_type]--> digging for type testVariant in CompletionSupport +[extract_type]--> digging for type testVariant in CompletionSupport.TestComponent [extract_type]--> found variant -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionSupport.TestComponent. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "Two", @@ -102,7 +105,8 @@ Resolved opens 1 pervasives --> expression completion ContextPath CJsxPropValue [CompletionSupport, TestComponent] polyArg Path CompletionSupport.TestComponent.make -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionSupport.TestComponent. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "#one", @@ -147,7 +151,8 @@ Resolved opens 1 pervasives --> expression completion ContextPath CJsxPropValue [CompletionSupport, TestComponent] polyArg Path CompletionSupport.TestComponent.make -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionSupport.TestComponent. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "#three(_, _)", @@ -185,7 +190,8 @@ Resolved opens 1 pervasives ContextPath CJsxPropValue [div] muted Path ReactDOM.domProps Path Pervasives.JsxDOM.domProps -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionJsxProps. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "true", @@ -211,7 +217,8 @@ Resolved opens 1 pervasives ContextPath CJsxPropValue [div] onMouseEnter Path ReactDOM.domProps Path Pervasives.JsxDOM.domProps -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionJsxProps. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [extract_type]--> digging for type unit in CompletionJsxProps [extract_type]--> found nothing when digging @@ -235,7 +242,8 @@ Resolved opens 1 pervasives --> expression completion ContextPath CJsxPropValue [CompletionSupport, TestComponent] testArr Path CompletionSupport.TestComponent.make -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionSupport.TestComponent. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "[]", @@ -257,9 +265,12 @@ Resolved opens 1 pervasives --> expression completion ContextPath CJsxPropValue [CompletionSupport, TestComponent] testArr Path CompletionSupport.TestComponent.make -[extract_type]--> digging for type testVariant in CompletionSupport +[nested]--> running nested in env: CompletionSupport.TestComponent. Has type arg ctx: false +[extract_type]--> starting extraction of type: testVariant, in env: CompletionSupport.TestComponent. Has type arg ctx: false +[extract_type]--> digging for type testVariant in CompletionSupport.TestComponent [extract_type]--> found variant -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionSupport.TestComponent. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "One", diff --git a/analysis/tests/src/expected/CompletionPattern.res.txt b/analysis/tests/src/expected/CompletionPattern.res.txt index a90b66937..243c1a68c 100644 --- a/analysis/tests/src/expected/CompletionPattern.res.txt +++ b/analysis/tests/src/expected/CompletionPattern.res.txt @@ -9,7 +9,10 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[v] Path v -[nested_expr]--> reached end of pattern, returning type +[extract_type]--> starting extraction of type: (bool, option, (bool, bool)), in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: (bool, option, (bool, bool)), in env: CompletionPattern. Has type arg ctx: false +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> reached end of pattern, returning type [{ "label": "(_, _, _)", "kind": 12, @@ -28,8 +31,14 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[v] Path v -[nested_expr]--> trying to move into tuple -[nested_expr]--> reached end of pattern, returning type +[extract_type]--> starting extraction of type: (bool, option, (bool, bool)), in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: (bool, option, (bool, bool)), in env: CompletionPattern. Has type arg ctx: false +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> trying to move into tuple +[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -47,9 +56,18 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[v] Path v -[nested_expr]--> trying to move into tuple -[nested_expr]--> trying to move into tuple -[nested_expr]--> reached end of pattern, returning type +[extract_type]--> starting extraction of type: (bool, option, (bool, bool)), in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: (bool, option, (bool, bool)), in env: CompletionPattern. Has type arg ctx: false +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> trying to move into tuple +[extract_type]--> starting extraction of type: (bool, bool), in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: (bool, bool), in env: CompletionPattern. Has type arg ctx: false +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> trying to move into tuple +[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> reached end of pattern, returning type [{ "label": "false", "kind": 4, @@ -65,7 +83,10 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[x] Path x -[nested_expr]--> reached end of pattern, returning type +[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -87,7 +108,10 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[x] Path x -[nested_expr]--> reached end of pattern, returning type +[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -103,9 +127,11 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[f] Path f +[extract_type]--> starting extraction of type: someRecord, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> digging for type someRecord in CompletionPattern [extract_type]--> found record -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> reached end of pattern, returning type [{ "label": "{}", "kind": 22, @@ -124,8 +150,11 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[f] Path f +[extract_type]--> starting extraction of type: someRecord, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> digging for type someRecord in CompletionPattern [extract_type]--> found record +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: someRecord, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> digging for type someRecord in CompletionPattern [extract_type]--> found record [{ @@ -161,8 +190,11 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[f] Path f +[extract_type]--> starting extraction of type: someRecord, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> digging for type someRecord in CompletionPattern [extract_type]--> found record +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: someRecord, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> digging for type someRecord in CompletionPattern [extract_type]--> found record [{ @@ -187,8 +219,11 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[f] Path f +[extract_type]--> starting extraction of type: someRecord, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> digging for type someRecord in CompletionPattern [extract_type]--> found record +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: someRecord, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> digging for type someRecord in CompletionPattern [extract_type]--> found record [{ @@ -208,9 +243,16 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[z] Path z -[nested_expr]--> trying to move into tuple +[extract_type]--> starting extraction of type: (someRecord, bool), in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: (someRecord, bool), in env: CompletionPattern. Has type arg ctx: false +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> trying to move into tuple +[extract_type]--> starting extraction of type: someRecord, in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: someRecord, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> digging for type someRecord in CompletionPattern [extract_type]--> found record +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: someRecord, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> digging for type someRecord in CompletionPattern [extract_type]--> found record [{ @@ -228,14 +270,19 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[f] Path f +[extract_type]--> starting extraction of type: someRecord, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> digging for type someRecord in CompletionPattern [extract_type]--> found record -[nested_expr]--> trying to move into record field -[nested_expr]--> found record field type -[nested_expr]--> extracting from type nestedRecord in env CompletionPattern +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> trying to move into record field +[nested]--> found record field type +[nested]--> extracting from type nestedRecord in env CompletionPattern +[extract_type]--> starting extraction of type: nestedRecord, in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: nestedRecord, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> digging for type nestedRecord in CompletionPattern [extract_type]--> found record -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> reached end of pattern, returning type [{ "label": "{}", "kind": 22, @@ -255,13 +302,19 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[f] Path f +[extract_type]--> starting extraction of type: someRecord, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> digging for type someRecord in CompletionPattern [extract_type]--> found record -[nested_expr]--> trying to move into record field -[nested_expr]--> found record field type -[nested_expr]--> extracting from type nestedRecord in env CompletionPattern +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> trying to move into record field +[nested]--> found record field type +[nested]--> extracting from type nestedRecord in env CompletionPattern +[extract_type]--> starting extraction of type: nestedRecord, in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: nestedRecord, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> digging for type nestedRecord in CompletionPattern [extract_type]--> found record +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: nestedRecord, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> digging for type nestedRecord in CompletionPattern [extract_type]--> found record [{ @@ -281,8 +334,11 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[nest] Path nest +[extract_type]--> starting extraction of type: nestedRecord, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> digging for type nestedRecord in CompletionPattern [extract_type]--> found record +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: nestedRecord, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> digging for type nestedRecord in CompletionPattern [extract_type]--> found record [{ @@ -300,8 +356,11 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[f] Path f +[extract_type]--> starting extraction of type: someRecord, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> digging for type someRecord in CompletionPattern [extract_type]--> found record +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: someRecord, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> digging for type someRecord in CompletionPattern [extract_type]--> found record [{ @@ -339,13 +398,19 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[f] Path f +[extract_type]--> starting extraction of type: someRecord, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> digging for type someRecord in CompletionPattern [extract_type]--> found record -[nested_expr]--> trying to move into record field -[nested_expr]--> found record field type -[nested_expr]--> extracting from type nestedRecord in env CompletionPattern +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> trying to move into record field +[nested]--> found record field type +[nested]--> extracting from type nestedRecord in env CompletionPattern +[extract_type]--> starting extraction of type: nestedRecord, in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: nestedRecord, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> digging for type nestedRecord in CompletionPattern [extract_type]--> found record +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: nestedRecord, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> digging for type nestedRecord in CompletionPattern [extract_type]--> found record [{ @@ -366,13 +431,18 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[z] Path z +[extract_type]--> starting extraction of type: someVariant, in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: someVariant, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> digging for type someVariant in CompletionPattern [extract_type]--> found variant -[nested_expr]--> trying to move into variant payload $0 of constructor 'Two' -[nested_expr]--> found constructor (Args type) -[nested_expr]--> found arg of type: bool -[nested_expr]--> extracted type, continuing descent -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> trying to move into variant payload $0 of constructor 'Two' +[nested]--> found constructor (Args type) +[nested]--> found arg of type: bool +[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false +[nested]--> extracted type, continuing descent +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -396,13 +466,18 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[z] Path z +[extract_type]--> starting extraction of type: someVariant, in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: someVariant, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> digging for type someVariant in CompletionPattern [extract_type]--> found variant -[nested_expr]--> trying to move into variant payload $0 of constructor 'Two' -[nested_expr]--> found constructor (Args type) -[nested_expr]--> found arg of type: bool -[nested_expr]--> extracted type, continuing descent -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> trying to move into variant payload $0 of constructor 'Two' +[nested]--> found constructor (Args type) +[nested]--> found arg of type: bool +[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false +[nested]--> extracted type, continuing descent +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -420,14 +495,20 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[z] Path z +[extract_type]--> starting extraction of type: someVariant, in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: someVariant, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> digging for type someVariant in CompletionPattern [extract_type]--> found variant -[nested_expr]--> trying to move into variant payload $0 of constructor 'Three' -[nested_expr]--> found constructor (Args type) -[nested_expr]--> found arg of type: someRecord +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> trying to move into variant payload $0 of constructor 'Three' +[nested]--> found constructor (Args type) +[nested]--> found arg of type: someRecord +[extract_type]--> starting extraction of type: someRecord, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> digging for type someRecord in CompletionPattern [extract_type]--> found record -[nested_expr]--> extracted type, continuing descent +[nested]--> extracted type, continuing descent +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: someRecord, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> digging for type someRecord in CompletionPattern [extract_type]--> found record [{ @@ -466,13 +547,18 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[z] Path z +[extract_type]--> starting extraction of type: someVariant, in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: someVariant, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> digging for type someVariant in CompletionPattern [extract_type]--> found variant -[nested_expr]--> trying to move into variant payload $1 of constructor 'Three' -[nested_expr]--> found constructor (Args type) -[nested_expr]--> found arg of type: bool -[nested_expr]--> extracted type, continuing descent -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> trying to move into variant payload $1 of constructor 'Three' +[nested]--> found constructor (Args type) +[nested]--> found arg of type: bool +[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false +[nested]--> extracted type, continuing descent +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -490,9 +576,14 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[b] Path b +[extract_type]--> starting extraction of type: somePolyVariant, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> digging for type somePolyVariant in CompletionPattern [extract_type]--> found type manifest -[nested_expr]--> reached end of pattern, returning type +[extract_type]--> starting extraction of type: [#one | #three(someRecord, bool) | #two(bool)], in env: CompletionPattern. Has type arg ctx: false +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -515,9 +606,14 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[b] Path b +[extract_type]--> starting extraction of type: somePolyVariant, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> digging for type somePolyVariant in CompletionPattern [extract_type]--> found type manifest -[nested_expr]--> reached end of pattern, returning type +[extract_type]--> starting extraction of type: [#one | #three(someRecord, bool) | #two(bool)], in env: CompletionPattern. Has type arg ctx: false +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -534,10 +630,16 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[b] Path b +[extract_type]--> starting extraction of type: somePolyVariant, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> digging for type somePolyVariant in CompletionPattern [extract_type]--> found type manifest +[extract_type]--> starting extraction of type: [#one | #three(someRecord, bool) | #two(bool)], in env: CompletionPattern. Has type arg ctx: false +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: someRecord, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> digging for type someRecord in CompletionPattern [extract_type]--> found record +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: someRecord, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> digging for type someRecord in CompletionPattern [extract_type]--> found record [{ @@ -575,9 +677,14 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[b] Path b +[extract_type]--> starting extraction of type: somePolyVariant, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> digging for type somePolyVariant in CompletionPattern [extract_type]--> found type manifest -[nested_expr]--> reached end of pattern, returning type +[extract_type]--> starting extraction of type: [#one | #three(someRecord, bool) | #two(bool)], in env: CompletionPattern. Has type arg ctx: false +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -593,7 +700,9 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[c] Path c -[nested_expr]--> reached end of pattern, returning type +[extract_type]--> starting extraction of type: array, in env: CompletionPattern. Has type arg ctx: false +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> reached end of pattern, returning type [{ "label": "[]", "kind": 12, @@ -612,7 +721,11 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[c] Path c -[nested_expr]--> reached end of pattern, returning type +[extract_type]--> starting extraction of type: array, in env: CompletionPattern. Has type arg ctx: false +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -637,8 +750,14 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[o] Path o -[nested_expr]--> moving into option Some -[nested_expr]--> reached end of pattern, returning type +[extract_type]--> starting extraction of type: option, in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: option, in env: CompletionPattern. Has type arg ctx: false +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> moving into option Some +[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -661,13 +780,18 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[p] Path p +[extract_type]--> starting extraction of type: multiPayloadVariant, in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: multiPayloadVariant, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> digging for type multiPayloadVariant in CompletionPattern [extract_type]--> found variant -[nested_expr]--> trying to move into variant payload $1 of constructor 'Test' -[nested_expr]--> found constructor (Args type) -[nested_expr]--> found arg of type: bool -[nested_expr]--> extracted type, continuing descent -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> trying to move into variant payload $1 of constructor 'Test' +[nested]--> found constructor (Args type) +[nested]--> found arg of type: bool +[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false +[nested]--> extracted type, continuing descent +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -691,13 +815,18 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[p] Path p +[extract_type]--> starting extraction of type: multiPayloadVariant, in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: multiPayloadVariant, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> digging for type multiPayloadVariant in CompletionPattern [extract_type]--> found variant -[nested_expr]--> trying to move into variant payload $2 of constructor 'Test' -[nested_expr]--> found constructor (Args type) -[nested_expr]--> found arg of type: option -[nested_expr]--> extracted type, continuing descent -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> trying to move into variant payload $2 of constructor 'Test' +[nested]--> found constructor (Args type) +[nested]--> found arg of type: option +[extract_type]--> starting extraction of type: option, in env: CompletionPattern. Has type arg ctx: false +[nested]--> extracted type, continuing descent +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> reached end of pattern, returning type [{ "label": "None", "kind": 12, @@ -735,13 +864,18 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[p] Path p +[extract_type]--> starting extraction of type: multiPayloadVariant, in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: multiPayloadVariant, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> digging for type multiPayloadVariant in CompletionPattern [extract_type]--> found variant -[nested_expr]--> trying to move into variant payload $1 of constructor 'Test' -[nested_expr]--> found constructor (Args type) -[nested_expr]--> found arg of type: bool -[nested_expr]--> extracted type, continuing descent -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> trying to move into variant payload $1 of constructor 'Test' +[nested]--> found constructor (Args type) +[nested]--> found arg of type: bool +[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false +[nested]--> extracted type, continuing descent +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -765,13 +899,18 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[p] Path p +[extract_type]--> starting extraction of type: multiPayloadVariant, in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: multiPayloadVariant, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> digging for type multiPayloadVariant in CompletionPattern [extract_type]--> found variant -[nested_expr]--> trying to move into variant payload $3 of constructor 'Test' -[nested_expr]--> found constructor (Args type) -[nested_expr]--> found arg of type: array -[nested_expr]--> extracted type, continuing descent -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> trying to move into variant payload $3 of constructor 'Test' +[nested]--> found constructor (Args type) +[nested]--> found arg of type: array +[extract_type]--> starting extraction of type: array, in env: CompletionPattern. Has type arg ctx: false +[nested]--> extracted type, continuing descent +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> reached end of pattern, returning type [{ "label": "[]", "kind": 12, @@ -790,9 +929,14 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[v] Path v +[extract_type]--> starting extraction of type: multiPayloadPolyVariant, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> digging for type multiPayloadPolyVariant in CompletionPattern [extract_type]--> found type manifest -[nested_expr]--> reached end of pattern, returning type +[extract_type]--> starting extraction of type: [#test(int, bool, option, array)], in env: CompletionPattern. Has type arg ctx: false +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -815,9 +959,14 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[v] Path v +[extract_type]--> starting extraction of type: multiPayloadPolyVariant, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> digging for type multiPayloadPolyVariant in CompletionPattern [extract_type]--> found type manifest -[nested_expr]--> reached end of pattern, returning type +[extract_type]--> starting extraction of type: [#test(int, bool, option, array)], in env: CompletionPattern. Has type arg ctx: false +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: option, in env: CompletionPattern. Has type arg ctx: false +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> reached end of pattern, returning type [{ "label": "None", "kind": 12, @@ -854,9 +1003,14 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[v] Path v +[extract_type]--> starting extraction of type: multiPayloadPolyVariant, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> digging for type multiPayloadPolyVariant in CompletionPattern [extract_type]--> found type manifest -[nested_expr]--> reached end of pattern, returning type +[extract_type]--> starting extraction of type: [#test(int, bool, option, array)], in env: CompletionPattern. Has type arg ctx: false +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -879,9 +1033,14 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[v] Path v +[extract_type]--> starting extraction of type: multiPayloadPolyVariant, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> digging for type multiPayloadPolyVariant in CompletionPattern [extract_type]--> found type manifest -[nested_expr]--> reached end of pattern, returning type +[extract_type]--> starting extraction of type: [#test(int, bool, option, array)], in env: CompletionPattern. Has type arg ctx: false +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: array, in env: CompletionPattern. Has type arg ctx: false +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> reached end of pattern, returning type [{ "label": "[]", "kind": 12, @@ -901,8 +1060,14 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[s] Path s -[nested_expr]--> trying to move into tuple -[nested_expr]--> reached end of pattern, returning type +[extract_type]--> starting extraction of type: (bool, option, array), in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: (bool, option, array), in env: CompletionPattern. Has type arg ctx: false +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> trying to move into tuple +[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -924,8 +1089,14 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[s] Path s -[nested_expr]--> trying to move into tuple -[nested_expr]--> reached end of pattern, returning type +[extract_type]--> starting extraction of type: (bool, option, array), in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: (bool, option, array), in env: CompletionPattern. Has type arg ctx: false +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> trying to move into tuple +[extract_type]--> starting extraction of type: option, in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: option, in env: CompletionPattern. Has type arg ctx: false +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> reached end of pattern, returning type [{ "label": "None", "kind": 12, @@ -961,8 +1132,14 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[s] Path s -[nested_expr]--> trying to move into tuple -[nested_expr]--> reached end of pattern, returning type +[extract_type]--> starting extraction of type: (bool, option, array), in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: (bool, option, array), in env: CompletionPattern. Has type arg ctx: false +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> trying to move into tuple +[extract_type]--> starting extraction of type: option, in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: option, in env: CompletionPattern. Has type arg ctx: false +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> reached end of pattern, returning type [{ "label": "None", "kind": 12, @@ -998,7 +1175,10 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[s] Path s -[nested_expr]--> reached end of pattern, returning type +[extract_type]--> starting extraction of type: (bool, option, array), in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: (bool, option, array), in env: CompletionPattern. Has type arg ctx: false +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> reached end of pattern, returning type [{ "label": "(_, _, _)", "kind": 12, @@ -1016,8 +1196,14 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[s] Path s -[nested_expr]--> trying to move into tuple -[nested_expr]--> reached end of pattern, returning type +[extract_type]--> starting extraction of type: (bool, option, array), in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: (bool, option, array), in env: CompletionPattern. Has type arg ctx: false +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> trying to move into tuple +[extract_type]--> starting extraction of type: option, in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: option, in env: CompletionPattern. Has type arg ctx: false +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> reached end of pattern, returning type [{ "label": "None", "kind": 12, @@ -1053,9 +1239,12 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[z] Path z +[extract_type]--> starting extraction of type: someVariant, in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: someVariant, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> digging for type someVariant in CompletionPattern [extract_type]--> found variant -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> reached end of pattern, returning type [{ "label": "One", "kind": 4, @@ -1091,13 +1280,18 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[z] Path z +[extract_type]--> starting extraction of type: someVariant, in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: someVariant, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> digging for type someVariant in CompletionPattern [extract_type]--> found variant -[nested_expr]--> trying to move into variant payload $0 of constructor 'Two' -[nested_expr]--> found constructor (Args type) -[nested_expr]--> found arg of type: bool -[nested_expr]--> extracted type, continuing descent -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> trying to move into variant payload $0 of constructor 'Two' +[nested]--> found constructor (Args type) +[nested]--> found arg of type: bool +[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false +[nested]--> extracted type, continuing descent +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -1122,13 +1316,18 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[z] Path z +[extract_type]--> starting extraction of type: someVariant, in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: someVariant, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> digging for type someVariant in CompletionPattern [extract_type]--> found variant -[nested_expr]--> trying to move into variant payload $1 of constructor 'Three' -[nested_expr]--> found constructor (Args type) -[nested_expr]--> found arg of type: bool -[nested_expr]--> extracted type, continuing descent -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> trying to move into variant payload $1 of constructor 'Three' +[nested]--> found constructor (Args type) +[nested]--> found arg of type: bool +[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false +[nested]--> extracted type, continuing descent +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -1151,9 +1350,14 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[b] Path b +[extract_type]--> starting extraction of type: somePolyVariant, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> digging for type somePolyVariant in CompletionPattern [extract_type]--> found type manifest -[nested_expr]--> reached end of pattern, returning type +[extract_type]--> starting extraction of type: [#one | #three(someRecord, bool) | #two(bool)], in env: CompletionPattern. Has type arg ctx: false +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -1177,9 +1381,14 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[b] Path b +[extract_type]--> starting extraction of type: somePolyVariant, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> digging for type somePolyVariant in CompletionPattern [extract_type]--> found type manifest -[nested_expr]--> reached end of pattern, returning type +[extract_type]--> starting extraction of type: [#one | #three(someRecord, bool) | #two(bool)], in env: CompletionPattern. Has type arg ctx: false +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -1202,8 +1411,14 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[s] Path s -[nested_expr]--> trying to move into tuple -[nested_expr]--> reached end of pattern, returning type +[extract_type]--> starting extraction of type: (bool, option, array), in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: (bool, option, array), in env: CompletionPattern. Has type arg ctx: false +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> trying to move into tuple +[extract_type]--> starting extraction of type: option, in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: option, in env: CompletionPattern. Has type arg ctx: false +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> reached end of pattern, returning type [{ "label": "None", "kind": 12, @@ -1239,12 +1454,17 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[ff] Path ff +[extract_type]--> starting extraction of type: recordWithFn, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> digging for type recordWithFn in CompletionPattern [extract_type]--> found record -[nested_expr]--> trying to move into record field -[nested_expr]--> found record field type -[nested_expr]--> extracting from type unit => unit in env CompletionPattern -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> trying to move into record field +[nested]--> found record field type +[nested]--> extracting from type unit => unit in env CompletionPattern +[extract_type]--> starting extraction of type: unit => unit, in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: unit => unit, in env: CompletionPattern. Has type arg ctx: false +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> reached end of pattern, returning type [] Complete src/CompletionPattern.res 206:16 @@ -1254,7 +1474,9 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[xn] Path xn -[nested_expr]--> reached end of pattern, returning type +[extract_type]--> starting extraction of type: exn, in env: CompletionPattern. Has type arg ctx: false +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> reached end of pattern, returning type [{ "label": "Js.Exn.Error(error)", "kind": 4, @@ -1272,9 +1494,12 @@ ContextPath await Value[getThing](Nolabel) ContextPath Value[getThing](Nolabel) ContextPath Value[getThing] Path getThing +[extract_type]--> starting extraction of type: someVariant, in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: someVariant, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> digging for type someVariant in CompletionPattern [extract_type]--> found variant -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false +[nested]--> reached end of pattern, returning type [{ "label": "One", "kind": 4, @@ -1311,17 +1536,32 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[res] Path res +[extract_type]--> starting extraction of type: result, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> digging for type Pervasives.result in CompletionPattern [extract_type]--> found type manifest -[extract_type]--> digging for type Belt.Result.t in CompletionPattern +[extract_type]--> starting extraction of type: Belt.Result.t<'a, 'b>, in env: Pervasives. Has type arg ctx: true +[extract_type]--> Type arg context. env: CompletionPattern, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b +[extract_type]--> digging for type Belt.Result.t in Pervasives [extract_type]--> found variant -[nested_expr]--> trying to move into variant payload $0 of constructor 'Ok' -[nested_expr]--> found constructor (Args type) -[nested_expr]--> found arg of type: 'a +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: true +[nested]--> Type arg context. env: CompletionPattern, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b +[nested]--> trying to move into variant payload $0 of constructor 'Ok' +[nested]--> found constructor (Args type) +[nested]--> found arg of type: 'a +[extract_type]--> starting extraction of type: 'a, in env: Belt_Result. Has type arg ctx: true +[extract_type]--> Type arg context. env: CompletionPattern, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b +[extract_type]--> starting extraction of type: 'a, in env: Belt_Result. Has type arg ctx: true +[extract_type]--> Type arg context. env: CompletionPattern, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b +[extract_type]--> found type variable: 'a. Trying to instantiate with Type arg context. env: CompletionPattern, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b +[extract_type]--> SUCCEEDED instantiation, new type is: someVariant +[extract_type]--> starting extraction of type: someVariant, in env: CompletionPattern. Has type arg ctx: true +[extract_type]--> Type arg context. env: CompletionPattern, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b [extract_type]--> digging for type someVariant in CompletionPattern [extract_type]--> found variant -[nested_expr]--> extracted type, continuing descent -[nested_expr]--> reached end of pattern, returning type +[nested]--> extracted type, continuing descent +[nested]--> running nested in env: Belt_Result. Has type arg ctx: true +[nested]--> Type arg context. env: CompletionPattern, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b +[nested]--> reached end of pattern, returning type [{ "label": "One", "kind": 4, @@ -1358,17 +1598,32 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[res] Path res +[extract_type]--> starting extraction of type: result, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> digging for type Pervasives.result in CompletionPattern [extract_type]--> found type manifest -[extract_type]--> digging for type Belt.Result.t in CompletionPattern +[extract_type]--> starting extraction of type: Belt.Result.t<'a, 'b>, in env: Pervasives. Has type arg ctx: true +[extract_type]--> Type arg context. env: CompletionPattern, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b +[extract_type]--> digging for type Belt.Result.t in Pervasives [extract_type]--> found variant -[nested_expr]--> trying to move into variant payload $0 of constructor 'Error' -[nested_expr]--> found constructor (Args type) -[nested_expr]--> found arg of type: 'b +[nested]--> running nested in env: CompletionPattern. Has type arg ctx: true +[nested]--> Type arg context. env: CompletionPattern, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b +[nested]--> trying to move into variant payload $0 of constructor 'Error' +[nested]--> found constructor (Args type) +[nested]--> found arg of type: 'b +[extract_type]--> starting extraction of type: 'b, in env: Belt_Result. Has type arg ctx: true +[extract_type]--> Type arg context. env: CompletionPattern, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b +[extract_type]--> starting extraction of type: 'b, in env: Belt_Result. Has type arg ctx: true +[extract_type]--> Type arg context. env: CompletionPattern, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b +[extract_type]--> found type variable: 'b. Trying to instantiate with Type arg context. env: CompletionPattern, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b +[extract_type]--> SUCCEEDED instantiation, new type is: somePolyVariant +[extract_type]--> starting extraction of type: somePolyVariant, in env: CompletionPattern. Has type arg ctx: true +[extract_type]--> Type arg context. env: CompletionPattern, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b [extract_type]--> digging for type somePolyVariant in CompletionPattern [extract_type]--> found type manifest -[nested_expr]--> extracted type, continuing descent -[nested_expr]--> reached end of pattern, returning type +[extract_type]--> starting extraction of type: [#one | #three(someRecord, bool) | #two(bool)], in env: CompletionPattern. Has type arg ctx: false +[nested]--> extracted type, continuing descent +[nested]--> running nested in env: Belt_Result. Has type arg ctx: false +[nested]--> reached end of pattern, returning type [{ "label": "#one", "kind": 4, diff --git a/analysis/tests/src/expected/CompletionTypeAnnotation.res.txt b/analysis/tests/src/expected/CompletionTypeAnnotation.res.txt index f244d8a46..439fec817 100644 --- a/analysis/tests/src/expected/CompletionTypeAnnotation.res.txt +++ b/analysis/tests/src/expected/CompletionTypeAnnotation.res.txt @@ -6,7 +6,8 @@ Resolved opens 1 pervasives --> expression completion ContextPath Type[someRecord] Path someRecord -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionTypeAnnotation. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "{}", @@ -27,6 +28,7 @@ Resolved opens 1 pervasives --> expression completion ContextPath Type[someRecord] Path someRecord +[nested]--> running nested in env: CompletionTypeAnnotation. Has type arg ctx: false --> found type in nested expression completion [{ "label": "age", @@ -50,7 +52,8 @@ Resolved opens 1 pervasives --> expression completion ContextPath Type[someVariant] Path someVariant -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionTypeAnnotation. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "One", @@ -78,7 +81,8 @@ Resolved opens 1 pervasives --> expression completion ContextPath Type[someVariant] Path someVariant -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionTypeAnnotation. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "One", @@ -111,7 +115,8 @@ Resolved opens 1 pervasives --> expression completion ContextPath Type[somePolyVariant] Path somePolyVariant -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionTypeAnnotation. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "#one", @@ -139,7 +144,8 @@ Resolved opens 1 pervasives --> expression completion ContextPath Type[somePolyVariant] Path somePolyVariant -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionTypeAnnotation. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "#one", @@ -159,7 +165,8 @@ Resolved opens 1 pervasives --> expression completion ContextPath Type[someFunc] Path someFunc -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionTypeAnnotation. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "(v1, v2) => {}", @@ -180,7 +187,8 @@ Resolved opens 1 pervasives --> expression completion ContextPath Type[someTuple] Path someTuple -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionTypeAnnotation. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "(_, _)", @@ -200,8 +208,11 @@ Resolved opens 1 pervasives --> expression completion ContextPath Type[someTuple] Path someTuple -[nested_expr]--> trying to move into tuple -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionTypeAnnotation. Has type arg ctx: false +[nested]--> trying to move into tuple +[extract_type]--> starting extraction of type: option, in env: CompletionTypeAnnotation. Has type arg ctx: false +[nested]--> running nested in env: CompletionTypeAnnotation. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "None", @@ -240,7 +251,8 @@ Resolved opens 1 pervasives ContextPath option ContextPath Type[someVariant] Path someVariant -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionTypeAnnotation. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "None", @@ -283,8 +295,10 @@ Resolved opens 1 pervasives ContextPath option ContextPath Type[someVariant] Path someVariant -[nested_expr]--> moving into option Some -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionTypeAnnotation. Has type arg ctx: false +[nested]--> moving into option Some +[nested]--> running nested in env: CompletionTypeAnnotation. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "One", @@ -313,7 +327,8 @@ Resolved opens 1 pervasives ContextPath array ContextPath Type[someVariant] Path someVariant -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionTypeAnnotation. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "[]", @@ -335,7 +350,9 @@ Resolved opens 1 pervasives ContextPath array ContextPath Type[someVariant] Path someVariant -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionTypeAnnotation. Has type arg ctx: false +[nested]--> running nested in env: CompletionTypeAnnotation. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "One", @@ -365,7 +382,8 @@ ContextPath array> ContextPath option ContextPath Type[someVariant] Path someVariant -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionTypeAnnotation. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "[]", @@ -388,8 +406,11 @@ ContextPath option> ContextPath array ContextPath Type[someVariant] Path someVariant -[nested_expr]--> moving into option Some -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: CompletionTypeAnnotation. Has type arg ctx: false +[nested]--> moving into option Some +[nested]--> running nested in env: CompletionTypeAnnotation. Has type arg ctx: false +[nested]--> running nested in env: CompletionTypeAnnotation. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "One", diff --git a/analysis/tests/src/expected/Destructuring.res.txt b/analysis/tests/src/expected/Destructuring.res.txt index 0f0f5a004..3538a7774 100644 --- a/analysis/tests/src/expected/Destructuring.res.txt +++ b/analysis/tests/src/expected/Destructuring.res.txt @@ -5,8 +5,12 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[x] Path x +[extract_type]--> starting extraction of type: x, in env: Destructuring. Has type arg ctx: false +[extract_type]--> starting extraction of type: x, in env: Destructuring. Has type arg ctx: false [extract_type]--> digging for type x in Destructuring [extract_type]--> found record +[nested]--> running nested in env: Destructuring. Has type arg ctx: false +[extract_type]--> starting extraction of type: x, in env: Destructuring. Has type arg ctx: false [extract_type]--> digging for type x in Destructuring [extract_type]--> found record [{ @@ -24,8 +28,12 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[x] Path x +[extract_type]--> starting extraction of type: x, in env: Destructuring. Has type arg ctx: false +[extract_type]--> starting extraction of type: x, in env: Destructuring. Has type arg ctx: false [extract_type]--> digging for type x in Destructuring [extract_type]--> found record +[nested]--> running nested in env: Destructuring. Has type arg ctx: false +[extract_type]--> starting extraction of type: x, in env: Destructuring. Has type arg ctx: false [extract_type]--> digging for type x in Destructuring [extract_type]--> found record [{ @@ -51,8 +59,11 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[x] Path x +[extract_type]--> starting extraction of type: x, in env: Destructuring. Has type arg ctx: false [extract_type]--> digging for type x in Destructuring [extract_type]--> found record +[nested]--> running nested in env: Destructuring. Has type arg ctx: false +[extract_type]--> starting extraction of type: x, in env: Destructuring. Has type arg ctx: false [extract_type]--> digging for type x in Destructuring [extract_type]--> found record [{ @@ -72,8 +83,11 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[x] Path x +[extract_type]--> starting extraction of type: x, in env: Destructuring. Has type arg ctx: false [extract_type]--> digging for type x in Destructuring [extract_type]--> found record +[nested]--> running nested in env: Destructuring. Has type arg ctx: false +[extract_type]--> starting extraction of type: x, in env: Destructuring. Has type arg ctx: false [extract_type]--> digging for type x in Destructuring [extract_type]--> found record [{ @@ -97,8 +111,11 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[x] Path x +[extract_type]--> starting extraction of type: recordWithOptField, in env: Destructuring. Has type arg ctx: false [extract_type]--> digging for type recordWithOptField in Destructuring [extract_type]--> found record +[nested]--> running nested in env: Destructuring. Has type arg ctx: false +[extract_type]--> starting extraction of type: recordWithOptField, in env: Destructuring. Has type arg ctx: false [extract_type]--> digging for type recordWithOptField in Destructuring [extract_type]--> found record [{ diff --git a/analysis/tests/src/expected/EnvCompletion.res.txt b/analysis/tests/src/expected/EnvCompletion.res.txt index 72bee04ff..6b7654012 100644 --- a/analysis/tests/src/expected/EnvCompletion.res.txt +++ b/analysis/tests/src/expected/EnvCompletion.res.txt @@ -5,9 +5,11 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[res] Path res +[extract_type]--> starting extraction of type: EnvCompletionOtherFile.someResult, in env: EnvCompletion. Has type arg ctx: false [extract_type]--> digging for type EnvCompletionOtherFile.someResult in EnvCompletion [extract_type]--> found variant -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: EnvCompletion. Has type arg ctx: false +[nested]--> reached end of pattern, returning type [{ "label": "Okay(_)", "kind": 4, @@ -36,32 +38,23 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[res] Path res +[extract_type]--> starting extraction of type: EnvCompletionOtherFile.someResult, in env: EnvCompletion. Has type arg ctx: false [extract_type]--> digging for type EnvCompletionOtherFile.someResult in EnvCompletion [extract_type]--> found variant -[nested_expr]--> trying to move into variant payload $0 of constructor 'Okay' -[nested_expr]--> found constructor (Args type) -[nested_expr]--> found arg of type: 'a -[extract_type]--> digging for type things in EnvCompletion -[extract_type]--> found variant -[nested_expr]--> extracted type, continuing descent -[nested_expr]--> reached end of pattern, returning type -[{ - "label": "One", - "kind": 4, - "tags": [], - "detail": "One\n\ntype things = One | Two", - "documentation": null, - "insertText": "One", - "insertTextFormat": 2 - }, { - "label": "Two", - "kind": 4, - "tags": [], - "detail": "Two\n\ntype things = One | Two", - "documentation": null, - "insertText": "Two", - "insertTextFormat": 2 - }] +[nested]--> running nested in env: EnvCompletion. Has type arg ctx: false +[nested]--> trying to move into variant payload $0 of constructor 'Okay' +[nested]--> found constructor (Args type) +[nested]--> found arg of type: 'a +[extract_type]--> starting extraction of type: 'a, in env: EnvCompletionOtherFile. Has type arg ctx: false +[extract_type]--> starting extraction of type: 'a, in env: EnvCompletionOtherFile. Has type arg ctx: false +[extract_type]--> found type variable: 'a. Trying to instantiate with no type args ctx +[extract_type]--> could not instantiate 'a. Skipping. +Completable: Cpath Value[()] +Package opens Pervasives.JsxModules.place holder +Resolved opens 1 pervasives +ContextPath Value[()] +Path () +[] Complete src/EnvCompletion.res 16:26 posCursor:[16:26] posNoWhite:[16:25] Found pattern:[16:18->16:27] @@ -73,23 +66,23 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[res] Path res +[extract_type]--> starting extraction of type: EnvCompletionOtherFile.someResult, in env: EnvCompletion. Has type arg ctx: false [extract_type]--> digging for type EnvCompletionOtherFile.someResult in EnvCompletion [extract_type]--> found variant -[nested_expr]--> trying to move into variant payload $0 of constructor 'Failure' -[nested_expr]--> found constructor (Args type) -[nested_expr]--> found arg of type: 'b -[nested_expr]--> extracted type, continuing descent -[nested_expr]--> reached end of pattern, returning type -[{ - "label": "\"\"", - "kind": 12, - "tags": [], - "detail": "string", - "documentation": null, - "sortText": "A", - "insertText": "\"$0\"", - "insertTextFormat": 2 - }] +[nested]--> running nested in env: EnvCompletion. Has type arg ctx: false +[nested]--> trying to move into variant payload $0 of constructor 'Failure' +[nested]--> found constructor (Args type) +[nested]--> found arg of type: 'b +[extract_type]--> starting extraction of type: 'b, in env: EnvCompletionOtherFile. Has type arg ctx: false +[extract_type]--> starting extraction of type: 'b, in env: EnvCompletionOtherFile. Has type arg ctx: false +[extract_type]--> found type variable: 'b. Trying to instantiate with no type args ctx +[extract_type]--> could not instantiate 'b. Skipping. +Completable: Cpath Value[()] +Package opens Pervasives.JsxModules.place holder +Resolved opens 1 pervasives +ContextPath Value[()] +Path () +[] Complete src/EnvCompletion.res 19:19 XXX Not found! @@ -99,9 +92,11 @@ Resolved opens 1 pervasives ContextPath Value[use](Nolabel) ContextPath Value[use] Path use +[extract_type]--> starting extraction of type: EnvCompletionOtherFile.response, in env: EnvCompletion. Has type arg ctx: false [extract_type]--> digging for type EnvCompletionOtherFile.response in EnvCompletion [extract_type]--> found record -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: EnvCompletion. Has type arg ctx: false +[nested]--> reached end of pattern, returning type [{ "label": "{}", "kind": 22, @@ -121,9 +116,12 @@ Resolved opens 1 pervasives ContextPath Value[use](Nolabel) ContextPath Value[use] Path use +[extract_type]--> starting extraction of type: EnvCompletionOtherFile.response, in env: EnvCompletion. Has type arg ctx: false [extract_type]--> digging for type EnvCompletionOtherFile.response in EnvCompletion [extract_type]--> found record -[extract_type]--> digging for type EnvCompletionOtherFile.response in EnvCompletion +[nested]--> running nested in env: EnvCompletion. Has type arg ctx: false +[extract_type]--> starting extraction of type: EnvCompletionOtherFile.response, in env: EnvCompletionOtherFile. Has type arg ctx: false +[extract_type]--> digging for type EnvCompletionOtherFile.response in EnvCompletionOtherFile [extract_type]--> found record [{ "label": "stuff", @@ -147,14 +145,36 @@ Resolved opens 1 pervasives ContextPath Value[use](Nolabel) ContextPath Value[use] Path use +[extract_type]--> starting extraction of type: EnvCompletionOtherFile.response, in env: EnvCompletion. Has type arg ctx: false [extract_type]--> digging for type EnvCompletionOtherFile.response in EnvCompletion [extract_type]--> found record -[nested_expr]--> trying to move into record field -[nested_expr]--> found record field type -[nested_expr]--> extracting from type theVariant in env EnvCompletion -[extract_type]--> digging for type theVariant in EnvCompletion -[extract_type]--> found nothing when digging -[] +[nested]--> running nested in env: EnvCompletion. Has type arg ctx: false +[nested]--> trying to move into record field +[nested]--> found record field type +[nested]--> extracting from type theVariant in env EnvCompletionOtherFile +[extract_type]--> starting extraction of type: theVariant, in env: EnvCompletionOtherFile. Has type arg ctx: false +[extract_type]--> starting extraction of type: theVariant, in env: EnvCompletionOtherFile. Has type arg ctx: false +[extract_type]--> digging for type theVariant in EnvCompletionOtherFile +[extract_type]--> found variant +[nested]--> running nested in env: EnvCompletionOtherFile. Has type arg ctx: false +[nested]--> reached end of pattern, returning type +[{ + "label": "First", + "kind": 4, + "tags": [], + "detail": "First\n\ntype theVariant = First | Second(r1)", + "documentation": null, + "insertText": "First", + "insertTextFormat": 2 + }, { + "label": "Second(_)", + "kind": 4, + "tags": [], + "detail": "Second(r1)\n\ntype theVariant = First | Second(r1)", + "documentation": null, + "insertText": "Second(${1:_})", + "insertTextFormat": 2 + }] Complete src/EnvCompletion.res 28:35 posCursor:[28:35] posNoWhite:[28:34] Found pattern:[28:20->28:38] @@ -168,19 +188,37 @@ Resolved opens 1 pervasives ContextPath Value[use](Nolabel) ContextPath Value[use] Path use +[extract_type]--> starting extraction of type: EnvCompletionOtherFile.response, in env: EnvCompletion. Has type arg ctx: false [extract_type]--> digging for type EnvCompletionOtherFile.response in EnvCompletion [extract_type]--> found record -[nested_expr]--> trying to move into record field -[nested_expr]--> found record field type -[nested_expr]--> extracting from type theVariant in env EnvCompletion -[extract_type]--> digging for type theVariant in EnvCompletion -[extract_type]--> found nothing when digging -Completable: Cpath Value[()] -Package opens Pervasives.JsxModules.place holder -Resolved opens 1 pervasives -ContextPath Value[()] -Path () -[] +[nested]--> running nested in env: EnvCompletion. Has type arg ctx: false +[nested]--> trying to move into record field +[nested]--> found record field type +[nested]--> extracting from type theVariant in env EnvCompletionOtherFile +[extract_type]--> starting extraction of type: theVariant, in env: EnvCompletionOtherFile. Has type arg ctx: false +[extract_type]--> starting extraction of type: theVariant, in env: EnvCompletionOtherFile. Has type arg ctx: false +[extract_type]--> digging for type theVariant in EnvCompletionOtherFile +[extract_type]--> found variant +[nested]--> running nested in env: EnvCompletionOtherFile. Has type arg ctx: false +[nested]--> trying to move into variant payload $0 of constructor 'Second' +[nested]--> found constructor (Args type) +[nested]--> found arg of type: r1 +[extract_type]--> starting extraction of type: r1, in env: EnvCompletionOtherFile. Has type arg ctx: false +[extract_type]--> digging for type r1 in EnvCompletionOtherFile +[extract_type]--> found record +[nested]--> extracted type, continuing descent +[nested]--> running nested in env: EnvCompletionOtherFile. Has type arg ctx: false +[nested]--> reached end of pattern, returning type +[{ + "label": "{}", + "kind": 22, + "tags": [], + "detail": "r1", + "documentation": null, + "sortText": "A", + "insertText": "{$0}", + "insertTextFormat": 2 + }] Complete src/EnvCompletion.res 31:36 posCursor:[31:36] posNoWhite:[31:35] Found pattern:[31:20->31:40] @@ -193,19 +231,36 @@ Resolved opens 1 pervasives ContextPath Value[use](Nolabel) ContextPath Value[use] Path use +[extract_type]--> starting extraction of type: EnvCompletionOtherFile.response, in env: EnvCompletion. Has type arg ctx: false [extract_type]--> digging for type EnvCompletionOtherFile.response in EnvCompletion [extract_type]--> found record -[nested_expr]--> trying to move into record field -[nested_expr]--> found record field type -[nested_expr]--> extracting from type theVariant in env EnvCompletion -[extract_type]--> digging for type theVariant in EnvCompletion -[extract_type]--> found nothing when digging -Completable: Cpath Value[Second] -Package opens Pervasives.JsxModules.place holder -Resolved opens 1 pervasives -ContextPath Value[Second] -Path Second -[] +[nested]--> running nested in env: EnvCompletion. Has type arg ctx: false +[nested]--> trying to move into record field +[nested]--> found record field type +[nested]--> extracting from type theVariant in env EnvCompletionOtherFile +[extract_type]--> starting extraction of type: theVariant, in env: EnvCompletionOtherFile. Has type arg ctx: false +[extract_type]--> starting extraction of type: theVariant, in env: EnvCompletionOtherFile. Has type arg ctx: false +[extract_type]--> digging for type theVariant in EnvCompletionOtherFile +[extract_type]--> found variant +[nested]--> running nested in env: EnvCompletionOtherFile. Has type arg ctx: false +[nested]--> trying to move into variant payload $0 of constructor 'Second' +[nested]--> found constructor (Args type) +[nested]--> found arg of type: r1 +[extract_type]--> starting extraction of type: r1, in env: EnvCompletionOtherFile. Has type arg ctx: false +[extract_type]--> digging for type r1 in EnvCompletionOtherFile +[extract_type]--> found record +[nested]--> extracted type, continuing descent +[nested]--> running nested in env: EnvCompletionOtherFile. Has type arg ctx: false +[extract_type]--> starting extraction of type: r1, in env: EnvCompletionOtherFile. Has type arg ctx: false +[extract_type]--> digging for type r1 in EnvCompletionOtherFile +[extract_type]--> found record +[{ + "label": "age", + "kind": 5, + "tags": [], + "detail": "age: int\n\nr1", + "documentation": null + }] Complete src/EnvCompletion.res 34:25 posCursor:[34:25] posNoWhite:[34:24] Found pattern:[34:20->34:29] @@ -215,29 +270,34 @@ Resolved opens 1 pervasives ContextPath Value[use](Nolabel) ContextPath Value[use] Path use +[extract_type]--> starting extraction of type: EnvCompletionOtherFile.response, in env: EnvCompletion. Has type arg ctx: false [extract_type]--> digging for type EnvCompletionOtherFile.response in EnvCompletion [extract_type]--> found record -[nested_expr]--> trying to move into record field -[nested_expr]--> found record field type -[nested_expr]--> extracting from type someResult in env EnvCompletion -[extract_type]--> digging for type someResult in EnvCompletion +[nested]--> running nested in env: EnvCompletion. Has type arg ctx: false +[nested]--> trying to move into record field +[nested]--> found record field type +[nested]--> extracting from type someResult in env EnvCompletionOtherFile +[extract_type]--> starting extraction of type: someResult, in env: EnvCompletionOtherFile. Has type arg ctx: false +[extract_type]--> starting extraction of type: someResult, in env: EnvCompletionOtherFile. Has type arg ctx: false +[extract_type]--> digging for type someResult in EnvCompletionOtherFile [extract_type]--> found variant -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: EnvCompletionOtherFile. Has type arg ctx: false +[nested]--> reached end of pattern, returning type [{ - "label": "One", + "label": "Okay(_)", "kind": 4, "tags": [], - "detail": "One\n\ntype things = One | Two", + "detail": "Okay('a)\n\ntype someResult<'a, 'b> = Okay('a) | Failure('b)", "documentation": null, - "insertText": "One", + "insertText": "Okay(${1:_})", "insertTextFormat": 2 }, { - "label": "Two", + "label": "Failure(_)", "kind": 4, "tags": [], - "detail": "Two\n\ntype things = One | Two", + "detail": "Failure('b)\n\ntype someResult<'a, 'b> = Okay('a) | Failure('b)", "documentation": null, - "insertText": "Two", + "insertText": "Failure(${1:_})", "insertTextFormat": 2 }] @@ -253,14 +313,25 @@ Resolved opens 1 pervasives ContextPath Value[use](Nolabel) ContextPath Value[use] Path use +[extract_type]--> starting extraction of type: EnvCompletionOtherFile.response, in env: EnvCompletion. Has type arg ctx: false [extract_type]--> digging for type EnvCompletionOtherFile.response in EnvCompletion [extract_type]--> found record -[nested_expr]--> trying to move into record field -[nested_expr]--> found record field type -[nested_expr]--> extracting from type someResult in env EnvCompletion -[extract_type]--> digging for type someResult in EnvCompletion +[nested]--> running nested in env: EnvCompletion. Has type arg ctx: false +[nested]--> trying to move into record field +[nested]--> found record field type +[nested]--> extracting from type someResult in env EnvCompletionOtherFile +[extract_type]--> starting extraction of type: someResult, in env: EnvCompletionOtherFile. Has type arg ctx: false +[extract_type]--> starting extraction of type: someResult, in env: EnvCompletionOtherFile. Has type arg ctx: false +[extract_type]--> digging for type someResult in EnvCompletionOtherFile [extract_type]--> found variant -[nested_expr]--> trying to move into variant payload $0 of constructor 'Okay' +[nested]--> running nested in env: EnvCompletionOtherFile. Has type arg ctx: false +[nested]--> trying to move into variant payload $0 of constructor 'Okay' +[nested]--> found constructor (Args type) +[nested]--> found arg of type: 'a +[extract_type]--> starting extraction of type: 'a, in env: EnvCompletionOtherFile. Has type arg ctx: false +[extract_type]--> starting extraction of type: 'a, in env: EnvCompletionOtherFile. Has type arg ctx: false +[extract_type]--> found type variable: 'a. Trying to instantiate with no type args ctx +[extract_type]--> could not instantiate 'a. Skipping. Completable: Cpath Value[()] Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives @@ -282,14 +353,25 @@ Resolved opens 1 pervasives ContextPath Value[use](Nolabel) ContextPath Value[use] Path use +[extract_type]--> starting extraction of type: EnvCompletionOtherFile.response, in env: EnvCompletion. Has type arg ctx: false [extract_type]--> digging for type EnvCompletionOtherFile.response in EnvCompletion [extract_type]--> found record -[nested_expr]--> trying to move into record field -[nested_expr]--> found record field type -[nested_expr]--> extracting from type someResult in env EnvCompletion -[extract_type]--> digging for type someResult in EnvCompletion +[nested]--> running nested in env: EnvCompletion. Has type arg ctx: false +[nested]--> trying to move into record field +[nested]--> found record field type +[nested]--> extracting from type someResult in env EnvCompletionOtherFile +[extract_type]--> starting extraction of type: someResult, in env: EnvCompletionOtherFile. Has type arg ctx: false +[extract_type]--> starting extraction of type: someResult, in env: EnvCompletionOtherFile. Has type arg ctx: false +[extract_type]--> digging for type someResult in EnvCompletionOtherFile [extract_type]--> found variant -[nested_expr]--> trying to move into variant payload $0 of constructor 'Okay' +[nested]--> running nested in env: EnvCompletionOtherFile. Has type arg ctx: false +[nested]--> trying to move into variant payload $0 of constructor 'Okay' +[nested]--> found constructor (Args type) +[nested]--> found arg of type: 'a +[extract_type]--> starting extraction of type: 'a, in env: EnvCompletionOtherFile. Has type arg ctx: false +[extract_type]--> starting extraction of type: 'a, in env: EnvCompletionOtherFile. Has type arg ctx: false +[extract_type]--> found type variable: 'a. Trying to instantiate with no type args ctx +[extract_type]--> could not instantiate 'a. Skipping. Completable: Cpath Value[()] Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives @@ -310,14 +392,25 @@ Resolved opens 1 pervasives ContextPath Value[use](Nolabel) ContextPath Value[use] Path use +[extract_type]--> starting extraction of type: EnvCompletionOtherFile.response, in env: EnvCompletion. Has type arg ctx: false [extract_type]--> digging for type EnvCompletionOtherFile.response in EnvCompletion [extract_type]--> found record -[nested_expr]--> trying to move into record field -[nested_expr]--> found record field type -[nested_expr]--> extracting from type someResult in env EnvCompletion -[extract_type]--> digging for type someResult in EnvCompletion +[nested]--> running nested in env: EnvCompletion. Has type arg ctx: false +[nested]--> trying to move into record field +[nested]--> found record field type +[nested]--> extracting from type someResult in env EnvCompletionOtherFile +[extract_type]--> starting extraction of type: someResult, in env: EnvCompletionOtherFile. Has type arg ctx: false +[extract_type]--> starting extraction of type: someResult, in env: EnvCompletionOtherFile. Has type arg ctx: false +[extract_type]--> digging for type someResult in EnvCompletionOtherFile [extract_type]--> found variant -[nested_expr]--> trying to move into variant payload $0 of constructor 'Okay' +[nested]--> running nested in env: EnvCompletionOtherFile. Has type arg ctx: false +[nested]--> trying to move into variant payload $0 of constructor 'Okay' +[nested]--> found constructor (Args type) +[nested]--> found arg of type: 'a +[extract_type]--> starting extraction of type: 'a, in env: EnvCompletionOtherFile. Has type arg ctx: false +[extract_type]--> starting extraction of type: 'a, in env: EnvCompletionOtherFile. Has type arg ctx: false +[extract_type]--> found type variable: 'a. Trying to instantiate with no type args ctx +[extract_type]--> could not instantiate 'a. Skipping. Completable: Cpath Value[Second] Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives @@ -332,9 +425,12 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[res2] Path res2 +[extract_type]--> starting extraction of type: EnvCompletionOtherFile.someRecord, in env: EnvCompletion. Has type arg ctx: false [extract_type]--> digging for type EnvCompletionOtherFile.someRecord in EnvCompletion [extract_type]--> found record -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: EnvCompletion. Has type arg ctx: true +[nested]--> Type arg context. env: EnvCompletionOtherFile, typeArgs: things2, typeParams: 'thing +[nested]--> reached end of pattern, returning type [{ "label": "{}", "kind": 22, @@ -353,9 +449,14 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[res2] Path res2 +[extract_type]--> starting extraction of type: EnvCompletionOtherFile.someRecord, in env: EnvCompletion. Has type arg ctx: false [extract_type]--> digging for type EnvCompletionOtherFile.someRecord in EnvCompletion [extract_type]--> found record -[extract_type]--> digging for type EnvCompletionOtherFile.someRecord in EnvCompletion +[nested]--> running nested in env: EnvCompletion. Has type arg ctx: true +[nested]--> Type arg context. env: EnvCompletionOtherFile, typeArgs: things2, typeParams: 'thing +[extract_type]--> starting extraction of type: EnvCompletionOtherFile.someRecord, in env: EnvCompletionOtherFile. Has type arg ctx: true +[extract_type]--> Type arg context. env: EnvCompletionOtherFile, typeArgs: things2, typeParams: 'thing +[extract_type]--> digging for type EnvCompletionOtherFile.someRecord in EnvCompletionOtherFile [extract_type]--> found record [{ "label": "name", @@ -384,13 +485,38 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[res2] Path res2 +[extract_type]--> starting extraction of type: EnvCompletionOtherFile.someRecord, in env: EnvCompletion. Has type arg ctx: false [extract_type]--> digging for type EnvCompletionOtherFile.someRecord in EnvCompletion [extract_type]--> found record -[nested_expr]--> trying to move into record field -[nested_expr]--> found record field type -[nested_expr]--> extracting from type 'thing in env EnvCompletion -[extract_type]--> miss -[] +[nested]--> running nested in env: EnvCompletion. Has type arg ctx: true +[nested]--> Type arg context. env: EnvCompletionOtherFile, typeArgs: things2, typeParams: 'thing +[nested]--> trying to move into record field +[nested]--> found record field type +[nested]--> extracting from type 'thing in env EnvCompletionOtherFile +[extract_type]--> starting extraction of type: 'thing, in env: EnvCompletionOtherFile. Has type arg ctx: true +[extract_type]--> Type arg context. env: EnvCompletionOtherFile, typeArgs: things2, typeParams: 'thing +[extract_type]--> starting extraction of type: 'thing, in env: EnvCompletionOtherFile. Has type arg ctx: true +[extract_type]--> Type arg context. env: EnvCompletionOtherFile, typeArgs: things2, typeParams: 'thing +[extract_type]--> starting extraction of type: 'thing, in env: EnvCompletionOtherFile. Has type arg ctx: true +[extract_type]--> Type arg context. env: EnvCompletionOtherFile, typeArgs: things2, typeParams: 'thing +[extract_type]--> found type variable: 'thing. Trying to instantiate with Type arg context. env: EnvCompletionOtherFile, typeArgs: things2, typeParams: 'thing +[extract_type]--> SUCCEEDED instantiation, new type is: things2 +[extract_type]--> starting extraction of type: things2, in env: EnvCompletionOtherFile. Has type arg ctx: true +[extract_type]--> Type arg context. env: EnvCompletionOtherFile, typeArgs: things2, typeParams: 'thing +[extract_type]--> digging for type things2 in EnvCompletionOtherFile +[extract_type]--> found record +[nested]--> running nested in env: EnvCompletionOtherFile. Has type arg ctx: false +[nested]--> reached end of pattern, returning type +[{ + "label": "{}", + "kind": 22, + "tags": [], + "detail": "things2", + "documentation": null, + "sortText": "A", + "insertText": "{$0}", + "insertTextFormat": 2 + }] Complete src/EnvCompletion.res 61:31 posCursor:[61:31] posNoWhite:[61:30] Found pattern:[61:19->61:35] @@ -399,12 +525,38 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[res2] Path res2 +[extract_type]--> starting extraction of type: EnvCompletionOtherFile.someRecord, in env: EnvCompletion. Has type arg ctx: false [extract_type]--> digging for type EnvCompletionOtherFile.someRecord in EnvCompletion [extract_type]--> found record -[nested_expr]--> trying to move into record field -[nested_expr]--> found record field type -[nested_expr]--> extracting from type theVariant in env EnvCompletion -[extract_type]--> digging for type theVariant in EnvCompletion -[extract_type]--> found nothing when digging -[] +[nested]--> running nested in env: EnvCompletion. Has type arg ctx: true +[nested]--> Type arg context. env: EnvCompletionOtherFile, typeArgs: things2, typeParams: 'thing +[nested]--> trying to move into record field +[nested]--> found record field type +[nested]--> extracting from type theVariant in env EnvCompletionOtherFile +[extract_type]--> starting extraction of type: theVariant, in env: EnvCompletionOtherFile. Has type arg ctx: true +[extract_type]--> Type arg context. env: EnvCompletionOtherFile, typeArgs: things2, typeParams: 'thing +[extract_type]--> starting extraction of type: theVariant, in env: EnvCompletionOtherFile. Has type arg ctx: true +[extract_type]--> Type arg context. env: EnvCompletionOtherFile, typeArgs: things2, typeParams: 'thing +[extract_type]--> digging for type theVariant in EnvCompletionOtherFile +[extract_type]--> found variant +[nested]--> running nested in env: EnvCompletionOtherFile. Has type arg ctx: true +[nested]--> Type arg context. env: EnvCompletionOtherFile, typeArgs: things2, typeParams: 'thing +[nested]--> reached end of pattern, returning type +[{ + "label": "First", + "kind": 4, + "tags": [], + "detail": "First\n\ntype theVariant = First | Second(r1)", + "documentation": null, + "insertText": "First", + "insertTextFormat": 2 + }, { + "label": "Second(_)", + "kind": 4, + "tags": [], + "detail": "Second(r1)\n\ntype theVariant = First | Second(r1)", + "documentation": null, + "insertText": "Second(${1:_})", + "insertTextFormat": 2 + }] diff --git a/analysis/tests/src/expected/Fragment.res.txt b/analysis/tests/src/expected/Fragment.res.txt index bd32bb999..998da8502 100644 --- a/analysis/tests/src/expected/Fragment.res.txt +++ b/analysis/tests/src/expected/Fragment.res.txt @@ -19,7 +19,7 @@ Resolved opens 1 pervasives ContextPath CTypeAtPos() [extract_type]--> digging for type React.element in Fragment [extract_type]--> found type manifest -[extract_type]--> digging for type Pervasives.Jsx.element in Fragment +[extract_type]--> digging for type Pervasives.Jsx.element in React [extract_type]--> found something else when digging --> could not get completions for context path null diff --git a/analysis/tests/src/expected/Hover.res.txt b/analysis/tests/src/expected/Hover.res.txt index 28d476779..8a8a6aa14 100644 --- a/analysis/tests/src/expected/Hover.res.txt +++ b/analysis/tests/src/expected/Hover.res.txt @@ -259,6 +259,7 @@ Resolved opens 1 pervasives ContextPath CPatternPath(Value[x])->recordField(someField) ContextPath Value[x] Path x +[nested_pattern_path] [extract_type]--> digging for type recordWithDocstringField in Hover [extract_type]--> found record {"contents": {"kind": "markdown", "value": "```rescript\nbool\n```"}} diff --git a/analysis/tests/src/expected/Jsx2.res.txt b/analysis/tests/src/expected/Jsx2.res.txt index 26eb76d27..57dd27aea 100644 --- a/analysis/tests/src/expected/Jsx2.res.txt +++ b/analysis/tests/src/expected/Jsx2.res.txt @@ -12,7 +12,8 @@ Resolved opens 1 pervasives --> expression completion ContextPath CJsxPropValue [M] second Path M.make -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: Jsx2.M. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [] diff --git a/analysis/tests/src/expected/Reprod.res.txt b/analysis/tests/src/expected/Reprod.res.txt index 86314de7a..bb506d248 100644 --- a/analysis/tests/src/expected/Reprod.res.txt +++ b/analysis/tests/src/expected/Reprod.res.txt @@ -11,37 +11,176 @@ ContextPath Value[Query, use] Path Query.use --> found function type --> found function argument! -[extract_type]--> digging for type QueryFile.Types.variables in Reprod +[extract_type]--> digging for type QueryFile.Types.variables in Reprod.Query [extract_type]--> found record -[nested_expr]--> trying to move into record field -[nested_expr]--> found record field type -[nested_expr]--> extracting from type location in env Reprod -[extract_type]--> digging for type location in Reprod -[extract_type]--> found nothing when digging ---> could not resolve nested expression path -[] +[nested]--> running nested in env: Reprod.Query. Has type arg ctx: false +[nested]--> trying to move into record field +[nested]--> found record field type +[nested]--> extracting from type location in env QueryFile.Types +[extract_type]--> starting extraction of type: location, in env: QueryFile.Types. Has type arg ctx: false +[extract_type]--> starting extraction of type: location, in env: QueryFile.Types. Has type arg ctx: false +[extract_type]--> digging for type location in QueryFile.Types +[extract_type]--> found type manifest +[extract_type]--> starting extraction of type: SchemaAssets.input_Location, in env: QueryFile.Types. Has type arg ctx: false +[extract_type]--> digging for type SchemaAssets.input_Location in QueryFile.Types +[extract_type]--> found variant +[nested]--> running nested in env: QueryFile.Types. Has type arg ctx: false +[nested]--> trying to move into variant payload $0 of constructor 'ByAddress' +[nested]--> found constructor (Args type) +[nested]--> found arg of type: input_ByAddress +[extract_type]--> starting extraction of type: input_ByAddress, in env: SchemaAssets. Has type arg ctx: false +[extract_type]--> digging for type input_ByAddress in SchemaAssets +[extract_type]--> found record +[nested]--> extracted type, continuing descent +[nested]--> running nested in env: SchemaAssets. Has type arg ctx: false +[nested]--> reached end of pattern, returning type +--> found type in nested expression completion +[{ + "label": "{}", + "kind": 12, + "tags": [], + "detail": "input_ByAddress", + "documentation": null, + "sortText": "A", + "insertText": "{$0}", + "insertTextFormat": 2 + }] + +Complete src/Reprod.res 33:28 +posCursor:[33:28] posNoWhite:[33:27] Found pattern:[33:21->33:31] +Completable: Cpattern Value[record]->recordField(first) +Package opens Pervasives.JsxModules.place holder +Resolved opens 1 pervasives +ContextPath Value[record] +Path record +[extract_type]--> starting extraction of type: paramRecord, in env: Reprod. Has type arg ctx: false +[extract_type]--> digging for type paramRecord in Reprod +[extract_type]--> found record +[nested]--> running nested in env: Reprod. Has type arg ctx: true +[nested]--> Type arg context. env: Reprod, typeArgs: someVariant, QueryFile.Types.byAddress, typeParams: 'a, 'b +[nested]--> trying to move into record field +[nested]--> found record field type +[nested]--> extracting from type 'a in env Reprod +[extract_type]--> starting extraction of type: 'a, in env: Reprod. Has type arg ctx: true +[extract_type]--> Type arg context. env: Reprod, typeArgs: someVariant, QueryFile.Types.byAddress, typeParams: 'a, 'b +[extract_type]--> starting extraction of type: 'a, in env: Reprod. Has type arg ctx: true +[extract_type]--> Type arg context. env: Reprod, typeArgs: someVariant, QueryFile.Types.byAddress, typeParams: 'a, 'b +[extract_type]--> starting extraction of type: 'a, in env: Reprod. Has type arg ctx: true +[extract_type]--> Type arg context. env: Reprod, typeArgs: someVariant, QueryFile.Types.byAddress, typeParams: 'a, 'b +[extract_type]--> found type variable: 'a. Trying to instantiate with Type arg context. env: Reprod, typeArgs: someVariant, QueryFile.Types.byAddress, typeParams: 'a, 'b +[extract_type]--> SUCCEEDED instantiation, new type is: someVariant +[extract_type]--> starting extraction of type: someVariant, in env: Reprod. Has type arg ctx: true +[extract_type]--> Type arg context. env: Reprod, typeArgs: someVariant, QueryFile.Types.byAddress, typeParams: 'a, 'b +[extract_type]--> digging for type someVariant in Reprod +[extract_type]--> found variant +[nested]--> running nested in env: Reprod. Has type arg ctx: true +[nested]--> Type arg context. env: Reprod, typeArgs: someVariant, QueryFile.Types.byAddress, typeParams: 'a, 'b +[nested]--> reached end of pattern, returning type +[{ + "label": "One", + "kind": 4, + "tags": [], + "detail": "One\n\ntype someVariant = One | Two(bool) | Three(someRecord, bool)", + "documentation": null, + "insertText": "One", + "insertTextFormat": 2 + }, { + "label": "Two(_)", + "kind": 4, + "tags": [], + "detail": "Two(bool)\n\ntype someVariant = One | Two(bool) | Three(someRecord, bool)", + "documentation": null, + "insertText": "Two(${1:_})", + "insertTextFormat": 2 + }, { + "label": "Three(_, _)", + "kind": 4, + "tags": [], + "detail": "Three(someRecord, bool)\n\ntype someVariant = One | Two(bool) | Three(someRecord, bool)", + "documentation": null, + "insertText": "Three(${1:_}, ${2:_})", + "insertTextFormat": 2 + }] -Complete src/Reprod.res 25:21 -posCursor:[25:21] posNoWhite:[25:20] Found pattern:[25:18->25:22] -Ppat_construct Ok:[25:18->25:20] -posCursor:[25:21] posNoWhite:[25:20] Found pattern:[25:20->25:22] -Ppat_construct ():[25:20->25:22] +Complete src/Reprod.res 36:29 +posCursor:[36:29] posNoWhite:[36:28] Found pattern:[36:21->36:32] +Completable: Cpattern Value[record]->recordField(second) +Package opens Pervasives.JsxModules.place holder +Resolved opens 1 pervasives +ContextPath Value[record] +Path record +[extract_type]--> starting extraction of type: paramRecord, in env: Reprod. Has type arg ctx: false +[extract_type]--> digging for type paramRecord in Reprod +[extract_type]--> found record +[nested]--> running nested in env: Reprod. Has type arg ctx: true +[nested]--> Type arg context. env: Reprod, typeArgs: someVariant, QueryFile.Types.byAddress, typeParams: 'a, 'b +[nested]--> trying to move into record field +[nested]--> found record field type +[nested]--> extracting from type 'b in env Reprod +[extract_type]--> starting extraction of type: 'b, in env: Reprod. Has type arg ctx: true +[extract_type]--> Type arg context. env: Reprod, typeArgs: someVariant, QueryFile.Types.byAddress, typeParams: 'a, 'b +[extract_type]--> starting extraction of type: 'b, in env: Reprod. Has type arg ctx: true +[extract_type]--> Type arg context. env: Reprod, typeArgs: someVariant, QueryFile.Types.byAddress, typeParams: 'a, 'b +[extract_type]--> starting extraction of type: 'b, in env: Reprod. Has type arg ctx: true +[extract_type]--> Type arg context. env: Reprod, typeArgs: someVariant, QueryFile.Types.byAddress, typeParams: 'a, 'b +[extract_type]--> found type variable: 'b. Trying to instantiate with Type arg context. env: Reprod, typeArgs: someVariant, QueryFile.Types.byAddress, typeParams: 'a, 'b +[extract_type]--> SUCCEEDED instantiation, new type is: QueryFile.Types.byAddress +[extract_type]--> starting extraction of type: QueryFile.Types.byAddress, in env: Reprod. Has type arg ctx: true +[extract_type]--> Type arg context. env: Reprod, typeArgs: someVariant, QueryFile.Types.byAddress, typeParams: 'a, 'b +[extract_type]--> digging for type QueryFile.Types.byAddress in Reprod +[extract_type]--> found type manifest +[extract_type]--> starting extraction of type: SchemaAssets.input_ByAddress, in env: QueryFile.Types. Has type arg ctx: false +[extract_type]--> digging for type SchemaAssets.input_ByAddress in QueryFile.Types +[extract_type]--> found record +[nested]--> running nested in env: Reprod. Has type arg ctx: false +[nested]--> reached end of pattern, returning type +[{ + "label": "{}", + "kind": 22, + "tags": [], + "detail": "SchemaAssets.input_ByAddress", + "documentation": null, + "sortText": "A", + "insertText": "{$0}", + "insertTextFormat": 2 + }] + +Complete src/Reprod.res 43:21 +posCursor:[43:21] posNoWhite:[43:20] Found pattern:[43:18->43:22] +Ppat_construct Ok:[43:18->43:20] +posCursor:[43:21] posNoWhite:[43:20] Found pattern:[43:20->43:22] +Ppat_construct ():[43:20->43:22] Completable: Cpattern Value[res]->variantPayload::Ok($0) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[res] Path res +[extract_type]--> starting extraction of type: result, in env: Reprod. Has type arg ctx: false [extract_type]--> digging for type Pervasives.result in Reprod [extract_type]--> found type manifest -[extract_type]--> digging for type Belt.Result.t in Reprod +[extract_type]--> starting extraction of type: Belt.Result.t<'a, 'b>, in env: Pervasives. Has type arg ctx: true +[extract_type]--> Type arg context. env: Reprod, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b +[extract_type]--> digging for type Belt.Result.t in Pervasives [extract_type]--> found variant -[nested_expr]--> trying to move into variant payload $0 of constructor 'Ok' -[nested_expr]--> found constructor (Args type) -[nested_expr]--> found arg of type: 'a +[nested]--> running nested in env: Reprod. Has type arg ctx: true +[nested]--> Type arg context. env: Reprod, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b +[nested]--> trying to move into variant payload $0 of constructor 'Ok' +[nested]--> found constructor (Args type) +[nested]--> found arg of type: 'a +[extract_type]--> starting extraction of type: 'a, in env: Belt_Result. Has type arg ctx: true +[extract_type]--> Type arg context. env: Reprod, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b +[extract_type]--> starting extraction of type: 'a, in env: Belt_Result. Has type arg ctx: true +[extract_type]--> Type arg context. env: Reprod, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b +[extract_type]--> found type variable: 'a. Trying to instantiate with Type arg context. env: Reprod, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b +[extract_type]--> SUCCEEDED instantiation, new type is: someVariant +[extract_type]--> starting extraction of type: someVariant, in env: Reprod. Has type arg ctx: true +[extract_type]--> Type arg context. env: Reprod, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b [extract_type]--> digging for type someVariant in Reprod [extract_type]--> found variant -[nested_expr]--> extracted type, continuing descent -[nested_expr]--> reached end of pattern, returning type +[nested]--> extracted type, continuing descent +[nested]--> running nested in env: Belt_Result. Has type arg ctx: true +[nested]--> Type arg context. env: Reprod, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b +[nested]--> reached end of pattern, returning type [{ "label": "One", "kind": 4, @@ -68,27 +207,42 @@ Path res "insertTextFormat": 2 }] -Complete src/Reprod.res 28:24 -posCursor:[28:24] posNoWhite:[28:23] Found pattern:[28:18->28:25] -Ppat_construct Error:[28:18->28:23] -posCursor:[28:24] posNoWhite:[28:23] Found pattern:[28:23->28:25] -Ppat_construct ():[28:23->28:25] +Complete src/Reprod.res 46:24 +posCursor:[46:24] posNoWhite:[46:23] Found pattern:[46:18->46:25] +Ppat_construct Error:[46:18->46:23] +posCursor:[46:24] posNoWhite:[46:23] Found pattern:[46:23->46:25] +Ppat_construct ():[46:23->46:25] Completable: Cpattern Value[res]->variantPayload::Error($0) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[res] Path res +[extract_type]--> starting extraction of type: result, in env: Reprod. Has type arg ctx: false [extract_type]--> digging for type Pervasives.result in Reprod [extract_type]--> found type manifest -[extract_type]--> digging for type Belt.Result.t in Reprod +[extract_type]--> starting extraction of type: Belt.Result.t<'a, 'b>, in env: Pervasives. Has type arg ctx: true +[extract_type]--> Type arg context. env: Reprod, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b +[extract_type]--> digging for type Belt.Result.t in Pervasives [extract_type]--> found variant -[nested_expr]--> trying to move into variant payload $0 of constructor 'Error' -[nested_expr]--> found constructor (Args type) -[nested_expr]--> found arg of type: 'b +[nested]--> running nested in env: Reprod. Has type arg ctx: true +[nested]--> Type arg context. env: Reprod, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b +[nested]--> trying to move into variant payload $0 of constructor 'Error' +[nested]--> found constructor (Args type) +[nested]--> found arg of type: 'b +[extract_type]--> starting extraction of type: 'b, in env: Belt_Result. Has type arg ctx: true +[extract_type]--> Type arg context. env: Reprod, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b +[extract_type]--> starting extraction of type: 'b, in env: Belt_Result. Has type arg ctx: true +[extract_type]--> Type arg context. env: Reprod, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b +[extract_type]--> found type variable: 'b. Trying to instantiate with Type arg context. env: Reprod, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b +[extract_type]--> SUCCEEDED instantiation, new type is: somePolyVariant +[extract_type]--> starting extraction of type: somePolyVariant, in env: Reprod. Has type arg ctx: true +[extract_type]--> Type arg context. env: Reprod, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b [extract_type]--> digging for type somePolyVariant in Reprod [extract_type]--> found type manifest -[nested_expr]--> extracted type, continuing descent -[nested_expr]--> reached end of pattern, returning type +[extract_type]--> starting extraction of type: [#one | #three(someRecord, bool) | #two(bool)], in env: Reprod. Has type arg ctx: false +[nested]--> extracted type, continuing descent +[nested]--> running nested in env: Belt_Result. Has type arg ctx: false +[nested]--> reached end of pattern, returning type [{ "label": "#one", "kind": 4, @@ -115,3 +269,148 @@ Path res "insertTextFormat": 2 }] +Complete src/Reprod.res 51:24 +posCursor:[51:24] posNoWhite:[51:23] Found pattern:[51:21->51:25] +Ppat_construct Ok:[51:21->51:23] +posCursor:[51:24] posNoWhite:[51:23] Found pattern:[51:23->51:25] +Ppat_construct ():[51:23->51:25] +Completable: Cpattern Value[resOpt]->variantPayload::Ok($0) +Package opens Pervasives.JsxModules.place holder +Resolved opens 1 pervasives +ContextPath Value[resOpt] +Path resOpt +[extract_type]--> starting extraction of type: result, unit>, in env: Reprod. Has type arg ctx: false +[extract_type]--> digging for type Pervasives.result in Reprod +[extract_type]--> found type manifest +[extract_type]--> starting extraction of type: Belt.Result.t<'a, 'b>, in env: Pervasives. Has type arg ctx: true +[extract_type]--> Type arg context. env: Reprod, typeArgs: option, unit, typeParams: 'a, 'b +[extract_type]--> digging for type Belt.Result.t in Pervasives +[extract_type]--> found variant +[nested]--> running nested in env: Reprod. Has type arg ctx: true +[nested]--> Type arg context. env: Reprod, typeArgs: option, unit, typeParams: 'a, 'b +[nested]--> trying to move into variant payload $0 of constructor 'Ok' +[nested]--> found constructor (Args type) +[nested]--> found arg of type: 'a +[extract_type]--> starting extraction of type: 'a, in env: Belt_Result. Has type arg ctx: true +[extract_type]--> Type arg context. env: Reprod, typeArgs: option, unit, typeParams: 'a, 'b +[extract_type]--> starting extraction of type: 'a, in env: Belt_Result. Has type arg ctx: true +[extract_type]--> Type arg context. env: Reprod, typeArgs: option, unit, typeParams: 'a, 'b +[extract_type]--> found type variable: 'a. Trying to instantiate with Type arg context. env: Reprod, typeArgs: option, unit, typeParams: 'a, 'b +[extract_type]--> SUCCEEDED instantiation, new type is: option +[extract_type]--> starting extraction of type: option, in env: Reprod. Has type arg ctx: true +[extract_type]--> Type arg context. env: Reprod, typeArgs: option, unit, typeParams: 'a, 'b +[nested]--> extracted type, continuing descent +[nested]--> running nested in env: Belt_Result. Has type arg ctx: true +[nested]--> Type arg context. env: Reprod, typeArgs: option, unit, typeParams: 'a, 'b +[nested]--> reached end of pattern, returning type +[extract_type]--> digging for type someVariant in Reprod +[extract_type]--> found variant +[{ + "label": "None", + "kind": 12, + "tags": [], + "detail": "someVariant", + "documentation": null + }, { + "label": "Some(_)", + "kind": 12, + "tags": [], + "detail": "someVariant", + "documentation": null, + "insertText": "Some(${1:_})", + "insertTextFormat": 2 + }, { + "label": "Some(One)", + "kind": 4, + "tags": [], + "detail": "One\n\ntype someVariant = One | Two(bool) | Three(someRecord, bool)", + "documentation": null, + "insertText": "Some(One)", + "insertTextFormat": 2 + }, { + "label": "Some(Two(_))", + "kind": 4, + "tags": [], + "detail": "Two(bool)\n\ntype someVariant = One | Two(bool) | Three(someRecord, bool)", + "documentation": null, + "insertText": "Some(Two(${1:_}))", + "insertTextFormat": 2 + }, { + "label": "Some(Three(_, _))", + "kind": 4, + "tags": [], + "detail": "Three(someRecord, bool)\n\ntype someVariant = One | Two(bool) | Three(someRecord, bool)", + "documentation": null, + "insertText": "Some(Three(${1:_}, ${2:_}))", + "insertTextFormat": 2 + }] + +Complete src/Reprod.res 54:29 +posCursor:[54:29] posNoWhite:[54:28] Found pattern:[54:21->54:31] +Ppat_construct Ok:[54:21->54:23] +posCursor:[54:29] posNoWhite:[54:28] Found pattern:[54:24->54:30] +Ppat_construct Some:[54:24->54:28] +posCursor:[54:29] posNoWhite:[54:28] Found pattern:[54:28->54:30] +Ppat_construct ():[54:28->54:30] +Completable: Cpattern Value[resOpt]->variantPayload::Ok($0), variantPayload::Some($0) +Package opens Pervasives.JsxModules.place holder +Resolved opens 1 pervasives +ContextPath Value[resOpt] +Path resOpt +[extract_type]--> starting extraction of type: result, unit>, in env: Reprod. Has type arg ctx: false +[extract_type]--> digging for type Pervasives.result in Reprod +[extract_type]--> found type manifest +[extract_type]--> starting extraction of type: Belt.Result.t<'a, 'b>, in env: Pervasives. Has type arg ctx: true +[extract_type]--> Type arg context. env: Reprod, typeArgs: option, unit, typeParams: 'a, 'b +[extract_type]--> digging for type Belt.Result.t in Pervasives +[extract_type]--> found variant +[nested]--> running nested in env: Reprod. Has type arg ctx: true +[nested]--> Type arg context. env: Reprod, typeArgs: option, unit, typeParams: 'a, 'b +[nested]--> trying to move into variant payload $0 of constructor 'Ok' +[nested]--> found constructor (Args type) +[nested]--> found arg of type: 'a +[extract_type]--> starting extraction of type: 'a, in env: Belt_Result. Has type arg ctx: true +[extract_type]--> Type arg context. env: Reprod, typeArgs: option, unit, typeParams: 'a, 'b +[extract_type]--> starting extraction of type: 'a, in env: Belt_Result. Has type arg ctx: true +[extract_type]--> Type arg context. env: Reprod, typeArgs: option, unit, typeParams: 'a, 'b +[extract_type]--> found type variable: 'a. Trying to instantiate with Type arg context. env: Reprod, typeArgs: option, unit, typeParams: 'a, 'b +[extract_type]--> SUCCEEDED instantiation, new type is: option +[extract_type]--> starting extraction of type: option, in env: Reprod. Has type arg ctx: true +[extract_type]--> Type arg context. env: Reprod, typeArgs: option, unit, typeParams: 'a, 'b +[nested]--> extracted type, continuing descent +[nested]--> running nested in env: Belt_Result. Has type arg ctx: true +[nested]--> Type arg context. env: Reprod, typeArgs: option, unit, typeParams: 'a, 'b +[nested]--> moving into option Some +[extract_type]--> starting extraction of type: someVariant, in env: Reprod. Has type arg ctx: true +[extract_type]--> Type arg context. env: Reprod, typeArgs: option, unit, typeParams: 'a, 'b +[extract_type]--> digging for type someVariant in Reprod +[extract_type]--> found variant +[nested]--> running nested in env: Reprod. Has type arg ctx: true +[nested]--> Type arg context. env: Reprod, typeArgs: option, unit, typeParams: 'a, 'b +[nested]--> reached end of pattern, returning type +[{ + "label": "One", + "kind": 4, + "tags": [], + "detail": "One\n\ntype someVariant = One | Two(bool) | Three(someRecord, bool)", + "documentation": null, + "insertText": "One", + "insertTextFormat": 2 + }, { + "label": "Two(_)", + "kind": 4, + "tags": [], + "detail": "Two(bool)\n\ntype someVariant = One | Two(bool) | Three(someRecord, bool)", + "documentation": null, + "insertText": "Two(${1:_})", + "insertTextFormat": 2 + }, { + "label": "Three(_, _)", + "kind": 4, + "tags": [], + "detail": "Three(someRecord, bool)\n\ntype someVariant = One | Two(bool) | Three(someRecord, bool)", + "documentation": null, + "insertText": "Three(${1:_}, ${2:_})", + "insertTextFormat": 2 + }] + diff --git a/analysis/tests/src/expected/TypeAtPosCompletion.res.txt b/analysis/tests/src/expected/TypeAtPosCompletion.res.txt index 7d5733702..a87aed296 100644 --- a/analysis/tests/src/expected/TypeAtPosCompletion.res.txt +++ b/analysis/tests/src/expected/TypeAtPosCompletion.res.txt @@ -7,6 +7,8 @@ Resolved opens 1 pervasives ContextPath CTypeAtPos() [extract_type]--> digging for type optRecord in TypeAtPosCompletion [extract_type]--> found record +[nested]--> running nested in env: TypeAtPosCompletion. Has type arg ctx: false +[extract_type]--> starting extraction of type: optRecord, in env: TypeAtPosCompletion. Has type arg ctx: false [extract_type]--> digging for type optRecord in TypeAtPosCompletion [extract_type]--> found record --> found type in nested expression completion @@ -36,12 +38,16 @@ Resolved opens 1 pervasives ContextPath CTypeAtPos() [extract_type]--> digging for type someVariant in TypeAtPosCompletion [extract_type]--> found variant -[nested_expr]--> trying to move into variant payload $1 of constructor 'One' -[nested_expr]--> found constructor (Args type) -[nested_expr]--> found arg of type: optRecord +[nested]--> running nested in env: TypeAtPosCompletion. Has type arg ctx: false +[nested]--> trying to move into variant payload $1 of constructor 'One' +[nested]--> found constructor (Args type) +[nested]--> found arg of type: optRecord +[extract_type]--> starting extraction of type: optRecord, in env: TypeAtPosCompletion. Has type arg ctx: false [extract_type]--> digging for type optRecord in TypeAtPosCompletion [extract_type]--> found record -[nested_expr]--> extracted type, continuing descent +[nested]--> extracted type, continuing descent +[nested]--> running nested in env: TypeAtPosCompletion. Has type arg ctx: false +[extract_type]--> starting extraction of type: optRecord, in env: TypeAtPosCompletion. Has type arg ctx: false [extract_type]--> digging for type optRecord in TypeAtPosCompletion [extract_type]--> found record --> found type in nested expression completion @@ -66,9 +72,13 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives --> expression completion ContextPath CTypeAtPos() +[nested]--> running nested in env: TypeAtPosCompletion. Has type arg ctx: false +[extract_type]--> starting extraction of type: optRecord, in env: TypeAtPosCompletion. Has type arg ctx: false +[extract_type]--> starting extraction of type: optRecord, in env: TypeAtPosCompletion. Has type arg ctx: false [extract_type]--> digging for type optRecord in TypeAtPosCompletion [extract_type]--> found record -[nested_expr]--> reached end of pattern, returning type +[nested]--> running nested in env: TypeAtPosCompletion. Has type arg ctx: false +[nested]--> reached end of pattern, returning type --> found type in nested expression completion [{ "label": "{}", From 7923e3b3547896f1a481804239f6a55ed039668c Mon Sep 17 00:00:00 2001 From: Gabriel Nordeborn Date: Mon, 8 Jan 2024 18:57:05 +0100 Subject: [PATCH 07/17] cleanup and restore --- analysis/src/TypeUtils.ml | 47 +++-------- .../tests/src/expected/Completion.res.txt | 2 - .../expected/CompletionExpressions.res.txt | 79 ------------------- .../CompletionFunctionArguments.res.txt | 10 --- .../expected/CompletionInferValues.res.txt | 18 ----- .../src/expected/CompletionJsxProps.res.txt | 4 - .../src/expected/ExhaustiveSwitch.res.txt | 8 -- analysis/tests/src/expected/Fragment.res.txt | 4 - analysis/tests/src/expected/Hover.res.txt | 2 - analysis/tests/src/expected/Reprod.res.txt | 4 - .../src/expected/TypeAtPosCompletion.res.txt | 4 - analysis/tests/src/expected/Xform.res.txt | 1 - 12 files changed, 12 insertions(+), 171 deletions(-) diff --git a/analysis/src/TypeUtils.ml b/analysis/src/TypeUtils.ml index 869c5df10..3e22cd056 100644 --- a/analysis/src/TypeUtils.ml +++ b/analysis/src/TypeUtils.ml @@ -6,9 +6,8 @@ type typeArgContext = { typeParams: Types.type_expr list; } -let instantiateType ?(instantiateTypes = true) ~typeParams ~typeArgs - (t : Types.type_expr) = - if typeParams = [] || typeArgs = [] || instantiateTypes = false then t +let instantiateType ~typeParams ~typeArgs (t : Types.type_expr) = + if typeParams = [] || typeArgs = [] then t else let rec applySub tp ta t = match (tp, ta) with @@ -148,13 +147,13 @@ let rec extractObjectType ~env ~package (t : Types.type_expr) = | _ -> None) | _ -> None -let rec extractFunctionType ?(instantiateTypes = true) ~env ~package typ = +let rec extractFunctionType ~env ~package typ = let rec loop ~env acc (t : Types.type_expr) = match t.desc with | Tlink t1 | Tsubst t1 | Tpoly (t1, []) -> loop ~env acc t1 | Tarrow (label, tArg, tRet, _) -> loop ~env ((label, tArg) :: acc) tRet | Tconstr (Pident {name = "function$"}, [t; _], _) -> - extractFunctionType ~instantiateTypes ~env ~package t + extractFunctionType ~env ~package t | Tconstr (path, typeArgs, _) -> ( match References.digConstructor ~env ~package path with | Some @@ -162,9 +161,7 @@ let rec extractFunctionType ?(instantiateTypes = true) ~env ~package typ = { item = {decl = {type_manifest = Some t1; type_params = typeParams}}; } ) -> - let t1 = - t1 |> instantiateType ~instantiateTypes ~typeParams ~typeArgs - in + let t1 = t1 |> instantiateType ~typeParams ~typeArgs in loop ~env acc t1 | _ -> (List.rev acc, t)) | _ -> (List.rev acc, t) @@ -197,10 +194,7 @@ let rec extractFunctionType2 ?typeArgContext ~env ~package typ = loop ?typeArgContext ~env [] typ (** Pulls out a type we can complete from a type expr. *) -let rec extractType ?(instantiateTypes = true) ~env ~package - (t : Types.type_expr) = - let extractType = extractType ~instantiateTypes in - let instantiateType = instantiateType ~instantiateTypes in +let rec extractType ~env ~package (t : Types.type_expr) = match t.desc with | Tlink t1 | Tsubst t1 | Tpoly (t1, []) -> extractType ~env ~package t1 | Tconstr (Path.Pident {name = "option"}, [payloadTypeExpr], _) -> @@ -216,35 +210,24 @@ let rec extractType ?(instantiateTypes = true) ~env ~package | Tconstr (Path.Pident {name = "exn"}, [], _) -> Some (Texn env) | Tconstr (Pident {name = "function$"}, [t; _], _) -> ( (* Uncurried functions. *) - match extractFunctionType ~instantiateTypes t ~env ~package with + match extractFunctionType t ~env ~package with | args, tRet when args <> [] -> Some (Tfunction {env; args; typ = t; uncurried = true; returnType = tRet}) | _args, _tRet -> None) | Tconstr (path, typeArgs, _) -> ( - Debug.logVerbose - (Printf.sprintf "[extract_type]--> digging for type %s in %s" - (Path.name path) (Debug.debugPrintEnv env)); match References.digConstructor ~env ~package path with | Some (env, {item = {decl = {type_manifest = Some t1; type_params}}}) -> - Debug.logVerbose "[extract_type]--> found type manifest"; t1 - |> instantiateType ~typeParams:type_params - ~typeArgs (* TODO: Can remove instantiate here? *) + |> instantiateType ~typeParams:type_params ~typeArgs |> extractType ~env ~package | Some (env, {name; item = {decl; kind = Type.Variant constructors}}) -> - Debug.logVerbose "[extract_type]--> found variant"; Some (Tvariant {env; constructors; variantName = name.txt; variantDecl = decl}) | Some (env, {item = {kind = Record fields}}) -> - Debug.logVerbose "[extract_type]--> found record"; Some (Trecord {env; fields; definition = `TypeExpr t}) - | None -> - Debug.logVerbose "[extract_type]--> found nothing when digging"; - None - | _ -> - Debug.logVerbose "[extract_type]--> found something else when digging"; - None) + | None -> None + | _ -> None) | Ttuple expressions -> Some (Tuple (env, expressions, t)) | Tvariant {row_fields} -> let constructors = @@ -265,18 +248,12 @@ let rec extractType ?(instantiateTypes = true) ~env ~package in Some (Tpolyvariant {env; constructors; typeExpr = t}) | Tarrow _ -> ( - match extractFunctionType t ~instantiateTypes ~env ~package with + match extractFunctionType t ~env ~package with | args, tRet when args <> [] -> Some (Tfunction {env; args; typ = t; uncurried = false; returnType = tRet}) | _args, _tRet -> None) - | Tvar (Some varName) -> - Debug.logVerbose - (Printf.sprintf "[extract_type]--> found type variable: '%s" varName); - None - | _ -> - Debug.logVerbose "[extract_type]--> miss"; - None + | _ -> None let debugLogTypeArgContext {env; typeArgs; typeParams} = Printf.sprintf "Type arg context. env: %s, typeArgs: %s, typeParams: %s" diff --git a/analysis/tests/src/expected/Completion.res.txt b/analysis/tests/src/expected/Completion.res.txt index 6ec4c104b..0f7db5265 100644 --- a/analysis/tests/src/expected/Completion.res.txt +++ b/analysis/tests/src/expected/Completion.res.txt @@ -2219,8 +2219,6 @@ Path withUncurried [nested]--> running nested in env: Completion. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion -[extract_type]--> digging for type unit in Completion -[extract_type]--> found nothing when digging [{ "label": "(. v) => {}", "kind": 12, diff --git a/analysis/tests/src/expected/CompletionExpressions.res.txt b/analysis/tests/src/expected/CompletionExpressions.res.txt index 283c272ad..4961a1405 100644 --- a/analysis/tests/src/expected/CompletionExpressions.res.txt +++ b/analysis/tests/src/expected/CompletionExpressions.res.txt @@ -34,8 +34,6 @@ ContextPath Value[fnTakingRecord] Path fnTakingRecord --> found function type --> found function argument! -[extract_type]--> digging for type someRecord in CompletionExpressions -[extract_type]--> found record [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false [extract_type]--> digging for type someRecord in CompletionExpressions @@ -92,8 +90,6 @@ ContextPath Value[fnTakingRecord] Path fnTakingRecord --> found function type --> found function argument! -[extract_type]--> digging for type someRecord in CompletionExpressions -[extract_type]--> found record [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false [extract_type]--> digging for type someRecord in CompletionExpressions @@ -120,8 +116,6 @@ ContextPath Value[fnTakingRecord] Path fnTakingRecord --> found function type --> found function argument! -[extract_type]--> digging for type someRecord in CompletionExpressions -[extract_type]--> found record [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> trying to move into record field [nested]--> found record field type @@ -158,8 +152,6 @@ ContextPath Value[fnTakingRecord] Path fnTakingRecord --> found function type --> found function argument! -[extract_type]--> digging for type someRecord in CompletionExpressions -[extract_type]--> found record [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false [extract_type]--> digging for type someRecord in CompletionExpressions @@ -210,8 +202,6 @@ ContextPath Value[fnTakingRecord] Path fnTakingRecord --> found function type --> found function argument! -[extract_type]--> digging for type someRecord in CompletionExpressions -[extract_type]--> found record [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false [extract_type]--> digging for type someRecord in CompletionExpressions @@ -256,8 +246,6 @@ ContextPath Value[fnTakingRecord] Path fnTakingRecord --> found function type --> found function argument! -[extract_type]--> digging for type someRecord in CompletionExpressions -[extract_type]--> found record [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> trying to move into record field [nested]--> found record field type @@ -267,8 +255,6 @@ Path fnTakingRecord [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion -[extract_type]--> digging for type otherRecord in CompletionExpressions -[extract_type]--> found record [{ "label": "Some(nested)", "kind": 12, @@ -314,8 +300,6 @@ ContextPath Value[fnTakingRecord] Path fnTakingRecord --> found function type --> found function argument! -[extract_type]--> digging for type someRecord in CompletionExpressions -[extract_type]--> found record [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> trying to move into record field [nested]--> found record field type @@ -339,8 +323,6 @@ ContextPath Value[fnTakingRecord] Path fnTakingRecord --> found function type --> found function argument! -[extract_type]--> digging for type someRecord in CompletionExpressions -[extract_type]--> found record [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> trying to move into record field [nested]--> found record field type @@ -384,8 +366,6 @@ ContextPath Value[fnTakingRecord] Path fnTakingRecord --> found function type --> found function argument! -[extract_type]--> digging for type someRecord in CompletionExpressions -[extract_type]--> found record [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> trying to move into record field [nested]--> found record field type @@ -436,8 +416,6 @@ ContextPath Value[fnTakingRecord] Path fnTakingRecord --> found function type --> found function argument! -[extract_type]--> digging for type someRecord in CompletionExpressions -[extract_type]--> found record [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> trying to move into record field [nested]--> found record field type @@ -472,8 +450,6 @@ ContextPath Value[fnTakingRecord] Path fnTakingRecord --> found function type --> found function argument! -[extract_type]--> digging for type someRecord in CompletionExpressions -[extract_type]--> found record [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> trying to move into record field [nested]--> found record field type @@ -514,8 +490,6 @@ ContextPath Value[fnTakingRecord] Path fnTakingRecord --> found function type --> found function argument! -[extract_type]--> digging for type someRecord in CompletionExpressions -[extract_type]--> found record [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> trying to move into record field [nested]--> found record field type @@ -557,8 +531,6 @@ ContextPath Value[fnTakingRecord] Path fnTakingRecord --> found function type --> found function argument! -[extract_type]--> digging for type someRecord in CompletionExpressions -[extract_type]--> found record [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> trying to move into record field [nested]--> found record field type @@ -818,8 +790,6 @@ ContextPath Value[fnTakingRecord] Path fnTakingRecord --> found function type --> found function argument! -[extract_type]--> digging for type someRecord in CompletionExpressions -[extract_type]--> found record [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion @@ -844,8 +814,6 @@ ContextPath Value[fnTakingOtherRecord] Path fnTakingOtherRecord --> found function type --> found function argument! -[extract_type]--> digging for type otherRecord in CompletionExpressions -[extract_type]--> found record [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> trying to move into record field [nested]--> found record field type @@ -879,8 +847,6 @@ ContextPath Value[fnTakingRecordWithOptionalField] Path fnTakingRecordWithOptionalField --> found function type --> found function argument! -[extract_type]--> digging for type recordWithOptionalField in CompletionExpressions -[extract_type]--> found record [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> trying to move into record field [nested]--> found record field type @@ -916,8 +882,6 @@ ContextPath Value[fnTakingRecordWithOptVariant] Path fnTakingRecordWithOptVariant --> found function type --> found function argument! -[extract_type]--> digging for type recordWithOptVariant in CompletionExpressions -[extract_type]--> found record [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> trying to move into record field [nested]--> found record field type @@ -927,8 +891,6 @@ Path fnTakingRecordWithOptVariant [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion -[extract_type]--> digging for type someVariant in CompletionExpressions -[extract_type]--> found variant [{ "label": "Some(someVariant)", "kind": 12, @@ -990,8 +952,6 @@ ContextPath Value[fnTakingInlineRecord] Path fnTakingInlineRecord --> found function type --> found function argument! -[extract_type]--> digging for type variantWithInlineRecord in CompletionExpressions -[extract_type]--> found variant [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> trying to move into variant payload $0 of constructor 'WithInlineRecord' [nested]--> found constructor (inline record) @@ -1022,8 +982,6 @@ ContextPath Value[fnTakingInlineRecord] Path fnTakingInlineRecord --> found function type --> found function argument! -[extract_type]--> digging for type variantWithInlineRecord in CompletionExpressions -[extract_type]--> found variant [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> trying to move into variant payload $0 of constructor 'WithInlineRecord' [nested]--> found constructor (inline record) @@ -1062,8 +1020,6 @@ ContextPath Value[fnTakingInlineRecord] Path fnTakingInlineRecord --> found function type --> found function argument! -[extract_type]--> digging for type variantWithInlineRecord in CompletionExpressions -[extract_type]--> found variant [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> trying to move into variant payload $0 of constructor 'WithInlineRecord' [nested]--> found constructor (inline record) @@ -1090,8 +1046,6 @@ ContextPath Value[fnTakingInlineRecord] Path fnTakingInlineRecord --> found function type --> found function argument! -[extract_type]--> digging for type variantWithInlineRecord in CompletionExpressions -[extract_type]--> found variant [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> trying to move into variant payload $0 of constructor 'WithInlineRecord' [nested]--> found constructor (inline record) @@ -1130,8 +1084,6 @@ ContextPath Value[fnTakingInlineRecord] Path fnTakingInlineRecord --> found function type --> found function argument! -[extract_type]--> digging for type variantWithInlineRecord in CompletionExpressions -[extract_type]--> found variant [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> trying to move into variant payload $0 of constructor 'WithInlineRecord' [nested]--> found constructor (inline record) @@ -1178,8 +1130,6 @@ Path fnTakingCallback [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion -[extract_type]--> digging for type unit in CompletionExpressions -[extract_type]--> found nothing when digging [{ "label": "() => {}", "kind": 12, @@ -1225,8 +1175,6 @@ Path fnTakingCallback [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion -[extract_type]--> digging for type unit in CompletionExpressions -[extract_type]--> found nothing when digging [{ "label": "v => {}", "kind": 12, @@ -1254,8 +1202,6 @@ Path fnTakingCallback [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion -[extract_type]--> digging for type unit in CompletionExpressions -[extract_type]--> found nothing when digging [{ "label": "event => {}", "kind": 12, @@ -1283,8 +1229,6 @@ Path fnTakingCallback [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion -[extract_type]--> digging for type int in CompletionExpressions -[extract_type]--> found nothing when digging [{ "label": "(~on, ~off=?, variant) => {}", "kind": 12, @@ -1312,8 +1256,6 @@ Path fnTakingCallback [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion -[extract_type]--> digging for type unit in CompletionExpressions -[extract_type]--> found nothing when digging [{ "label": "(v1, v2, v3) => {}", "kind": 12, @@ -1341,8 +1283,6 @@ Path fnTakingCallback [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion -[extract_type]--> digging for type int in CompletionExpressions -[extract_type]--> found nothing when digging [{ "label": "(~on=?, ~off=?, ()) => {}", "kind": 12, @@ -1371,7 +1311,6 @@ ContextPath Value[Js, log] Path Js.log --> found function type --> found function argument! -[extract_type]--> found type variable: 'a --> could not get completions for context path [{ "label": "second2", @@ -1432,7 +1371,6 @@ Path takesCb [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion -[extract_type]--> miss [{ "label": "someTyp => {}", "kind": 12, @@ -1460,7 +1398,6 @@ Path takesCb2 [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion -[extract_type]--> miss [{ "label": "environment => {}", "kind": 12, @@ -1488,7 +1425,6 @@ Path takesCb3 [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion -[extract_type]--> miss [{ "label": "apiCallResult => {}", "kind": 12, @@ -1516,7 +1452,6 @@ Path takesCb4 [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion -[extract_type]--> miss [{ "label": "apiCallResult => {}", "kind": 12, @@ -1544,7 +1479,6 @@ Path takesCb5 [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion -[extract_type]--> miss [{ "label": "apiCallResults => {}", "kind": 12, @@ -1572,8 +1506,6 @@ Path commitLocalUpdate [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion -[extract_type]--> digging for type unit in CompletionExpressions -[extract_type]--> found nothing when digging [{ "label": "recordSourceSelectorProxy => {}", "kind": 12, @@ -1627,7 +1559,6 @@ Path Belt.Array.map [nested]--> running nested in env: Belt_Array. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion -[extract_type]--> found type variable: 'b [{ "label": "v => {}", "kind": 12, @@ -1652,8 +1583,6 @@ ContextPath Value[takesExotic] Path takesExotic --> found function type --> found function argument! -[extract_type]--> digging for type exoticPolyvariant in CompletionExpressions -[extract_type]--> found type manifest [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion @@ -1680,8 +1609,6 @@ ContextPath Value[fnTakingPolyVariant] Path fnTakingPolyVariant --> found function type --> found function argument! -[extract_type]--> digging for type somePolyVariant in CompletionExpressions -[extract_type]--> found type manifest [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion @@ -1724,8 +1651,6 @@ ContextPath Value[fnTakingPolyVariant] Path fnTakingPolyVariant --> found function type --> found function argument! -[extract_type]--> digging for type somePolyVariant in CompletionExpressions -[extract_type]--> found type manifest [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion @@ -1768,8 +1693,6 @@ ContextPath Value[fnTakingPolyVariant] Path fnTakingPolyVariant --> found function type --> found function argument! -[extract_type]--> digging for type somePolyVariant in CompletionExpressions -[extract_type]--> found type manifest [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion @@ -1796,8 +1719,6 @@ ContextPath Value[fnTakingPolyVariant] Path fnTakingPolyVariant --> found function type --> found function argument! -[extract_type]--> digging for type somePolyVariant in CompletionExpressions -[extract_type]--> found type manifest [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion diff --git a/analysis/tests/src/expected/CompletionFunctionArguments.res.txt b/analysis/tests/src/expected/CompletionFunctionArguments.res.txt index a46cc1ac8..8d9d20dd3 100644 --- a/analysis/tests/src/expected/CompletionFunctionArguments.res.txt +++ b/analysis/tests/src/expected/CompletionFunctionArguments.res.txt @@ -160,8 +160,6 @@ ContextPath Value[someFnTakingVariant] Path someFnTakingVariant --> found function type --> found function argument! -[extract_type]--> digging for type someVariant in CompletionFunctionArguments -[extract_type]--> found variant [nested]--> running nested in env: CompletionFunctionArguments. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion @@ -204,8 +202,6 @@ ContextPath Value[someFnTakingVariant] Path someFnTakingVariant --> found function type --> found function argument! -[extract_type]--> digging for type someVariant in CompletionFunctionArguments -[extract_type]--> found variant [nested]--> running nested in env: CompletionFunctionArguments. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion @@ -254,8 +250,6 @@ Path someFnTakingVariant [nested]--> running nested in env: CompletionFunctionArguments. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion -[extract_type]--> digging for type someVariant in CompletionFunctionArguments -[extract_type]--> found variant [{ "label": "Some(_)", "kind": 12, @@ -286,8 +280,6 @@ ContextPath Value[someFnTakingVariant] Path someFnTakingVariant --> found function type --> found function argument! -[extract_type]--> digging for type someVariant in CompletionFunctionArguments -[extract_type]--> found variant [nested]--> running nested in env: CompletionFunctionArguments. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion @@ -449,8 +441,6 @@ ContextPath Value[fnTakingRecord] Path fnTakingRecord --> found function type --> found function argument! -[extract_type]--> digging for type someRecord in CompletionFunctionArguments -[extract_type]--> found record [nested]--> running nested in env: CompletionFunctionArguments. Has type arg ctx: false [extract_type]--> starting extraction of type: someRecord, in env: CompletionFunctionArguments. Has type arg ctx: false [extract_type]--> digging for type someRecord in CompletionFunctionArguments diff --git a/analysis/tests/src/expected/CompletionInferValues.res.txt b/analysis/tests/src/expected/CompletionInferValues.res.txt index 2a94767a9..d8ce972b1 100644 --- a/analysis/tests/src/expected/CompletionInferValues.res.txt +++ b/analysis/tests/src/expected/CompletionInferValues.res.txt @@ -446,8 +446,6 @@ Path x ContextPath Type[someRecordWithNestedStuff] Path someRecordWithNestedStuff [nested_pattern_path] -[extract_type]--> digging for type someNestedRecord in CompletionInferValues -[extract_type]--> found record [nested_pattern_path] [{ "label": "name", @@ -589,8 +587,6 @@ ContextPath Type[otherNestedRecord] Path otherNestedRecord [nested_pattern_path] [nested_pattern_path] -[extract_type]--> digging for type someVariant in CompletionInferValues -[extract_type]--> found variant [nested_pattern_path] CPPipe env:CompletionInferValues Path Js.String2.slic @@ -623,8 +619,6 @@ ContextPath Type[otherNestedRecord] Path otherNestedRecord [nested_pattern_path] [nested_pattern_path] -[extract_type]--> digging for type somePolyVariant in CompletionInferValues -[extract_type]--> found type manifest [nested_pattern_path] CPPipe env:CompletionInferValues Path Js.String2.slic @@ -658,8 +652,6 @@ Path otherNestedRecord [nested_pattern_path] [nested_pattern_path] [nested_pattern_path] -[extract_type]--> digging for type someRecord in CompletionInferValues -[extract_type]--> found record CPPipe env:CompletionInferValues Path Js.String2.slic [{ @@ -791,8 +783,6 @@ Path fn2 --> found function type --> found function argument! [nested_pattern_path] -[extract_type]--> digging for type CompletionSupport.Nested.config in CompletionInferValues -[extract_type]--> found record CPPipe env:CompletionInferValues CPPipe type path:ReactDOM.Client.Root.t CPPipe pathFromEnv:ReactDOM.Client.Root found:false @@ -835,8 +825,6 @@ Path fn3 --> found function type --> found function argument! [nested_pattern_path] -[extract_type]--> digging for type sameFileRecord in CompletionInferValues -[extract_type]--> found record CPPipe env:CompletionInferValues CPPipe type path:CompletionSupport.Test.t CPPipe pathFromEnv:CompletionSupport.Test found:false @@ -929,8 +917,6 @@ Path CompletionSupport2.makeRenderer --> found function type --> found function argument! [nested_pattern_path] -[extract_type]--> digging for type Internal.prepareProps in CompletionSupport2 -[extract_type]--> found record [{ "label": "root", "kind": 5, @@ -963,10 +949,6 @@ Path CompletionSupport2.makeRenderer --> found function type --> found function argument! [nested_pattern_path] -[extract_type]--> digging for type Internal.prepareProps in CompletionSupport2 -[extract_type]--> found record -[extract_type]--> digging for type CompletionSupport.Nested.config in CompletionSupport2.Internal -[extract_type]--> found record [nested_pattern_path] CPPipe env:CompletionInferValues envFromCompletionItem:CompletionSupport2.Internal CPPipe type path:ReactDOM.Client.Root.t diff --git a/analysis/tests/src/expected/CompletionJsxProps.res.txt b/analysis/tests/src/expected/CompletionJsxProps.res.txt index 852276939..b70e1c7e7 100644 --- a/analysis/tests/src/expected/CompletionJsxProps.res.txt +++ b/analysis/tests/src/expected/CompletionJsxProps.res.txt @@ -53,8 +53,6 @@ Resolved opens 1 pervasives --> expression completion ContextPath CJsxPropValue [CompletionSupport, TestComponent] test Path CompletionSupport.TestComponent.make -[extract_type]--> digging for type testVariant in CompletionSupport.TestComponent -[extract_type]--> found variant [nested]--> running nested in env: CompletionSupport.TestComponent. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion @@ -220,8 +218,6 @@ Path Pervasives.JsxDOM.domProps [nested]--> running nested in env: CompletionJsxProps. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion -[extract_type]--> digging for type unit in CompletionJsxProps -[extract_type]--> found nothing when digging [{ "label": "event => {}", "kind": 12, diff --git a/analysis/tests/src/expected/ExhaustiveSwitch.res.txt b/analysis/tests/src/expected/ExhaustiveSwitch.res.txt index 6d1f614cd..71285318b 100644 --- a/analysis/tests/src/expected/ExhaustiveSwitch.res.txt +++ b/analysis/tests/src/expected/ExhaustiveSwitch.res.txt @@ -5,8 +5,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[withSomeVarian] Path withSomeVarian -[extract_type]--> digging for type someVariant in ExhaustiveSwitch -[extract_type]--> found variant [{ "label": "withSomeVariant", "kind": 12, @@ -31,8 +29,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[withSomePol] Path withSomePol -[extract_type]--> digging for type somePolyVariant in ExhaustiveSwitch -[extract_type]--> found type manifest [{ "label": "withSomePoly", "kind": 12, @@ -122,8 +118,6 @@ ContextPath Value[getV] Path getV Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives -[extract_type]--> digging for type someVariant in ExhaustiveSwitch -[extract_type]--> found variant Hit: Exhaustive switch {"start": {"line": 33, "character": 3}, "end": {"line": 33, "character": 10}} newText: @@ -143,8 +137,6 @@ ContextPath Value[vvv] Path vvv Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives -[extract_type]--> digging for type someVariant in ExhaustiveSwitch -[extract_type]--> found variant Hit: Exhaustive switch {"start": {"line": 36, "character": 3}, "end": {"line": 36, "character": 6}} newText: diff --git a/analysis/tests/src/expected/Fragment.res.txt b/analysis/tests/src/expected/Fragment.res.txt index 998da8502..d4e1186c5 100644 --- a/analysis/tests/src/expected/Fragment.res.txt +++ b/analysis/tests/src/expected/Fragment.res.txt @@ -17,10 +17,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives --> expression completion ContextPath CTypeAtPos() -[extract_type]--> digging for type React.element in Fragment -[extract_type]--> found type manifest -[extract_type]--> digging for type Pervasives.Jsx.element in React -[extract_type]--> found something else when digging --> could not get completions for context path null diff --git a/analysis/tests/src/expected/Hover.res.txt b/analysis/tests/src/expected/Hover.res.txt index 8a8a6aa14..a195e983b 100644 --- a/analysis/tests/src/expected/Hover.res.txt +++ b/analysis/tests/src/expected/Hover.res.txt @@ -260,8 +260,6 @@ ContextPath CPatternPath(Value[x])->recordField(someField) ContextPath Value[x] Path x [nested_pattern_path] -[extract_type]--> digging for type recordWithDocstringField in Hover -[extract_type]--> found record {"contents": {"kind": "markdown", "value": "```rescript\nbool\n```"}} Hover src/Hover.res 263:8 diff --git a/analysis/tests/src/expected/Reprod.res.txt b/analysis/tests/src/expected/Reprod.res.txt index bb506d248..bd4fc3141 100644 --- a/analysis/tests/src/expected/Reprod.res.txt +++ b/analysis/tests/src/expected/Reprod.res.txt @@ -11,8 +11,6 @@ ContextPath Value[Query, use] Path Query.use --> found function type --> found function argument! -[extract_type]--> digging for type QueryFile.Types.variables in Reprod.Query -[extract_type]--> found record [nested]--> running nested in env: Reprod.Query. Has type arg ctx: false [nested]--> trying to move into record field [nested]--> found record field type @@ -303,8 +301,6 @@ Path resOpt [nested]--> running nested in env: Belt_Result. Has type arg ctx: true [nested]--> Type arg context. env: Reprod, typeArgs: option, unit, typeParams: 'a, 'b [nested]--> reached end of pattern, returning type -[extract_type]--> digging for type someVariant in Reprod -[extract_type]--> found variant [{ "label": "None", "kind": 12, diff --git a/analysis/tests/src/expected/TypeAtPosCompletion.res.txt b/analysis/tests/src/expected/TypeAtPosCompletion.res.txt index a87aed296..894045030 100644 --- a/analysis/tests/src/expected/TypeAtPosCompletion.res.txt +++ b/analysis/tests/src/expected/TypeAtPosCompletion.res.txt @@ -5,8 +5,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives --> expression completion ContextPath CTypeAtPos() -[extract_type]--> digging for type optRecord in TypeAtPosCompletion -[extract_type]--> found record [nested]--> running nested in env: TypeAtPosCompletion. Has type arg ctx: false [extract_type]--> starting extraction of type: optRecord, in env: TypeAtPosCompletion. Has type arg ctx: false [extract_type]--> digging for type optRecord in TypeAtPosCompletion @@ -36,8 +34,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives --> expression completion ContextPath CTypeAtPos() -[extract_type]--> digging for type someVariant in TypeAtPosCompletion -[extract_type]--> found variant [nested]--> running nested in env: TypeAtPosCompletion. Has type arg ctx: false [nested]--> trying to move into variant payload $1 of constructor 'One' [nested]--> found constructor (Args type) diff --git a/analysis/tests/src/expected/Xform.res.txt b/analysis/tests/src/expected/Xform.res.txt index 79a0e52a6..0af705bff 100644 --- a/analysis/tests/src/expected/Xform.res.txt +++ b/analysis/tests/src/expected/Xform.res.txt @@ -7,7 +7,6 @@ ContextPath Value[kind] Path kind Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives -[extract_type]--> miss Hit: Replace with switch {"start": {"line": 6, "character": 0}, "end": {"line": 11, "character": 1}} newText: From 501c73ce813b809006223ed42c52f37f4d24044b Mon Sep 17 00:00:00 2001 From: Gabriel Nordeborn Date: Mon, 8 Jan 2024 19:13:24 +0100 Subject: [PATCH 08/17] restore merged functionality --- analysis/src/TypeUtils.ml | 8 ++++++ .../expected/CompletionExpressions.res.txt | 25 +++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/analysis/src/TypeUtils.ml b/analysis/src/TypeUtils.ml index 3e22cd056..ee07b53e2 100644 --- a/analysis/src/TypeUtils.ml +++ b/analysis/src/TypeUtils.ml @@ -226,6 +226,7 @@ let rec extractType ~env ~package (t : Types.type_expr) = {env; constructors; variantName = name.txt; variantDecl = decl}) | Some (env, {item = {kind = Record fields}}) -> Some (Trecord {env; fields; definition = `TypeExpr t}) + | Some (env, {item = {name = "t"}}) -> Some (TtypeT {env; path}) | None -> None | _ -> None) | Ttuple expressions -> Some (Tuple (env, expressions, t)) @@ -326,6 +327,13 @@ let rec extractType2 ?(typeArgContext : typeArgContext option) ~env ~package else None in Some (Trecord {env; fields; definition = `TypeExpr t}, typeArgContext) + | Some (env, {item = {name = "t"; decl = {type_params}}}) -> + let typeArgContext = + if List.length typeArgs > 0 then + Some {env; typeParams = type_params; typeArgs} + else None + in + Some (TtypeT {env; path}, typeArgContext) | None -> Debug.logVerbose "[extract_type]--> found nothing when digging"; None diff --git a/analysis/tests/src/expected/CompletionExpressions.res.txt b/analysis/tests/src/expected/CompletionExpressions.res.txt index 4961a1405..6923740f6 100644 --- a/analysis/tests/src/expected/CompletionExpressions.res.txt +++ b/analysis/tests/src/expected/CompletionExpressions.res.txt @@ -1737,8 +1737,19 @@ XXX Not found! Completable: Cexpression Type[withIntLocal]->recordField(superInt) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath Type[withIntLocal] Path withIntLocal +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> trying to move into record field +[nested]--> found record field type +[nested]--> extracting from type SuperInt.t in env CompletionExpressions +[extract_type]--> starting extraction of type: SuperInt.t, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: SuperInt.t, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> digging for type SuperInt.t in CompletionExpressions +[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false +[nested]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "SuperInt.make()", "kind": 12, @@ -1755,9 +1766,16 @@ Pexp_apply ...[309:3->309:35] (...[309:36->309:37]) Completable: Cexpression CArgument Value[CompletionSupport, makeTestHidden]($0) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +--> expression completion ContextPath CArgument Value[CompletionSupport, makeTestHidden]($0) +--> function argument: $0 ContextPath Value[CompletionSupport, makeTestHidden] Path CompletionSupport.makeTestHidden +--> found function type +--> found function argument! +[nested]--> running nested in env: CompletionSupport. Has type arg ctx: false +[nested]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "CompletionSupport.TestHidden.make()", "kind": 12, @@ -1775,9 +1793,16 @@ Completable: Cexpression CArgument Value[CompletionSupport, makeTestHidden]($0) Raw opens: 1 CompletionSupport.place holder Package opens Pervasives.JsxModules.place holder Resolved opens 2 pervasives CompletionSupport.res +--> expression completion ContextPath CArgument Value[CompletionSupport, makeTestHidden]($0) +--> function argument: $0 ContextPath Value[CompletionSupport, makeTestHidden] Path CompletionSupport.makeTestHidden +--> found function type +--> found function argument! +[nested]--> running nested in env: CompletionSupport. Has type arg ctx: false +[nested]--> reached end of pattern, returning type +--> found type in nested expression completion [{ "label": "TestHidden.make()", "kind": 12, From 554ed633e50b396025c9efc28a072bc6379ae6b6 Mon Sep 17 00:00:00 2001 From: Gabriel Nordeborn Date: Mon, 8 Jan 2024 19:26:16 +0100 Subject: [PATCH 09/17] cleanup usages of old extractType from outside of TypeUtils --- analysis/src/CompletionBackEnd.ml | 35 +-- analysis/src/TypeUtils.ml | 28 ++- analysis/src/Xform.ml | 16 +- .../tests/src/expected/Completion.res.txt | 5 +- .../expected/CompletionExpressions.res.txt | 207 ++++++++++++++++++ .../CompletionFunctionArguments.res.txt | 39 ++++ .../tests/src/expected/CompletionJsx.res.txt | 1 + .../src/expected/CompletionJsxProps.res.txt | 14 ++ .../src/expected/CompletionPattern.res.txt | 11 + .../expected/CompletionTypeAnnotation.res.txt | 2 + .../src/expected/ExhaustiveSwitch.res.txt | 25 ++- analysis/tests/src/expected/Fragment.res.txt | 7 + analysis/tests/src/expected/Jsx2.res.txt | 1 + analysis/tests/src/expected/Reprod.res.txt | 7 + .../src/expected/TypeAtPosCompletion.res.txt | 10 + analysis/tests/src/expected/Xform.res.txt | 4 + 16 files changed, 377 insertions(+), 35 deletions(-) diff --git a/analysis/src/CompletionBackEnd.ml b/analysis/src/CompletionBackEnd.ml index a245e060f..ef89ce3ed 100644 --- a/analysis/src/CompletionBackEnd.ml +++ b/analysis/src/CompletionBackEnd.ml @@ -637,8 +637,8 @@ let completionsGetCompletionType ~full = function | {Completion.kind = ObjLabel typ; env} :: _ | {Completion.kind = Field ({typ}, _); env} :: _ -> typ - |> TypeUtils.extractType ~env ~package:full.package - |> Option.map (fun typ -> (typ, env)) + |> TypeUtils.extractType2 ~env ~package:full.package + |> Option.map (fun (typ, _) -> (typ, env)) | {Completion.kind = Type typ; env} :: _ -> ( match TypeUtils.extractTypeFromResolvedType typ ~env ~full with | None -> None @@ -1311,13 +1311,13 @@ let rec completeTypedValue ~rawOpens ~full ~prefix ~completionContext ~mode | Toption (env, t) -> let innerType = match t with - | ExtractedType t -> Some t - | TypeExpr t -> t |> TypeUtils.extractType ~env ~package:full.package + | ExtractedType t -> Some (t, None) + | TypeExpr t -> t |> TypeUtils.extractType2 ~env ~package:full.package in let expandedCompletions = match innerType with | None -> [] - | Some innerType -> + | Some (innerType, _typeArgsContext) -> innerType |> completeTypedValue ~rawOpens ~full ~prefix ~completionContext ~mode |> List.map (fun (c : Completion.t) -> @@ -1355,15 +1355,15 @@ let rec completeTypedValue ~rawOpens ~full ~prefix ~completionContext ~mode completions @ expandedCompletions |> filterItems ~prefix | Tresult {env; okType; errorType} -> let okInnerType = - okType |> TypeUtils.extractType ~env ~package:full.package + okType |> TypeUtils.extractType2 ~env ~package:full.package in let errorInnerType = - errorType |> TypeUtils.extractType ~env ~package:full.package + errorType |> TypeUtils.extractType2 ~env ~package:full.package in let expandedOkCompletions = match okInnerType with | None -> [] - | Some innerType -> + | Some (innerType, _) -> innerType |> completeTypedValue ~rawOpens ~full ~prefix ~completionContext ~mode |> List.map (fun (c : Completion.t) -> @@ -1380,7 +1380,7 @@ let rec completeTypedValue ~rawOpens ~full ~prefix ~completionContext ~mode let expandedErrorCompletions = match errorInnerType with | None -> [] - | Some innerType -> + | Some (innerType, _) -> innerType |> completeTypedValue ~rawOpens ~full ~prefix ~completionContext ~mode |> List.map (fun (c : Completion.t) -> @@ -1557,8 +1557,8 @@ let rec completeTypedValue ~rawOpens ~full ~prefix ~completionContext ~mode "(" ^ if shouldPrintAsUncurried then ". " else "" ^ argsText ^ ")" in let isAsync = - match TypeUtils.extractType ~env ~package:full.package returnType with - | Some (Tpromise _) -> true + match TypeUtils.extractType2 ~env ~package:full.package returnType with + | Some (Tpromise _, _) -> true | _ -> false in let asyncPrefix = if isAsync then "async " else "" in @@ -1944,8 +1944,8 @@ let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover completable = |> List.map (fun (c : Completion.t) -> match c.kind with | Value typExpr -> ( - match typExpr |> TypeUtils.extractType ~env:c.env ~package with - | Some (Tvariant v) -> + match typExpr |> TypeUtils.extractType2 ~env:c.env ~package with + | Some (Tvariant v, _) -> withExhaustiveItem c ~cases: (v.constructors @@ -1955,7 +1955,7 @@ let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover completable = match constructor.args with | Args [] -> "" | _ -> "(_)")) - | Some (Tpolyvariant v) -> + | Some (Tpolyvariant v, _) -> withExhaustiveItem c ~cases: (v.constructors @@ -1965,11 +1965,12 @@ let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover completable = match constructor.args with | [] -> "" | _ -> "(_)")) - | Some (Toption (_env, _typ)) -> + | Some (Toption (_env, _typ), _) -> withExhaustiveItem c ~cases:["Some($1)"; "None"] ~startIndex:1 - | Some (Tresult _) -> + | Some (Tresult _, _) -> withExhaustiveItem c ~cases:["Ok($1)"; "Error($1)"] ~startIndex:1 - | Some (Tbool _) -> withExhaustiveItem c ~cases:["true"; "false"] + | Some (Tbool _, _) -> + withExhaustiveItem c ~cases:["true"; "false"] | _ -> [c]) | _ -> [c]) |> List.flatten diff --git a/analysis/src/TypeUtils.ml b/analysis/src/TypeUtils.ml index ee07b53e2..b5e068d62 100644 --- a/analysis/src/TypeUtils.ml +++ b/analysis/src/TypeUtils.ml @@ -6,6 +6,11 @@ type typeArgContext = { typeParams: Types.type_expr list; } +let getExtractedType maybeRes = + match maybeRes with + | None -> None + | Some (extractedType, _) -> Some extractedType + let instantiateType ~typeParams ~typeArgs (t : Types.type_expr) = if typeParams = [] || typeArgs = [] then t else @@ -295,8 +300,20 @@ let rec extractType2 ?(typeArgContext : typeArgContext option) ~env ~package Some (Tstring env, typeArgContext) | Tconstr (Path.Pident {name = "exn"}, [], _) -> Some (Texn env, typeArgContext) - | Tconstr (Pident {name = "function$"}, [t; _], _) -> - extractType ?typeArgContext ~env ~package t + | Tconstr (Pident {name = "function$"}, [t; _], _) -> ( + match extractFunctionType2 ?typeArgContext t ~env ~package with + | args, tRet, typeArgContext when args <> [] -> + Some + ( Tfunction {env; args; typ = t; uncurried = true; returnType = tRet}, + typeArgContext ) + | _args, _tRet, _typeArgContext -> None) + | Tarrow _ -> ( + match extractFunctionType2 ?typeArgContext t ~env ~package with + | args, tRet, typeArgContext when args <> [] -> + Some + ( Tfunction {env; args; typ = t; uncurried = false; returnType = tRet}, + typeArgContext ) + | _args, _tRet, _typeArgContext -> None) | Tconstr (path, typeArgs, _) -> ( Debug.logVerbose (Printf.sprintf "[extract_type]--> digging for type %s in %s" @@ -359,13 +376,6 @@ let rec extractType2 ?(typeArgContext : typeArgContext option) ~env ~package }) in Some (Tpolyvariant {env; constructors; typeExpr = t}, typeArgContext) - | Tarrow _ -> ( - match extractFunctionType2 ?typeArgContext t ~env ~package with - | args, tRet, typeArgContext when args <> [] -> - Some - ( Tfunction {env; args; typ = t; uncurried = true; returnType = tRet}, - typeArgContext ) - | _args, _tRet, _typeArgContext -> None) | Tvar (Some varName) -> ( Debug.logVerbose (Printf.sprintf diff --git a/analysis/src/Xform.ml b/analysis/src/Xform.ml index 4eb3e667c..fdb004584 100644 --- a/analysis/src/Xform.ml +++ b/analysis/src/Xform.ml @@ -297,7 +297,9 @@ module ExhaustiveSwitch = struct let extractedType = match typ with | ExtractedType t -> Some t - | TypeExpr t -> TypeUtils.extractType t ~env ~package:full.package + | TypeExpr t -> + TypeUtils.extractType2 t ~env ~package:full.package + |> TypeUtils.getExtractedType in extractedType | None -> None) @@ -326,13 +328,13 @@ module ExhaustiveSwitch = struct let expEndPos = Pos.ofLexing exp.pexp_loc.loc_end in (if expStartPos = startPos then - match !foundSelection with - | None, endExpr -> foundSelection := (Some exp, endExpr) - | _ -> ()); + match !foundSelection with + | None, endExpr -> foundSelection := (Some exp, endExpr) + | _ -> ()); (if expEndPos = endPos then - match !foundSelection with - | startExp, _ -> foundSelection := (startExp, Some exp)); + match !foundSelection with + | startExp, _ -> foundSelection := (startExp, Some exp)); Ast_iterator.default_iterator.expr iterator exp in @@ -668,7 +670,7 @@ let extractCodeActions ~path ~startPos ~endPos ~currentFile ~debug = ExhaustiveSwitch.xform ~printExpr ~path ~pos: (if startPos = endPos then Single startPos - else Range (startPos, endPos)) + else Range (startPos, endPos)) ~full ~structure ~codeActions ~debug ~currentFile | None -> () in diff --git a/analysis/tests/src/expected/Completion.res.txt b/analysis/tests/src/expected/Completion.res.txt index 0f7db5265..d837bd346 100644 --- a/analysis/tests/src/expected/Completion.res.txt +++ b/analysis/tests/src/expected/Completion.res.txt @@ -521,6 +521,7 @@ Resolved opens 1 pervasives --> expression completion ContextPath CJsxPropValue [O, Comp] second Path O.Comp.make +[extract_type]--> starting extraction of type: string, in env: Completion.O.Comp. Has type arg ctx: false [nested]--> running nested in env: Completion.O.Comp. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion @@ -2215,10 +2216,12 @@ Path withUncurried [nested]--> extracting from type (. int) => unit in env Completion [extract_type]--> starting extraction of type: (. int) => unit, in env: Completion. Has type arg ctx: false [extract_type]--> starting extraction of type: (. int) => unit, in env: Completion. Has type arg ctx: false -[extract_type]--> starting extraction of type: int => unit, in env: Completion. Has type arg ctx: false [nested]--> running nested in env: Completion. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion +[extract_type]--> starting extraction of type: unit, in env: Completion. Has type arg ctx: false +[extract_type]--> digging for type unit in Completion +[extract_type]--> found nothing when digging [{ "label": "(. v) => {}", "kind": 12, diff --git a/analysis/tests/src/expected/CompletionExpressions.res.txt b/analysis/tests/src/expected/CompletionExpressions.res.txt index 6923740f6..0316bee6c 100644 --- a/analysis/tests/src/expected/CompletionExpressions.res.txt +++ b/analysis/tests/src/expected/CompletionExpressions.res.txt @@ -34,6 +34,10 @@ ContextPath Value[fnTakingRecord] Path fnTakingRecord --> found function type --> found function argument! +[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> digging for type someRecord in CompletionExpressions +[extract_type]--> found record [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false [extract_type]--> digging for type someRecord in CompletionExpressions @@ -90,6 +94,10 @@ ContextPath Value[fnTakingRecord] Path fnTakingRecord --> found function type --> found function argument! +[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> digging for type someRecord in CompletionExpressions +[extract_type]--> found record [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false [extract_type]--> digging for type someRecord in CompletionExpressions @@ -116,6 +124,10 @@ ContextPath Value[fnTakingRecord] Path fnTakingRecord --> found function type --> found function argument! +[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> digging for type someRecord in CompletionExpressions +[extract_type]--> found record [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> trying to move into record field [nested]--> found record field type @@ -152,6 +164,10 @@ ContextPath Value[fnTakingRecord] Path fnTakingRecord --> found function type --> found function argument! +[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> digging for type someRecord in CompletionExpressions +[extract_type]--> found record [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false [extract_type]--> digging for type someRecord in CompletionExpressions @@ -202,6 +218,10 @@ ContextPath Value[fnTakingRecord] Path fnTakingRecord --> found function type --> found function argument! +[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> digging for type someRecord in CompletionExpressions +[extract_type]--> found record [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false [extract_type]--> digging for type someRecord in CompletionExpressions @@ -246,6 +266,10 @@ ContextPath Value[fnTakingRecord] Path fnTakingRecord --> found function type --> found function argument! +[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> digging for type someRecord in CompletionExpressions +[extract_type]--> found record [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> trying to move into record field [nested]--> found record field type @@ -255,6 +279,9 @@ Path fnTakingRecord [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion +[extract_type]--> starting extraction of type: otherRecord, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> digging for type otherRecord in CompletionExpressions +[extract_type]--> found record [{ "label": "Some(nested)", "kind": 12, @@ -300,6 +327,10 @@ ContextPath Value[fnTakingRecord] Path fnTakingRecord --> found function type --> found function argument! +[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> digging for type someRecord in CompletionExpressions +[extract_type]--> found record [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> trying to move into record field [nested]--> found record field type @@ -323,6 +354,10 @@ ContextPath Value[fnTakingRecord] Path fnTakingRecord --> found function type --> found function argument! +[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> digging for type someRecord in CompletionExpressions +[extract_type]--> found record [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> trying to move into record field [nested]--> found record field type @@ -366,6 +401,10 @@ ContextPath Value[fnTakingRecord] Path fnTakingRecord --> found function type --> found function argument! +[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> digging for type someRecord in CompletionExpressions +[extract_type]--> found record [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> trying to move into record field [nested]--> found record field type @@ -416,6 +455,10 @@ ContextPath Value[fnTakingRecord] Path fnTakingRecord --> found function type --> found function argument! +[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> digging for type someRecord in CompletionExpressions +[extract_type]--> found record [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> trying to move into record field [nested]--> found record field type @@ -450,6 +493,10 @@ ContextPath Value[fnTakingRecord] Path fnTakingRecord --> found function type --> found function argument! +[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> digging for type someRecord in CompletionExpressions +[extract_type]--> found record [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> trying to move into record field [nested]--> found record field type @@ -490,6 +537,10 @@ ContextPath Value[fnTakingRecord] Path fnTakingRecord --> found function type --> found function argument! +[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> digging for type someRecord in CompletionExpressions +[extract_type]--> found record [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> trying to move into record field [nested]--> found record field type @@ -531,6 +582,10 @@ ContextPath Value[fnTakingRecord] Path fnTakingRecord --> found function type --> found function argument! +[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> digging for type someRecord in CompletionExpressions +[extract_type]--> found record [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> trying to move into record field [nested]--> found record field type @@ -566,6 +621,8 @@ ContextPath Value[fnTakingArray] Path fnTakingArray --> found function type --> found function argument! +[extract_type]--> starting extraction of type: array>, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: array>, in env: CompletionExpressions. Has type arg ctx: false [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion @@ -593,11 +650,14 @@ ContextPath Value[fnTakingArray] Path fnTakingArray --> found function type --> found function argument! +[extract_type]--> starting extraction of type: array>, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: array>, in env: CompletionExpressions. Has type arg ctx: false [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [extract_type]--> starting extraction of type: option, in env: CompletionExpressions. Has type arg ctx: false [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion +[extract_type]--> starting extraction of type: bool, in env: CompletionExpressions. Has type arg ctx: false [{ "label": "None", "kind": 12, @@ -639,6 +699,8 @@ ContextPath Value[fnTakingArray] Path fnTakingArray --> found function type --> found function argument! +[extract_type]--> starting extraction of type: array>, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: array>, in env: CompletionExpressions. Has type arg ctx: false [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion @@ -663,6 +725,8 @@ ContextPath Value[fnTakingArray] Path fnTakingArray --> found function type --> found function argument! +[extract_type]--> starting extraction of type: array>, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: array>, in env: CompletionExpressions. Has type arg ctx: false [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [extract_type]--> starting extraction of type: option, in env: CompletionExpressions. Has type arg ctx: false [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false @@ -698,11 +762,14 @@ ContextPath Value[fnTakingArray] Path fnTakingArray --> found function type --> found function argument! +[extract_type]--> starting extraction of type: array>, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: array>, in env: CompletionExpressions. Has type arg ctx: false [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [extract_type]--> starting extraction of type: option, in env: CompletionExpressions. Has type arg ctx: false [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion +[extract_type]--> starting extraction of type: bool, in env: CompletionExpressions. Has type arg ctx: false [{ "label": "None", "kind": 12, @@ -744,11 +811,14 @@ ContextPath Value[fnTakingArray] Path fnTakingArray --> found function type --> found function argument! +[extract_type]--> starting extraction of type: array>, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: array>, in env: CompletionExpressions. Has type arg ctx: false [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [extract_type]--> starting extraction of type: option, in env: CompletionExpressions. Has type arg ctx: false [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion +[extract_type]--> starting extraction of type: bool, in env: CompletionExpressions. Has type arg ctx: false [{ "label": "None", "kind": 12, @@ -790,6 +860,10 @@ ContextPath Value[fnTakingRecord] Path fnTakingRecord --> found function type --> found function argument! +[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> digging for type someRecord in CompletionExpressions +[extract_type]--> found record [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion @@ -814,6 +888,10 @@ ContextPath Value[fnTakingOtherRecord] Path fnTakingOtherRecord --> found function type --> found function argument! +[extract_type]--> starting extraction of type: otherRecord, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: otherRecord, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> digging for type otherRecord in CompletionExpressions +[extract_type]--> found record [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> trying to move into record field [nested]--> found record field type @@ -847,6 +925,10 @@ ContextPath Value[fnTakingRecordWithOptionalField] Path fnTakingRecordWithOptionalField --> found function type --> found function argument! +[extract_type]--> starting extraction of type: recordWithOptionalField, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: recordWithOptionalField, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> digging for type recordWithOptionalField in CompletionExpressions +[extract_type]--> found record [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> trying to move into record field [nested]--> found record field type @@ -882,6 +964,10 @@ ContextPath Value[fnTakingRecordWithOptVariant] Path fnTakingRecordWithOptVariant --> found function type --> found function argument! +[extract_type]--> starting extraction of type: recordWithOptVariant, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: recordWithOptVariant, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> digging for type recordWithOptVariant in CompletionExpressions +[extract_type]--> found record [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> trying to move into record field [nested]--> found record field type @@ -891,6 +977,9 @@ Path fnTakingRecordWithOptVariant [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion +[extract_type]--> starting extraction of type: someVariant, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> digging for type someVariant in CompletionExpressions +[extract_type]--> found variant [{ "label": "Some(someVariant)", "kind": 12, @@ -952,6 +1041,10 @@ ContextPath Value[fnTakingInlineRecord] Path fnTakingInlineRecord --> found function type --> found function argument! +[extract_type]--> starting extraction of type: variantWithInlineRecord, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: variantWithInlineRecord, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> digging for type variantWithInlineRecord in CompletionExpressions +[extract_type]--> found variant [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> trying to move into variant payload $0 of constructor 'WithInlineRecord' [nested]--> found constructor (inline record) @@ -982,6 +1075,10 @@ ContextPath Value[fnTakingInlineRecord] Path fnTakingInlineRecord --> found function type --> found function argument! +[extract_type]--> starting extraction of type: variantWithInlineRecord, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: variantWithInlineRecord, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> digging for type variantWithInlineRecord in CompletionExpressions +[extract_type]--> found variant [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> trying to move into variant payload $0 of constructor 'WithInlineRecord' [nested]--> found constructor (inline record) @@ -1020,6 +1117,10 @@ ContextPath Value[fnTakingInlineRecord] Path fnTakingInlineRecord --> found function type --> found function argument! +[extract_type]--> starting extraction of type: variantWithInlineRecord, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: variantWithInlineRecord, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> digging for type variantWithInlineRecord in CompletionExpressions +[extract_type]--> found variant [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> trying to move into variant payload $0 of constructor 'WithInlineRecord' [nested]--> found constructor (inline record) @@ -1046,6 +1147,10 @@ ContextPath Value[fnTakingInlineRecord] Path fnTakingInlineRecord --> found function type --> found function argument! +[extract_type]--> starting extraction of type: variantWithInlineRecord, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: variantWithInlineRecord, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> digging for type variantWithInlineRecord in CompletionExpressions +[extract_type]--> found variant [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> trying to move into variant payload $0 of constructor 'WithInlineRecord' [nested]--> found constructor (inline record) @@ -1084,6 +1189,10 @@ ContextPath Value[fnTakingInlineRecord] Path fnTakingInlineRecord --> found function type --> found function argument! +[extract_type]--> starting extraction of type: variantWithInlineRecord, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: variantWithInlineRecord, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> digging for type variantWithInlineRecord in CompletionExpressions +[extract_type]--> found variant [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> trying to move into variant payload $0 of constructor 'WithInlineRecord' [nested]--> found constructor (inline record) @@ -1127,9 +1236,14 @@ ContextPath Value[fnTakingCallback] Path fnTakingCallback --> found function type --> found function argument! +[extract_type]--> starting extraction of type: unit => unit, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: unit => unit, in env: CompletionExpressions. Has type arg ctx: false [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion +[extract_type]--> starting extraction of type: unit, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> digging for type unit in CompletionExpressions +[extract_type]--> found nothing when digging [{ "label": "() => {}", "kind": 12, @@ -1154,6 +1268,8 @@ ContextPath Value[fnTakingCallback] Path fnTakingCallback --> found function type --> found function argument! +[extract_type]--> starting extraction of type: unit => unit, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: unit => unit, in env: CompletionExpressions. Has type arg ctx: false [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion @@ -1172,9 +1288,14 @@ ContextPath Value[fnTakingCallback] Path fnTakingCallback --> found function type --> found function argument! +[extract_type]--> starting extraction of type: bool => unit, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: bool => unit, in env: CompletionExpressions. Has type arg ctx: false [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion +[extract_type]--> starting extraction of type: unit, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> digging for type unit in CompletionExpressions +[extract_type]--> found nothing when digging [{ "label": "v => {}", "kind": 12, @@ -1199,9 +1320,14 @@ ContextPath Value[fnTakingCallback] Path fnTakingCallback --> found function type --> found function argument! +[extract_type]--> starting extraction of type: ReactEvent.Mouse.t => unit, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: ReactEvent.Mouse.t => unit, in env: CompletionExpressions. Has type arg ctx: false [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion +[extract_type]--> starting extraction of type: unit, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> digging for type unit in CompletionExpressions +[extract_type]--> found nothing when digging [{ "label": "event => {}", "kind": 12, @@ -1226,9 +1352,14 @@ ContextPath Value[fnTakingCallback] Path fnTakingCallback --> found function type --> found function argument! +[extract_type]--> starting extraction of type: (~on: bool, ~off: bool=?, variant) => int, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: (~on: bool, ~off: bool=?, variant) => int, in env: CompletionExpressions. Has type arg ctx: false [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion +[extract_type]--> starting extraction of type: int, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> digging for type int in CompletionExpressions +[extract_type]--> found nothing when digging [{ "label": "(~on, ~off=?, variant) => {}", "kind": 12, @@ -1253,9 +1384,14 @@ ContextPath Value[fnTakingCallback] Path fnTakingCallback --> found function type --> found function argument! +[extract_type]--> starting extraction of type: (bool, option, bool) => unit, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: (bool, option, bool) => unit, in env: CompletionExpressions. Has type arg ctx: false [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion +[extract_type]--> starting extraction of type: unit, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> digging for type unit in CompletionExpressions +[extract_type]--> found nothing when digging [{ "label": "(v1, v2, v3) => {}", "kind": 12, @@ -1280,9 +1416,14 @@ ContextPath Value[fnTakingCallback] Path fnTakingCallback --> found function type --> found function argument! +[extract_type]--> starting extraction of type: (~on: bool=?, ~off: bool=?, unit) => int, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: (~on: bool=?, ~off: bool=?, unit) => int, in env: CompletionExpressions. Has type arg ctx: false [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion +[extract_type]--> starting extraction of type: int, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> digging for type int in CompletionExpressions +[extract_type]--> found nothing when digging [{ "label": "(~on=?, ~off=?, ()) => {}", "kind": 12, @@ -1311,6 +1452,10 @@ ContextPath Value[Js, log] Path Js.log --> found function type --> found function argument! +[extract_type]--> starting extraction of type: 'a, in env: Js. Has type arg ctx: false +[extract_type]--> starting extraction of type: 'a, in env: Js. Has type arg ctx: false +[extract_type]--> found type variable: 'a. Trying to instantiate with no type args ctx +[extract_type]--> could not instantiate 'a. Skipping. --> could not get completions for context path [{ "label": "second2", @@ -1368,9 +1513,13 @@ ContextPath Value[takesCb] Path takesCb --> found function type --> found function argument! +[extract_type]--> starting extraction of type: someTyp => 'a, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: someTyp => 'a, in env: CompletionExpressions. Has type arg ctx: false [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion +[extract_type]--> starting extraction of type: 'a, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> miss [{ "label": "someTyp => {}", "kind": 12, @@ -1395,9 +1544,13 @@ ContextPath Value[takesCb2] Path takesCb2 --> found function type --> found function argument! +[extract_type]--> starting extraction of type: Environment.t => 'a, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: Environment.t => 'a, in env: CompletionExpressions. Has type arg ctx: false [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion +[extract_type]--> starting extraction of type: 'a, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> miss [{ "label": "environment => {}", "kind": 12, @@ -1422,9 +1575,13 @@ ContextPath Value[takesCb3] Path takesCb3 --> found function type --> found function argument! +[extract_type]--> starting extraction of type: apiCallResult => 'a, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: apiCallResult => 'a, in env: CompletionExpressions. Has type arg ctx: false [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion +[extract_type]--> starting extraction of type: 'a, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> miss [{ "label": "apiCallResult => {}", "kind": 12, @@ -1449,9 +1606,13 @@ ContextPath Value[takesCb4] Path takesCb4 --> found function type --> found function argument! +[extract_type]--> starting extraction of type: option => 'a, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: option => 'a, in env: CompletionExpressions. Has type arg ctx: false [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion +[extract_type]--> starting extraction of type: 'a, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> miss [{ "label": "apiCallResult => {}", "kind": 12, @@ -1476,9 +1637,13 @@ ContextPath Value[takesCb5] Path takesCb5 --> found function type --> found function argument! +[extract_type]--> starting extraction of type: array> => 'a, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: array> => 'a, in env: CompletionExpressions. Has type arg ctx: false [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion +[extract_type]--> starting extraction of type: 'a, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> miss [{ "label": "apiCallResults => {}", "kind": 12, @@ -1503,9 +1668,13 @@ ContextPath Value[commitLocalUpdate] Path commitLocalUpdate --> found function type --> found function argument! +[extract_type]--> starting extraction of type: RecordSourceSelectorProxy.t => unit, in env: CompletionExpressions. Has type arg ctx: false [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion +[extract_type]--> starting extraction of type: unit, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> digging for type unit in CompletionExpressions +[extract_type]--> found nothing when digging [{ "label": "recordSourceSelectorProxy => {}", "kind": 12, @@ -1530,9 +1699,12 @@ ContextPath Value[fnTakingAsyncCallback] Path fnTakingAsyncCallback --> found function type --> found function argument! +[extract_type]--> starting extraction of type: unit => promise, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: unit => promise, in env: CompletionExpressions. Has type arg ctx: false [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion +[extract_type]--> starting extraction of type: promise, in env: CompletionExpressions. Has type arg ctx: false [{ "label": "async () => {}", "kind": 12, @@ -1556,9 +1728,13 @@ ContextPath Value[Belt, Array, map] Path Belt.Array.map --> found function type --> found function argument! +[extract_type]--> starting extraction of type: 'a => 'b, in env: Belt_Array. Has type arg ctx: false [nested]--> running nested in env: Belt_Array. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion +[extract_type]--> starting extraction of type: 'b, in env: Belt_Array. Has type arg ctx: false +[extract_type]--> found type variable: 'b. Trying to instantiate with no type args ctx +[extract_type]--> could not instantiate 'b. Skipping. [{ "label": "v => {}", "kind": 12, @@ -1583,6 +1759,11 @@ ContextPath Value[takesExotic] Path takesExotic --> found function type --> found function argument! +[extract_type]--> starting extraction of type: exoticPolyvariant, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: exoticPolyvariant, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> digging for type exoticPolyvariant in CompletionExpressions +[extract_type]--> found type manifest +[extract_type]--> starting extraction of type: [#"some exotic"], in env: CompletionExpressions. Has type arg ctx: false [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion @@ -1609,6 +1790,11 @@ ContextPath Value[fnTakingPolyVariant] Path fnTakingPolyVariant --> found function type --> found function argument! +[extract_type]--> starting extraction of type: somePolyVariant, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: somePolyVariant, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> digging for type somePolyVariant in CompletionExpressions +[extract_type]--> found type manifest +[extract_type]--> starting extraction of type: [#one | #three(someRecord, bool) | #two(bool)], in env: CompletionExpressions. Has type arg ctx: false [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion @@ -1651,6 +1837,11 @@ ContextPath Value[fnTakingPolyVariant] Path fnTakingPolyVariant --> found function type --> found function argument! +[extract_type]--> starting extraction of type: somePolyVariant, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: somePolyVariant, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> digging for type somePolyVariant in CompletionExpressions +[extract_type]--> found type manifest +[extract_type]--> starting extraction of type: [#one | #three(someRecord, bool) | #two(bool)], in env: CompletionExpressions. Has type arg ctx: false [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion @@ -1693,6 +1884,11 @@ ContextPath Value[fnTakingPolyVariant] Path fnTakingPolyVariant --> found function type --> found function argument! +[extract_type]--> starting extraction of type: somePolyVariant, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: somePolyVariant, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> digging for type somePolyVariant in CompletionExpressions +[extract_type]--> found type manifest +[extract_type]--> starting extraction of type: [#one | #three(someRecord, bool) | #two(bool)], in env: CompletionExpressions. Has type arg ctx: false [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion @@ -1719,6 +1915,11 @@ ContextPath Value[fnTakingPolyVariant] Path fnTakingPolyVariant --> found function type --> found function argument! +[extract_type]--> starting extraction of type: somePolyVariant, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> starting extraction of type: somePolyVariant, in env: CompletionExpressions. Has type arg ctx: false +[extract_type]--> digging for type somePolyVariant in CompletionExpressions +[extract_type]--> found type manifest +[extract_type]--> starting extraction of type: [#one | #three(someRecord, bool) | #two(bool)], in env: CompletionExpressions. Has type arg ctx: false [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion @@ -1773,6 +1974,9 @@ ContextPath Value[CompletionSupport, makeTestHidden] Path CompletionSupport.makeTestHidden --> found function type --> found function argument! +[extract_type]--> starting extraction of type: TestHidden.t, in env: CompletionSupport. Has type arg ctx: false +[extract_type]--> starting extraction of type: TestHidden.t, in env: CompletionSupport. Has type arg ctx: false +[extract_type]--> digging for type TestHidden.t in CompletionSupport [nested]--> running nested in env: CompletionSupport. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion @@ -1800,6 +2004,9 @@ ContextPath Value[CompletionSupport, makeTestHidden] Path CompletionSupport.makeTestHidden --> found function type --> found function argument! +[extract_type]--> starting extraction of type: TestHidden.t, in env: CompletionSupport. Has type arg ctx: false +[extract_type]--> starting extraction of type: TestHidden.t, in env: CompletionSupport. Has type arg ctx: false +[extract_type]--> digging for type TestHidden.t in CompletionSupport [nested]--> running nested in env: CompletionSupport. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion diff --git a/analysis/tests/src/expected/CompletionFunctionArguments.res.txt b/analysis/tests/src/expected/CompletionFunctionArguments.res.txt index 8d9d20dd3..d6d6a6ccc 100644 --- a/analysis/tests/src/expected/CompletionFunctionArguments.res.txt +++ b/analysis/tests/src/expected/CompletionFunctionArguments.res.txt @@ -11,6 +11,8 @@ ContextPath Value[someFn] Path someFn --> found function type --> found function argument! +[extract_type]--> starting extraction of type: bool, in env: CompletionFunctionArguments. Has type arg ctx: false +[extract_type]--> starting extraction of type: bool, in env: CompletionFunctionArguments. Has type arg ctx: false [nested]--> running nested in env: CompletionFunctionArguments. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion @@ -41,6 +43,8 @@ ContextPath Value[someFn] Path someFn --> found function type --> found function argument! +[extract_type]--> starting extraction of type: bool, in env: CompletionFunctionArguments. Has type arg ctx: false +[extract_type]--> starting extraction of type: bool, in env: CompletionFunctionArguments. Has type arg ctx: false [nested]--> running nested in env: CompletionFunctionArguments. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion @@ -72,6 +76,8 @@ ContextPath Value[someFn] Path someFn --> found function type --> found function argument! +[extract_type]--> starting extraction of type: bool, in env: CompletionFunctionArguments. Has type arg ctx: false +[extract_type]--> starting extraction of type: bool, in env: CompletionFunctionArguments. Has type arg ctx: false [nested]--> running nested in env: CompletionFunctionArguments. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion @@ -106,6 +112,8 @@ ContextPath Value[someFn] Path someFn --> found function type --> found function argument! +[extract_type]--> starting extraction of type: bool, in env: CompletionFunctionArguments. Has type arg ctx: false +[extract_type]--> starting extraction of type: bool, in env: CompletionFunctionArguments. Has type arg ctx: false [nested]--> running nested in env: CompletionFunctionArguments. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion @@ -136,6 +144,8 @@ ContextPath Value[someOtherFn] Path someOtherFn --> found function type --> found function argument! +[extract_type]--> starting extraction of type: bool, in env: CompletionFunctionArguments. Has type arg ctx: false +[extract_type]--> starting extraction of type: bool, in env: CompletionFunctionArguments. Has type arg ctx: false [nested]--> running nested in env: CompletionFunctionArguments. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion @@ -160,6 +170,10 @@ ContextPath Value[someFnTakingVariant] Path someFnTakingVariant --> found function type --> found function argument! +[extract_type]--> starting extraction of type: someVariant, in env: CompletionFunctionArguments. Has type arg ctx: false +[extract_type]--> starting extraction of type: someVariant, in env: CompletionFunctionArguments. Has type arg ctx: false +[extract_type]--> digging for type someVariant in CompletionFunctionArguments +[extract_type]--> found variant [nested]--> running nested in env: CompletionFunctionArguments. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion @@ -202,6 +216,10 @@ ContextPath Value[someFnTakingVariant] Path someFnTakingVariant --> found function type --> found function argument! +[extract_type]--> starting extraction of type: someVariant, in env: CompletionFunctionArguments. Has type arg ctx: false +[extract_type]--> starting extraction of type: someVariant, in env: CompletionFunctionArguments. Has type arg ctx: false +[extract_type]--> digging for type someVariant in CompletionFunctionArguments +[extract_type]--> found variant [nested]--> running nested in env: CompletionFunctionArguments. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion @@ -247,9 +265,14 @@ ContextPath Value[someFnTakingVariant] Path someFnTakingVariant --> found function type --> found function argument! +[extract_type]--> starting extraction of type: option, in env: CompletionFunctionArguments. Has type arg ctx: false +[extract_type]--> starting extraction of type: option, in env: CompletionFunctionArguments. Has type arg ctx: false [nested]--> running nested in env: CompletionFunctionArguments. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion +[extract_type]--> starting extraction of type: someVariant, in env: CompletionFunctionArguments. Has type arg ctx: false +[extract_type]--> digging for type someVariant in CompletionFunctionArguments +[extract_type]--> found variant [{ "label": "Some(_)", "kind": 12, @@ -280,6 +303,10 @@ ContextPath Value[someFnTakingVariant] Path someFnTakingVariant --> found function type --> found function argument! +[extract_type]--> starting extraction of type: someVariant, in env: CompletionFunctionArguments. Has type arg ctx: false +[extract_type]--> starting extraction of type: someVariant, in env: CompletionFunctionArguments. Has type arg ctx: false +[extract_type]--> digging for type someVariant in CompletionFunctionArguments +[extract_type]--> found variant [nested]--> running nested in env: CompletionFunctionArguments. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion @@ -325,6 +352,8 @@ ContextPath Value[someOtherFn] Path someOtherFn --> found function type --> found function argument! +[extract_type]--> starting extraction of type: bool, in env: CompletionFunctionArguments. Has type arg ctx: false +[extract_type]--> starting extraction of type: bool, in env: CompletionFunctionArguments. Has type arg ctx: false [nested]--> running nested in env: CompletionFunctionArguments. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion @@ -355,6 +384,8 @@ ContextPath Value[someOtherFn] Path someOtherFn --> found function type --> found function argument! +[extract_type]--> starting extraction of type: bool, in env: CompletionFunctionArguments. Has type arg ctx: false +[extract_type]--> starting extraction of type: bool, in env: CompletionFunctionArguments. Has type arg ctx: false [nested]--> running nested in env: CompletionFunctionArguments. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion @@ -384,6 +415,8 @@ ContextPath Value[someOtherFn] Path someOtherFn --> found function type --> found function argument! +[extract_type]--> starting extraction of type: bool, in env: CompletionFunctionArguments. Has type arg ctx: false +[extract_type]--> starting extraction of type: bool, in env: CompletionFunctionArguments. Has type arg ctx: false [nested]--> running nested in env: CompletionFunctionArguments. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion @@ -415,6 +448,8 @@ ContextPath Value[fnTakingTuple] Path fnTakingTuple --> found function type --> found function argument! +[extract_type]--> starting extraction of type: (int, int, float), in env: CompletionFunctionArguments. Has type arg ctx: false +[extract_type]--> starting extraction of type: (int, int, float), in env: CompletionFunctionArguments. Has type arg ctx: false [nested]--> running nested in env: CompletionFunctionArguments. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion @@ -441,6 +476,10 @@ ContextPath Value[fnTakingRecord] Path fnTakingRecord --> found function type --> found function argument! +[extract_type]--> starting extraction of type: someRecord, in env: CompletionFunctionArguments. Has type arg ctx: false +[extract_type]--> starting extraction of type: someRecord, in env: CompletionFunctionArguments. Has type arg ctx: false +[extract_type]--> digging for type someRecord in CompletionFunctionArguments +[extract_type]--> found record [nested]--> running nested in env: CompletionFunctionArguments. Has type arg ctx: false [extract_type]--> starting extraction of type: someRecord, in env: CompletionFunctionArguments. Has type arg ctx: false [extract_type]--> digging for type someRecord in CompletionFunctionArguments diff --git a/analysis/tests/src/expected/CompletionJsx.res.txt b/analysis/tests/src/expected/CompletionJsx.res.txt index 54348f778..45f9b7465 100644 --- a/analysis/tests/src/expected/CompletionJsx.res.txt +++ b/analysis/tests/src/expected/CompletionJsx.res.txt @@ -482,6 +482,7 @@ Resolved opens 1 pervasives --> expression completion ContextPath CJsxPropValue [SomeComponent] someProp Path SomeComponent.make +[extract_type]--> starting extraction of type: string, in env: CompletionJsx.SomeComponent. Has type arg ctx: false [nested]--> running nested in env: CompletionJsx.SomeComponent. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion diff --git a/analysis/tests/src/expected/CompletionJsxProps.res.txt b/analysis/tests/src/expected/CompletionJsxProps.res.txt index b70e1c7e7..daab7d244 100644 --- a/analysis/tests/src/expected/CompletionJsxProps.res.txt +++ b/analysis/tests/src/expected/CompletionJsxProps.res.txt @@ -7,6 +7,7 @@ Resolved opens 1 pervasives --> expression completion ContextPath CJsxPropValue [CompletionSupport, TestComponent] on Path CompletionSupport.TestComponent.make +[extract_type]--> starting extraction of type: bool, in env: CompletionSupport.TestComponent. Has type arg ctx: false [nested]--> running nested in env: CompletionSupport.TestComponent. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion @@ -33,6 +34,7 @@ Resolved opens 1 pervasives --> expression completion ContextPath CJsxPropValue [CompletionSupport, TestComponent] on Path CompletionSupport.TestComponent.make +[extract_type]--> starting extraction of type: bool, in env: CompletionSupport.TestComponent. Has type arg ctx: false [nested]--> running nested in env: CompletionSupport.TestComponent. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion @@ -53,6 +55,9 @@ Resolved opens 1 pervasives --> expression completion ContextPath CJsxPropValue [CompletionSupport, TestComponent] test Path CompletionSupport.TestComponent.make +[extract_type]--> starting extraction of type: testVariant, in env: CompletionSupport.TestComponent. Has type arg ctx: false +[extract_type]--> digging for type testVariant in CompletionSupport.TestComponent +[extract_type]--> found variant [nested]--> running nested in env: CompletionSupport.TestComponent. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion @@ -103,6 +108,7 @@ Resolved opens 1 pervasives --> expression completion ContextPath CJsxPropValue [CompletionSupport, TestComponent] polyArg Path CompletionSupport.TestComponent.make +[extract_type]--> starting extraction of type: [#one | #three(int, bool) | #two | #two2], in env: CompletionSupport.TestComponent. Has type arg ctx: false [nested]--> running nested in env: CompletionSupport.TestComponent. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion @@ -149,6 +155,7 @@ Resolved opens 1 pervasives --> expression completion ContextPath CJsxPropValue [CompletionSupport, TestComponent] polyArg Path CompletionSupport.TestComponent.make +[extract_type]--> starting extraction of type: [#one | #three(int, bool) | #two | #two2], in env: CompletionSupport.TestComponent. Has type arg ctx: false [nested]--> running nested in env: CompletionSupport.TestComponent. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion @@ -188,6 +195,7 @@ Resolved opens 1 pervasives ContextPath CJsxPropValue [div] muted Path ReactDOM.domProps Path Pervasives.JsxDOM.domProps +[extract_type]--> starting extraction of type: bool, in env: CompletionJsxProps. Has type arg ctx: false [nested]--> running nested in env: CompletionJsxProps. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion @@ -215,9 +223,13 @@ Resolved opens 1 pervasives ContextPath CJsxPropValue [div] onMouseEnter Path ReactDOM.domProps Path Pervasives.JsxDOM.domProps +[extract_type]--> starting extraction of type: JsxEventC.Mouse.t => unit, in env: CompletionJsxProps. Has type arg ctx: false [nested]--> running nested in env: CompletionJsxProps. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion +[extract_type]--> starting extraction of type: unit, in env: CompletionJsxProps. Has type arg ctx: false +[extract_type]--> digging for type unit in CompletionJsxProps +[extract_type]--> found nothing when digging [{ "label": "event => {}", "kind": 12, @@ -238,6 +250,7 @@ Resolved opens 1 pervasives --> expression completion ContextPath CJsxPropValue [CompletionSupport, TestComponent] testArr Path CompletionSupport.TestComponent.make +[extract_type]--> starting extraction of type: array, in env: CompletionSupport.TestComponent. Has type arg ctx: false [nested]--> running nested in env: CompletionSupport.TestComponent. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion @@ -261,6 +274,7 @@ Resolved opens 1 pervasives --> expression completion ContextPath CJsxPropValue [CompletionSupport, TestComponent] testArr Path CompletionSupport.TestComponent.make +[extract_type]--> starting extraction of type: array, in env: CompletionSupport.TestComponent. Has type arg ctx: false [nested]--> running nested in env: CompletionSupport.TestComponent. Has type arg ctx: false [extract_type]--> starting extraction of type: testVariant, in env: CompletionSupport.TestComponent. Has type arg ctx: false [extract_type]--> digging for type testVariant in CompletionSupport.TestComponent diff --git a/analysis/tests/src/expected/CompletionPattern.res.txt b/analysis/tests/src/expected/CompletionPattern.res.txt index 243c1a68c..b6c5a5c57 100644 --- a/analysis/tests/src/expected/CompletionPattern.res.txt +++ b/analysis/tests/src/expected/CompletionPattern.res.txt @@ -827,6 +827,7 @@ Path p [nested]--> extracted type, continuing descent [nested]--> running nested in env: CompletionPattern. Has type arg ctx: false [nested]--> reached end of pattern, returning type +[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false [{ "label": "None", "kind": 12, @@ -967,6 +968,7 @@ Path v [extract_type]--> starting extraction of type: option, in env: CompletionPattern. Has type arg ctx: false [nested]--> running nested in env: CompletionPattern. Has type arg ctx: false [nested]--> reached end of pattern, returning type +[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false [{ "label": "None", "kind": 12, @@ -1097,6 +1099,8 @@ Path s [extract_type]--> starting extraction of type: option, in env: CompletionPattern. Has type arg ctx: false [nested]--> running nested in env: CompletionPattern. Has type arg ctx: false [nested]--> reached end of pattern, returning type +[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false [{ "label": "None", "kind": 12, @@ -1140,6 +1144,8 @@ Path s [extract_type]--> starting extraction of type: option, in env: CompletionPattern. Has type arg ctx: false [nested]--> running nested in env: CompletionPattern. Has type arg ctx: false [nested]--> reached end of pattern, returning type +[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false [{ "label": "None", "kind": 12, @@ -1204,6 +1210,8 @@ Path s [extract_type]--> starting extraction of type: option, in env: CompletionPattern. Has type arg ctx: false [nested]--> running nested in env: CompletionPattern. Has type arg ctx: false [nested]--> reached end of pattern, returning type +[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false [{ "label": "None", "kind": 12, @@ -1419,6 +1427,8 @@ Path s [extract_type]--> starting extraction of type: option, in env: CompletionPattern. Has type arg ctx: false [nested]--> running nested in env: CompletionPattern. Has type arg ctx: false [nested]--> reached end of pattern, returning type +[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false +[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false [{ "label": "None", "kind": 12, @@ -1494,6 +1504,7 @@ ContextPath await Value[getThing](Nolabel) ContextPath Value[getThing](Nolabel) ContextPath Value[getThing] Path getThing +[extract_type]--> starting extraction of type: promise, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> starting extraction of type: someVariant, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> starting extraction of type: someVariant, in env: CompletionPattern. Has type arg ctx: false [extract_type]--> digging for type someVariant in CompletionPattern diff --git a/analysis/tests/src/expected/CompletionTypeAnnotation.res.txt b/analysis/tests/src/expected/CompletionTypeAnnotation.res.txt index 439fec817..ad0b8a485 100644 --- a/analysis/tests/src/expected/CompletionTypeAnnotation.res.txt +++ b/analysis/tests/src/expected/CompletionTypeAnnotation.res.txt @@ -168,6 +168,7 @@ Path someFunc [nested]--> running nested in env: CompletionTypeAnnotation. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion +[extract_type]--> starting extraction of type: bool, in env: CompletionTypeAnnotation. Has type arg ctx: false [{ "label": "(v1, v2) => {}", "kind": 12, @@ -214,6 +215,7 @@ Path someTuple [nested]--> running nested in env: CompletionTypeAnnotation. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion +[extract_type]--> starting extraction of type: bool, in env: CompletionTypeAnnotation. Has type arg ctx: false [{ "label": "None", "kind": 12, diff --git a/analysis/tests/src/expected/ExhaustiveSwitch.res.txt b/analysis/tests/src/expected/ExhaustiveSwitch.res.txt index 71285318b..efa4ffc4c 100644 --- a/analysis/tests/src/expected/ExhaustiveSwitch.res.txt +++ b/analysis/tests/src/expected/ExhaustiveSwitch.res.txt @@ -5,6 +5,10 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[withSomeVarian] Path withSomeVarian +[extract_type]--> starting extraction of type: someVariant, in env: ExhaustiveSwitch. Has type arg ctx: false +[extract_type]--> starting extraction of type: someVariant, in env: ExhaustiveSwitch. Has type arg ctx: false +[extract_type]--> digging for type someVariant in ExhaustiveSwitch +[extract_type]--> found variant [{ "label": "withSomeVariant", "kind": 12, @@ -29,6 +33,16 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[withSomePol] Path withSomePol +[extract_type]--> starting extraction of type: somePolyVariant, in env: ExhaustiveSwitch. Has type arg ctx: false +[extract_type]--> digging for type somePolyVariant in ExhaustiveSwitch +[extract_type]--> found type manifest +[extract_type]--> starting extraction of type: [ + | #"exotic ident" + | #one + | #"switch" + | #three(option) + | #two +], in env: ExhaustiveSwitch. Has type arg ctx: false [{ "label": "withSomePoly", "kind": 12, @@ -42,7 +56,7 @@ Path withSomePol "detail": "insert exhaustive switch for value", "documentation": null, "filterText": "withSomePoly", - "insertText": "withSomePoly {\n | #\"switch\" => ${1:failwith(\"todo\")}\n | #one => ${2:failwith(\"todo\")}\n | #three(_) => ${3:failwith(\"todo\")}\n | #two => ${4:failwith(\"todo\")}\n | #\"exotic ident\" => ${5:failwith(\"todo\")}\n }", + "insertText": "withSomePoly {\n | #\"exotic ident\" => ${1:failwith(\"todo\")}\n | #one => ${2:failwith(\"todo\")}\n | #\"switch\" => ${3:failwith(\"todo\")}\n | #three(_) => ${4:failwith(\"todo\")}\n | #two => ${5:failwith(\"todo\")}\n }", "insertTextFormat": 2 }] @@ -53,6 +67,8 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[someBoo] Path someBoo +[extract_type]--> starting extraction of type: bool, in env: ExhaustiveSwitch. Has type arg ctx: false +[extract_type]--> starting extraction of type: bool, in env: ExhaustiveSwitch. Has type arg ctx: false [{ "label": "someBool", "kind": 12, @@ -77,6 +93,8 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[someOp] Path someOp +[extract_type]--> starting extraction of type: option, in env: ExhaustiveSwitch. Has type arg ctx: false +[extract_type]--> starting extraction of type: option, in env: ExhaustiveSwitch. Has type arg ctx: false [{ "label": "someOpt", "kind": 12, @@ -118,6 +136,9 @@ ContextPath Value[getV] Path getV Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +[extract_type]--> starting extraction of type: someVariant, in env: ExhaustiveSwitch. Has type arg ctx: false +[extract_type]--> digging for type someVariant in ExhaustiveSwitch +[extract_type]--> found variant Hit: Exhaustive switch {"start": {"line": 33, "character": 3}, "end": {"line": 33, "character": 10}} newText: @@ -137,6 +158,8 @@ ContextPath Value[vvv] Path vvv Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +[extract_type]--> starting extraction of type: option, in env: ExhaustiveSwitch. Has type arg ctx: false +[extract_type]--> starting extraction of type: option, in env: ExhaustiveSwitch. Has type arg ctx: false Hit: Exhaustive switch {"start": {"line": 36, "character": 3}, "end": {"line": 36, "character": 6}} newText: diff --git a/analysis/tests/src/expected/Fragment.res.txt b/analysis/tests/src/expected/Fragment.res.txt index d4e1186c5..9e0f7910b 100644 --- a/analysis/tests/src/expected/Fragment.res.txt +++ b/analysis/tests/src/expected/Fragment.res.txt @@ -17,6 +17,13 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives --> expression completion ContextPath CTypeAtPos() +[extract_type]--> starting extraction of type: React.element, in env: Fragment. Has type arg ctx: false +[extract_type]--> starting extraction of type: React.element, in env: Fragment. Has type arg ctx: false +[extract_type]--> digging for type React.element in Fragment +[extract_type]--> found type manifest +[extract_type]--> starting extraction of type: Jsx.element, in env: React. Has type arg ctx: false +[extract_type]--> digging for type Pervasives.Jsx.element in React +[extract_type]--> found something else when digging --> could not get completions for context path null diff --git a/analysis/tests/src/expected/Jsx2.res.txt b/analysis/tests/src/expected/Jsx2.res.txt index 57dd27aea..77a889638 100644 --- a/analysis/tests/src/expected/Jsx2.res.txt +++ b/analysis/tests/src/expected/Jsx2.res.txt @@ -12,6 +12,7 @@ Resolved opens 1 pervasives --> expression completion ContextPath CJsxPropValue [M] second Path M.make +[extract_type]--> starting extraction of type: string, in env: Jsx2.M. Has type arg ctx: false [nested]--> running nested in env: Jsx2.M. Has type arg ctx: false [nested]--> reached end of pattern, returning type --> found type in nested expression completion diff --git a/analysis/tests/src/expected/Reprod.res.txt b/analysis/tests/src/expected/Reprod.res.txt index bd4fc3141..3b5d3d2ea 100644 --- a/analysis/tests/src/expected/Reprod.res.txt +++ b/analysis/tests/src/expected/Reprod.res.txt @@ -11,6 +11,10 @@ ContextPath Value[Query, use] Path Query.use --> found function type --> found function argument! +[extract_type]--> starting extraction of type: QueryFile.Types.variables, in env: Reprod.Query. Has type arg ctx: false +[extract_type]--> starting extraction of type: QueryFile.Types.variables, in env: Reprod.Query. Has type arg ctx: false +[extract_type]--> digging for type QueryFile.Types.variables in Reprod.Query +[extract_type]--> found record [nested]--> running nested in env: Reprod.Query. Has type arg ctx: false [nested]--> trying to move into record field [nested]--> found record field type @@ -301,6 +305,9 @@ Path resOpt [nested]--> running nested in env: Belt_Result. Has type arg ctx: true [nested]--> Type arg context. env: Reprod, typeArgs: option, unit, typeParams: 'a, 'b [nested]--> reached end of pattern, returning type +[extract_type]--> starting extraction of type: someVariant, in env: Reprod. Has type arg ctx: false +[extract_type]--> digging for type someVariant in Reprod +[extract_type]--> found variant [{ "label": "None", "kind": 12, diff --git a/analysis/tests/src/expected/TypeAtPosCompletion.res.txt b/analysis/tests/src/expected/TypeAtPosCompletion.res.txt index 894045030..9aeb76ef0 100644 --- a/analysis/tests/src/expected/TypeAtPosCompletion.res.txt +++ b/analysis/tests/src/expected/TypeAtPosCompletion.res.txt @@ -5,6 +5,10 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives --> expression completion ContextPath CTypeAtPos() +[extract_type]--> starting extraction of type: optRecord, in env: TypeAtPosCompletion. Has type arg ctx: false +[extract_type]--> starting extraction of type: optRecord, in env: TypeAtPosCompletion. Has type arg ctx: false +[extract_type]--> digging for type optRecord in TypeAtPosCompletion +[extract_type]--> found record [nested]--> running nested in env: TypeAtPosCompletion. Has type arg ctx: false [extract_type]--> starting extraction of type: optRecord, in env: TypeAtPosCompletion. Has type arg ctx: false [extract_type]--> digging for type optRecord in TypeAtPosCompletion @@ -34,6 +38,10 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives --> expression completion ContextPath CTypeAtPos() +[extract_type]--> starting extraction of type: someVariant, in env: TypeAtPosCompletion. Has type arg ctx: false +[extract_type]--> starting extraction of type: someVariant, in env: TypeAtPosCompletion. Has type arg ctx: false +[extract_type]--> digging for type someVariant in TypeAtPosCompletion +[extract_type]--> found variant [nested]--> running nested in env: TypeAtPosCompletion. Has type arg ctx: false [nested]--> trying to move into variant payload $1 of constructor 'One' [nested]--> found constructor (Args type) @@ -68,6 +76,8 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives --> expression completion ContextPath CTypeAtPos() +[extract_type]--> starting extraction of type: array, in env: TypeAtPosCompletion. Has type arg ctx: false +[extract_type]--> starting extraction of type: array, in env: TypeAtPosCompletion. Has type arg ctx: false [nested]--> running nested in env: TypeAtPosCompletion. Has type arg ctx: false [extract_type]--> starting extraction of type: optRecord, in env: TypeAtPosCompletion. Has type arg ctx: false [extract_type]--> starting extraction of type: optRecord, in env: TypeAtPosCompletion. Has type arg ctx: false diff --git a/analysis/tests/src/expected/Xform.res.txt b/analysis/tests/src/expected/Xform.res.txt index 0af705bff..852725180 100644 --- a/analysis/tests/src/expected/Xform.res.txt +++ b/analysis/tests/src/expected/Xform.res.txt @@ -7,6 +7,8 @@ ContextPath Value[kind] Path kind Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +[extract_type]--> starting extraction of type: 'a, in env: Xform. Has type arg ctx: false +[extract_type]--> miss Hit: Replace with switch {"start": {"line": 6, "character": 0}, "end": {"line": 11, "character": 1}} newText: @@ -108,6 +110,8 @@ ContextPath Value[name] Path name Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives +[extract_type]--> starting extraction of type: string, in env: Xform. Has type arg ctx: false +[extract_type]--> starting extraction of type: string, in env: Xform. Has type arg ctx: false Hit: Add braces to function {"start": {"line": 48, "character": 0}, "end": {"line": 48, "character": 25}} newText: From 6d5cd41bdbced4a3ccdb46de3bfbd084eadb8135 Mon Sep 17 00:00:00 2001 From: Gabriel Nordeborn Date: Mon, 8 Jan 2024 19:39:58 +0100 Subject: [PATCH 10/17] change to regular ifs --- analysis/src/CompletionBackEnd.ml | 30 +-- analysis/src/Debug.ml | 2 - analysis/src/TypeUtils.ml | 219 ++++++++++-------- .../tests/src/expected/Completion.res.txt | 3 - .../expected/CompletionExpressions.res.txt | 52 ----- .../CompletionFunctionArguments.res.txt | 14 -- .../tests/src/expected/CompletionJsx.res.txt | 1 - .../src/expected/CompletionJsxProps.res.txt | 9 - .../expected/CompletionTypeAnnotation.res.txt | 15 -- analysis/tests/src/expected/Fragment.res.txt | 1 - analysis/tests/src/expected/Jsx2.res.txt | 1 - analysis/tests/src/expected/Reprod.res.txt | 1 - .../src/expected/TypeAtPosCompletion.res.txt | 3 - 13 files changed, 141 insertions(+), 210 deletions(-) diff --git a/analysis/src/CompletionBackEnd.ml b/analysis/src/CompletionBackEnd.ml index ef89ce3ed..7ab70ecac 100644 --- a/analysis/src/CompletionBackEnd.ml +++ b/analysis/src/CompletionBackEnd.ml @@ -1061,11 +1061,11 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~pos ~env ~exact ~kind:(Completion.Value (Utils.unwrapIfOption typ)); ]) | CArgument {functionContextPath; argumentLabel} -> ( - Debug.logVerbose - (Printf.sprintf "--> function argument: %s" - (match argumentLabel with - | Labelled n | Optional n -> n - | Unlabelled {argumentPosition} -> "$" ^ string_of_int argumentPosition)); + if Debug.verbose () then + Printf.printf "--> function argument: %s\n" + (match argumentLabel with + | Labelled n | Optional n -> n + | Unlabelled {argumentPosition} -> "$" ^ string_of_int argumentPosition); let labels, env = match @@ -1075,10 +1075,11 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~pos ~env ~exact |> completionsGetCompletionType2 ~debug ~full ~opens ~rawOpens ~pos with | Some ((TypeExpr typ | ExtractedType (Tfunction {typ})), env) -> - Debug.logVerbose "--> found function type"; + if Debug.verbose () then print_endline "--> found function type"; (typ |> TypeUtils.getArgs ~full ~env, env) | _ -> - Debug.logVerbose "--> could not find function type"; + if Debug.verbose () then + print_endline "--> could not find function type"; ([], env) in let targetLabel = @@ -1100,10 +1101,11 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~pos ~env ~exact in match targetLabel with | None -> - Debug.logVerbose "--> could not look up function argument"; + if Debug.verbose () then + print_endline "--> could not look up function argument"; [] | Some (_, typ) -> - Debug.logVerbose "--> found function argument!"; + if Debug.verbose () then print_endline "--> found function argument!"; [ Completion.create "dummy" ~env ~kind: @@ -1839,7 +1841,6 @@ let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover completable = fallbackOrEmpty ~items ()) | None -> fallbackOrEmpty ()) | Cexpression {contextPath; prefix; nested} -> ( - Debug.logVerbose "--> expression completion"; (* Completions for local things like variables in scope, modules in the project, etc. We only add completions when there's a prefix of some sort we can filter on, since we know we're in some sort of context, and @@ -1857,15 +1858,18 @@ let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover completable = |> completionsGetCompletionType ~full with | None -> - Debug.logVerbose "--> could not get completions for context path"; + if Debug.verbose () then + print_endline "--> could not get completions for context path"; regularCompletions | Some (typ, env) -> ( match typ |> TypeUtils.resolveNested2 ~env ~full ~nested with | None -> - Debug.logVerbose "--> could not resolve nested expression path"; + if Debug.verbose () then + print_endline "--> could not resolve nested expression path"; regularCompletions | Some (typ, _env, completionContext) -> ( - Debug.logVerbose "--> found type in nested expression completion"; + if Debug.verbose () then + print_endline "--> found type in nested expression completion"; (* Wrap the insert text in braces when we're completing the root of a JSX prop value. *) let wrapInsertTextInBraces = diff --git a/analysis/src/Debug.ml b/analysis/src/Debug.ml index 69565a6cb..d19d7dfa5 100644 --- a/analysis/src/Debug.ml +++ b/analysis/src/Debug.ml @@ -7,8 +7,6 @@ let log s = | Regular | Verbose -> print_endline s | Off -> () -let logVerbose s = if !debugLevel = Verbose then print_endline s - let debugPrintEnv (env : SharedTypes.QueryEnv.t) = env.pathRev @ [env.file.moduleName] |> List.rev |> String.concat "." diff --git a/analysis/src/TypeUtils.ml b/analysis/src/TypeUtils.ml index b5e068d62..421dc1170 100644 --- a/analysis/src/TypeUtils.ml +++ b/analysis/src/TypeUtils.ml @@ -262,25 +262,25 @@ let rec extractType ~env ~package (t : Types.type_expr) = | _ -> None let debugLogTypeArgContext {env; typeArgs; typeParams} = - Printf.sprintf "Type arg context. env: %s, typeArgs: %s, typeParams: %s" + Printf.sprintf "Type arg context. env: %s, typeArgs: %s, typeParams: %s\n" (Debug.debugPrintEnv env) (typeArgs |> List.map Shared.typeToString |> String.concat ", ") (typeParams |> List.map Shared.typeToString |> String.concat ", ") let rec extractType2 ?(typeArgContext : typeArgContext option) ~env ~package (t : Types.type_expr) = - Debug.logVerbose - (Printf.sprintf - "[extract_type]--> starting extraction of type: %s, in env: %s. Has \ - type arg ctx: %b" - (Shared.typeToString t) (Debug.debugPrintEnv env) - (Option.is_some typeArgContext)); + if Debug.verbose () then + Printf.printf + "[extract_type]--> starting extraction of type: %s, in env: %s. Has type \ + arg ctx: %b\n" + (Shared.typeToString t) (Debug.debugPrintEnv env) + (Option.is_some typeArgContext); (match typeArgContext with | None -> () | Some typeArgContext -> - Debug.logVerbose - (Printf.sprintf "[extract_type]--> %s" - (debugLogTypeArgContext typeArgContext))); + if Debug.verbose () then + Printf.printf "[extract_type]--> %s" + (debugLogTypeArgContext typeArgContext)); let extractType = extractType2 in let instantiateType = instantiateType2 in match t.desc with @@ -315,14 +315,15 @@ let rec extractType2 ?(typeArgContext : typeArgContext option) ~env ~package typeArgContext ) | _args, _tRet, _typeArgContext -> None) | Tconstr (path, typeArgs, _) -> ( - Debug.logVerbose - (Printf.sprintf "[extract_type]--> digging for type %s in %s" - (Path.name path) (Debug.debugPrintEnv env)); + if Debug.verbose () then + Printf.printf "[extract_type]--> digging for type %s in %s\n" + (Path.name path) (Debug.debugPrintEnv env); match References.digConstructor ~env ~package path with | Some ( envFromDeclaration, {item = {decl = {type_manifest = Some t1; type_params}}} ) -> - Debug.logVerbose "[extract_type]--> found type manifest"; + if Debug.verbose () then + print_endline "[extract_type]--> found type manifest"; let typeArgContext = if List.length type_params > 0 then Some {env; typeParams = type_params; typeArgs} @@ -330,13 +331,13 @@ let rec extractType2 ?(typeArgContext : typeArgContext option) ~env ~package in t1 |> extractType ?typeArgContext ~env:envFromDeclaration ~package | Some (env, {name; item = {decl; kind = Type.Variant constructors}}) -> - Debug.logVerbose "[extract_type]--> found variant"; + if Debug.verbose () then print_endline "[extract_type]--> found variant"; Some ( Tvariant {env; constructors; variantName = name.txt; variantDecl = decl}, typeArgContext ) | Some (env, {item = {kind = Record fields; decl}}) -> - Debug.logVerbose "[extract_type]--> found record"; + if Debug.verbose () then print_endline "[extract_type]--> found record"; (* Need to create a new type arg context here because we're sending along a type expr that might have type vars. *) let typeArgContext = if List.length typeArgs > 0 then @@ -352,10 +353,12 @@ let rec extractType2 ?(typeArgContext : typeArgContext option) ~env ~package in Some (TtypeT {env; path}, typeArgContext) | None -> - Debug.logVerbose "[extract_type]--> found nothing when digging"; + if Debug.verbose () then + print_endline "[extract_type]--> found nothing when digging"; None | _ -> - Debug.logVerbose "[extract_type]--> found something else when digging"; + if Debug.verbose () then + print_endline "[extract_type]--> found something else when digging"; None) | Ttuple expressions -> Some (Tuple (env, expressions, t), typeArgContext) | Tvariant {row_fields} -> @@ -377,14 +380,14 @@ let rec extractType2 ?(typeArgContext : typeArgContext option) ~env ~package in Some (Tpolyvariant {env; constructors; typeExpr = t}, typeArgContext) | Tvar (Some varName) -> ( - Debug.logVerbose - (Printf.sprintf - "[extract_type]--> found type variable: '%s. Trying to instantiate %s" - varName - (match typeArgContext with - | None -> "with no type args ctx" - | Some typeArgContext -> - Printf.sprintf "with %s" (debugLogTypeArgContext typeArgContext))); + if Debug.verbose () then + Printf.printf + "[extract_type]--> found type variable: '%s. Trying to instantiate %s" + varName + (match typeArgContext with + | None -> "with no type args ctx\n" + | Some typeArgContext -> + Printf.sprintf "with %s" (debugLogTypeArgContext typeArgContext)); let instantiated = t |> instantiateType ?typeArgContext in let rec extractInstantiated t = @@ -394,15 +397,15 @@ let rec extractType2 ?(typeArgContext : typeArgContext option) ~env ~package in match extractInstantiated instantiated with | {desc = Tvar _} -> - Debug.logVerbose - (Printf.sprintf "[extract_type]--> could not instantiate '%s. Skipping." - varName); + if Debug.verbose () then + Printf.printf "[extract_type]--> could not instantiate '%s. Skipping.\n" + varName; None | _ -> - Debug.logVerbose - (Printf.sprintf - "[extract_type]--> SUCCEEDED instantiation, new type is: %s" - (Shared.typeToString instantiated)); + if Debug.verbose () then + Printf.printf + "[extract_type]--> SUCCEEDED instantiation, new type is: %s\n" + (Shared.typeToString instantiated); (* Use the env from instantiation if we managed to instantiate the type param *) let nextEnv = @@ -412,7 +415,7 @@ let rec extractType2 ?(typeArgContext : typeArgContext option) ~env ~package in instantiated |> extractType ?typeArgContext ~env:nextEnv ~package) | _ -> - Debug.logVerbose "[extract_type]--> miss"; + if Debug.verbose () then print_endline "[extract_type]--> miss"; None let findReturnTypeOfFunctionAtLoc loc ~(env : QueryEnv.t) ~full ~debug = @@ -544,7 +547,8 @@ type ctx = Rfield of string (** A record field of name *) let rec resolveNested ~env ~full ~nested ?ctx (typ : completionType) = match nested with | [] -> - Debug.logVerbose "[nested]--> reached end of pattern, returning type"; + if Debug.verbose () then + print_endline "[nested]--> reached end of pattern, returning type"; Some ( typ, env, @@ -555,10 +559,12 @@ let rec resolveNested ~env ~full ~nested ?ctx (typ : completionType) = | patternPath :: nested -> ( match (patternPath, typ) with | Completable.NTupleItem {itemNum}, Tuple (env, tupleItems, _) -> ( - Debug.logVerbose "[nested]--> trying to move into tuple"; + if Debug.verbose () then + print_endline "[nested]--> trying to move into tuple"; match List.nth_opt tupleItems itemNum with | None -> - Debug.logVerbose "[nested]--> tuple element not found"; + if Debug.verbose () then + print_endline "[nested]--> tuple element not found"; None | Some typ -> typ @@ -567,21 +573,25 @@ let rec resolveNested ~env ~full ~nested ?ctx (typ : completionType) = typ |> resolveNested ~env ~full ~nested)) | ( NFollowRecordField {fieldName}, (TinlineRecord {env; fields} | Trecord {env; fields}) ) -> ( - Debug.logVerbose "[nested]--> trying to move into record field"; + if Debug.verbose () then + print_endline "[nested]--> trying to move into record field"; match fields |> List.find_opt (fun (field : field) -> field.fname.txt = fieldName) with | None -> - Debug.logVerbose "[nested]--> did not find record field"; + if Debug.verbose () then + print_endline "[nested]--> did not find record field"; None | Some {typ; optional} -> - Debug.logVerbose "[nested]--> found record field type"; + if Debug.verbose () then + print_endline "[nested]--> found record field type"; let typ = if optional then Utils.unwrapIfOption typ else typ in - Debug.logVerbose - (Printf.sprintf "[nested]--> extracting from type %s in env %s" - (Shared.typeToString typ) (Debug.debugPrintEnv env)); + if Debug.verbose () then + print_endline + (Printf.sprintf "[nested]--> extracting from type %s in env %s" + (Shared.typeToString typ) (Debug.debugPrintEnv env)); typ |> extractType ~env ~package:full.package |> Utils.Option.flatMap (fun typ -> @@ -602,56 +612,63 @@ let rec resolveNested ~env ~full ~nested ?ctx (typ : completionType) = Some (Completable.RecordField {seenFields}) ) | ( NVariantPayload {constructorName = "Some"; itemNum = 0}, Toption (env, ExtractedType typ) ) -> - Debug.logVerbose "[nested]--> moving into option Some"; + if Debug.verbose () then + print_endline "[nested]--> moving into option Some"; typ |> resolveNested ~env ~full ~nested | ( NVariantPayload {constructorName = "Some"; itemNum = 0}, Toption (env, TypeExpr typ) ) -> - Debug.logVerbose "[nested]--> moving into option Some"; + if Debug.verbose () then + print_endline "[nested]--> moving into option Some"; typ |> extractType ~env ~package:full.package |> Utils.Option.flatMap (fun t -> t |> resolveNested ~env ~full ~nested) | NVariantPayload {constructorName = "Ok"; itemNum = 0}, Tresult {okType} -> - Debug.logVerbose "[nested]--> moving into result Ok"; + if Debug.verbose () then print_endline "[nested]--> moving into result Ok"; okType |> extractType ~env ~package:full.package |> Utils.Option.flatMap (fun t -> t |> resolveNested ~env ~full ~nested) | ( NVariantPayload {constructorName = "Error"; itemNum = 0}, Tresult {errorType} ) -> - Debug.logVerbose "[nested]--> moving into result Error"; + if Debug.verbose () then + print_endline "[nested]--> moving into result Error"; errorType |> extractType ~env ~package:full.package |> Utils.Option.flatMap (fun t -> t |> resolveNested ~env ~full ~nested) | NVariantPayload {constructorName; itemNum}, Tvariant {env; constructors} -> ( - Debug.logVerbose - (Printf.sprintf - "[nested]--> trying to move into variant payload $%i of constructor \ - '%s'" - itemNum constructorName); + if Debug.verbose () then + Printf.printf + "[nested]--> trying to move into variant payload $%i of constructor \ + '%s'\n" + itemNum constructorName; match constructors |> List.find_opt (fun (c : Constructor.t) -> c.cname.txt = constructorName) with | Some {args = Args args} -> ( - Debug.logVerbose "[nested]--> found constructor (Args type)"; + if Debug.verbose () then + print_endline "[nested]--> found constructor (Args type)"; match List.nth_opt args itemNum with | None -> - Debug.logVerbose "[nested]--> did not find relevant args num"; + if Debug.verbose () then + print_endline "[nested]--> did not find relevant args num"; None | Some (typ, _) -> - Debug.logVerbose - (Printf.sprintf "[nested]--> found arg of type: %s" - (Shared.typeToString typ)); + if Debug.verbose () then + Printf.printf "[nested]--> found arg of type: %s\n" + (Shared.typeToString typ); typ |> extractType ~env ~package:full.package |> Utils.Option.flatMap (fun typ -> - Debug.logVerbose - "[nested]--> extracted type, continuing descent"; + if Debug.verbose () then + print_endline + "[nested]--> extracted type, continuing descent"; typ |> resolveNested ~env ~full ~nested)) | Some {args = InlineRecord fields} when itemNum = 0 -> - Debug.logVerbose "[nested]--> found constructor (inline record)"; + if Debug.verbose () then + print_endline "[nested]--> found constructor (inline record)"; TinlineRecord {env; fields} |> resolveNested ~env ~full ~nested | _ -> None) | ( NPolyvariantPayload {constructorName; itemNum}, @@ -683,19 +700,20 @@ let rec resolveNested2 ?typeArgContext ~env ~full ~nested ?ctx (typ : completionType) = let extractType = extractType2 ?typeArgContext in let resolveNested = resolveNested2 in - Debug.logVerbose - (Printf.sprintf - "[nested]--> running nested in env: %s. Has type arg ctx: %b" - (Debug.debugPrintEnv env) - (Option.is_some typeArgContext)); + if Debug.verbose () then + Printf.printf + "[nested]--> running nested in env: %s. Has type arg ctx: %b\n" + (Debug.debugPrintEnv env) + (Option.is_some typeArgContext); (match typeArgContext with | None -> () | Some typeArgContext -> - Debug.logVerbose - (Printf.sprintf "[nested]--> %s" (debugLogTypeArgContext typeArgContext))); + if Debug.verbose () then + Printf.printf "[nested]--> %s" (debugLogTypeArgContext typeArgContext)); match nested with | [] -> - Debug.logVerbose "[nested]--> reached end of pattern, returning type"; + if Debug.verbose () then + print_endline "[nested]--> reached end of pattern, returning type"; Some ( typ, env, @@ -706,10 +724,12 @@ let rec resolveNested2 ?typeArgContext ~env ~full ~nested ?ctx | patternPath :: nested -> ( match (patternPath, typ) with | Completable.NTupleItem {itemNum}, Tuple (env, tupleItems, _) -> ( - Debug.logVerbose "[nested]--> trying to move into tuple"; + if Debug.verbose () then + print_endline "[nested]--> trying to move into tuple"; match List.nth_opt tupleItems itemNum with | None -> - Debug.logVerbose "[nested]--> tuple element not found"; + if Debug.verbose () then + print_endline "[nested]--> tuple element not found"; None | Some typ -> typ @@ -718,21 +738,24 @@ let rec resolveNested2 ?typeArgContext ~env ~full ~nested ?ctx typ |> resolveNested ?typeArgContext ~env ~full ~nested)) | ( NFollowRecordField {fieldName}, (TinlineRecord {env; fields} | Trecord {env; fields}) ) -> ( - Debug.logVerbose "[nested]--> trying to move into record field"; + if Debug.verbose () then + print_endline "[nested]--> trying to move into record field"; match fields |> List.find_opt (fun (field : field) -> field.fname.txt = fieldName) with | None -> - Debug.logVerbose "[nested]--> did not find record field"; + if Debug.verbose () then + print_endline "[nested]--> did not find record field"; None | Some {typ; optional} -> - Debug.logVerbose "[nested]--> found record field type"; + if Debug.verbose () then + print_endline "[nested]--> found record field type"; let typ = if optional then Utils.unwrapIfOption typ else typ in - Debug.logVerbose - (Printf.sprintf "[nested]--> extracting from type %s in env %s" - (Shared.typeToString typ) (Debug.debugPrintEnv env)); + if Debug.verbose () then + Printf.printf "[nested]--> extracting from type %s in env %s\n" + (Shared.typeToString typ) (Debug.debugPrintEnv env); typ |> extractType ~env ~package:full.package |> Utils.Option.flatMap (fun (typ, typeArgContext) -> @@ -744,7 +767,6 @@ let rec resolveNested2 ?typeArgContext ~env ~full ~nested ?ctx typeExpr |> extractType ~env ~package:full.package |> Option.map (fun (typ, _typeArgContext) -> - (* TODO: Do we need to do anything here with typeArgContext? *) (typ, env, Some (Completable.RecordField {seenFields}))) | ( NRecordBody {seenFields}, (Trecord {env; definition = `NameOnly _} as extractedType) ) -> @@ -756,59 +778,66 @@ let rec resolveNested2 ?typeArgContext ~env ~full ~nested ?ctx Some (Completable.RecordField {seenFields}) ) | ( NVariantPayload {constructorName = "Some"; itemNum = 0}, Toption (env, ExtractedType typ) ) -> - Debug.logVerbose "[nested]--> moving into option Some"; + if Debug.verbose () then + print_endline "[nested]--> moving into option Some"; typ |> resolveNested ~env ~full ~nested | ( NVariantPayload {constructorName = "Some"; itemNum = 0}, Toption (env, TypeExpr typ) ) -> - Debug.logVerbose "[nested]--> moving into option Some"; + if Debug.verbose () then + print_endline "[nested]--> moving into option Some"; typ |> extractType ~env ~package:full.package |> Utils.Option.flatMap (fun (t, typeArgContext) -> t |> resolveNested ?typeArgContext ~env ~full ~nested) | NVariantPayload {constructorName = "Ok"; itemNum = 0}, Tresult {okType} -> - Debug.logVerbose "[nested]--> moving into result Ok"; + if Debug.verbose () then print_endline "[nested]--> moving into result Ok"; okType |> extractType ~env ~package:full.package |> Utils.Option.flatMap (fun (t, typeArgContext) -> t |> resolveNested ?typeArgContext ~env ~full ~nested) | ( NVariantPayload {constructorName = "Error"; itemNum = 0}, Tresult {errorType} ) -> - Debug.logVerbose "[nested]--> moving into result Error"; + if Debug.verbose () then + print_endline "[nested]--> moving into result Error"; errorType |> extractType ~env ~package:full.package |> Utils.Option.flatMap (fun (t, typeArgContext) -> t |> resolveNested ?typeArgContext ~env ~full ~nested) | NVariantPayload {constructorName; itemNum}, Tvariant {env; constructors} -> ( - Debug.logVerbose - (Printf.sprintf - "[nested]--> trying to move into variant payload $%i of constructor \ - '%s'" - itemNum constructorName); + if Debug.verbose () then + Printf.printf + "[nested]--> trying to move into variant payload $%i of constructor \ + '%s'\n" + itemNum constructorName; match constructors |> List.find_opt (fun (c : Constructor.t) -> c.cname.txt = constructorName) with | Some {args = Args args} -> ( - Debug.logVerbose "[nested]--> found constructor (Args type)"; + if Debug.verbose () then + print_endline "[nested]--> found constructor (Args type)"; match List.nth_opt args itemNum with | None -> - Debug.logVerbose "[nested]--> did not find relevant args num"; + if Debug.verbose () then + print_endline "[nested]--> did not find relevant args num"; None | Some (typ, _) -> - Debug.logVerbose - (Printf.sprintf "[nested]--> found arg of type: %s" - (Shared.typeToString typ)); + if Debug.verbose () then + Printf.printf "[nested]--> found arg of type: %s\n" + (Shared.typeToString typ); typ |> extractType ~env ~package:full.package |> Utils.Option.flatMap (fun (typ, typeArgContext) -> - Debug.logVerbose - "[nested]--> extracted type, continuing descent"; + if Debug.verbose () then + print_endline + "[nested]--> extracted type, continuing descent"; typ |> resolveNested ?typeArgContext ~env ~full ~nested)) | Some {args = InlineRecord fields} when itemNum = 0 -> - Debug.logVerbose "[nested]--> found constructor (inline record)"; + if Debug.verbose () then + print_endline "[nested]--> found constructor (inline record)"; TinlineRecord {env; fields} |> resolveNested ~env ~full ~nested | _ -> None) | ( NPolyvariantPayload {constructorName; itemNum}, @@ -871,7 +900,7 @@ let findTypeOfPolyvariantArg constructors ~constructorName ~payloadNum = | None -> None let rec resolveNestedPatternPath (typ : innerType) ~env ~full ~nested = - Debug.logVerbose "[nested_pattern_path]"; + if Debug.verbose () then print_endline "[nested_pattern_path]"; let t = match typ with | TypeExpr t -> t |> extractType ~env ~package:full.package diff --git a/analysis/tests/src/expected/Completion.res.txt b/analysis/tests/src/expected/Completion.res.txt index d837bd346..d9a4deca8 100644 --- a/analysis/tests/src/expected/Completion.res.txt +++ b/analysis/tests/src/expected/Completion.res.txt @@ -518,7 +518,6 @@ JSX 59:21] second[59:22->59:28]=...[59:29->59:30]> _children:Non Completable: Cexpression CJsxPropValue [O, Comp] second=z Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CJsxPropValue [O, Comp] second Path O.Comp.make [extract_type]--> starting extraction of type: string, in env: Completion.O.Comp. Has type arg ctx: false @@ -2149,7 +2148,6 @@ Completable: Cexpression Type[someVariantWithDeprecated] Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder Package opens Pervasives.JsxModules.place holder Resolved opens 3 pervasives Completion.res Completion.res ---> expression completion ContextPath Type[someVariantWithDeprecated] Path someVariantWithDeprecated [nested]--> running nested in env: Completion. Has type arg ctx: false @@ -2207,7 +2205,6 @@ Completable: Cexpression Type[withUncurried]->recordField(fn) Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder Package opens Pervasives.JsxModules.place holder Resolved opens 3 pervasives Completion.res Completion.res ---> expression completion ContextPath Type[withUncurried] Path withUncurried [nested]--> running nested in env: Completion. Has type arg ctx: false diff --git a/analysis/tests/src/expected/CompletionExpressions.res.txt b/analysis/tests/src/expected/CompletionExpressions.res.txt index 0316bee6c..f59c7e926 100644 --- a/analysis/tests/src/expected/CompletionExpressions.res.txt +++ b/analysis/tests/src/expected/CompletionExpressions.res.txt @@ -27,7 +27,6 @@ Pexp_apply ...[26:11->26:25] (...[26:26->26:28]) Completable: Cexpression CArgument Value[fnTakingRecord]($0)->recordBody Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[fnTakingRecord]($0) --> function argument: $0 ContextPath Value[fnTakingRecord] @@ -87,7 +86,6 @@ Pexp_apply ...[29:11->29:25] (...[29:27->29:28]) Completable: Cexpression CArgument Value[fnTakingRecord]($0)=n->recordBody Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[fnTakingRecord]($0) --> function argument: $0 ContextPath Value[fnTakingRecord] @@ -117,7 +115,6 @@ Pexp_apply ...[32:11->32:25] (...[32:26->32:38]) Completable: Cexpression CArgument Value[fnTakingRecord]($0)->recordField(offline) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[fnTakingRecord]($0) --> function argument: $0 ContextPath Value[fnTakingRecord] @@ -157,7 +154,6 @@ Pexp_apply ...[35:11->35:25] (...[35:26->35:38]) Completable: Cexpression CArgument Value[fnTakingRecord]($0)->recordBody Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[fnTakingRecord]($0) --> function argument: $0 ContextPath Value[fnTakingRecord] @@ -211,7 +207,6 @@ Pexp_apply ...[38:11->38:25] (...[38:26->38:52]) Completable: Cexpression CArgument Value[fnTakingRecord]($0)->recordBody Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[fnTakingRecord]($0) --> function argument: $0 ContextPath Value[fnTakingRecord] @@ -259,7 +254,6 @@ Pexp_apply ...[41:11->41:25] (...[41:26->41:47]) Completable: Cexpression CArgument Value[fnTakingRecord]($0)->recordField(nested) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[fnTakingRecord]($0) --> function argument: $0 ContextPath Value[fnTakingRecord] @@ -320,7 +314,6 @@ Pexp_apply ...[44:11->44:25] (...[44:26->44:48]) Completable: Cexpression CArgument Value[fnTakingRecord]($0)->recordField(nested), recordBody Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[fnTakingRecord]($0) --> function argument: $0 ContextPath Value[fnTakingRecord] @@ -347,7 +340,6 @@ Pexp_apply ...[47:11->47:25] (...[47:26->47:54]) Completable: Cexpression CArgument Value[fnTakingRecord]($0)->recordField(nested), variantPayload::Some($0), recordBody Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[fnTakingRecord]($0) --> function argument: $0 ContextPath Value[fnTakingRecord] @@ -394,7 +386,6 @@ Pexp_apply ...[50:11->50:25] (...[50:26->50:48]) Completable: Cexpression CArgument Value[fnTakingRecord]($0)->recordField(variant) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[fnTakingRecord]($0) --> function argument: $0 ContextPath Value[fnTakingRecord] @@ -448,7 +439,6 @@ Pexp_apply ...[53:11->53:25] (...[53:26->53:49]) Completable: Cexpression CArgument Value[fnTakingRecord]($0)=O->recordField(variant) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[fnTakingRecord]($0) --> function argument: $0 ContextPath Value[fnTakingRecord] @@ -486,7 +476,6 @@ Pexp_apply ...[56:11->56:25] (...[56:26->56:60]) Completable: Cexpression CArgument Value[fnTakingRecord]($0)->recordField(polyvariant), polyvariantPayload::three($0) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[fnTakingRecord]($0) --> function argument: $0 ContextPath Value[fnTakingRecord] @@ -530,7 +519,6 @@ Pexp_apply ...[59:11->59:25] (...[59:26->59:64]) Completable: Cexpression CArgument Value[fnTakingRecord]($0)->recordField(polyvariant), polyvariantPayload::three($1) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[fnTakingRecord]($0) --> function argument: $0 ContextPath Value[fnTakingRecord] @@ -575,7 +563,6 @@ Pexp_apply ...[62:11->62:25] (...[62:26->62:65]) Completable: Cexpression CArgument Value[fnTakingRecord]($0)=t->recordField(polyvariant), polyvariantPayload::three($1) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[fnTakingRecord]($0) --> function argument: $0 ContextPath Value[fnTakingRecord] @@ -614,7 +601,6 @@ Pexp_apply ...[69:11->69:24] (...[69:25->69:26]) Completable: Cexpression CArgument Value[fnTakingArray]($0) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[fnTakingArray]($0) --> function argument: $0 ContextPath Value[fnTakingArray] @@ -643,7 +629,6 @@ Pexp_apply ...[72:11->72:24] (...[72:25->72:27]) Completable: Cexpression CArgument Value[fnTakingArray]($0)->array Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[fnTakingArray]($0) --> function argument: $0 ContextPath Value[fnTakingArray] @@ -692,7 +677,6 @@ Pexp_apply ...[75:11->75:24] (...[75:25->75:26]) Completable: Cexpression CArgument Value[fnTakingArray]($0)=s Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[fnTakingArray]($0) --> function argument: $0 ContextPath Value[fnTakingArray] @@ -718,7 +702,6 @@ Pexp_apply ...[78:11->78:24] (...[78:25->78:33]) Completable: Cexpression CArgument Value[fnTakingArray]($0)->array, variantPayload::Some($0) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[fnTakingArray]($0) --> function argument: $0 ContextPath Value[fnTakingArray] @@ -755,7 +738,6 @@ Pexp_apply ...[81:11->81:24] (...[81:25->81:33]) Completable: Cexpression CArgument Value[fnTakingArray]($0)->array Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[fnTakingArray]($0) --> function argument: $0 ContextPath Value[fnTakingArray] @@ -804,7 +786,6 @@ Pexp_apply ...[84:11->84:24] (...[84:25->84:39]) Completable: Cexpression CArgument Value[fnTakingArray]($0)->array Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[fnTakingArray]($0) --> function argument: $0 ContextPath Value[fnTakingArray] @@ -853,7 +834,6 @@ Pexp_apply ...[89:11->89:25] (...[89:26->89:40]) Completable: Cexpression CArgument Value[fnTakingRecord]($0)=so Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[fnTakingRecord]($0) --> function argument: $0 ContextPath Value[fnTakingRecord] @@ -881,7 +861,6 @@ Pexp_apply ...[96:11->96:30] (...[96:31->96:46]) Completable: Cexpression CArgument Value[fnTakingOtherRecord]($0)->recordField(otherField) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[fnTakingOtherRecord]($0) --> function argument: $0 ContextPath Value[fnTakingOtherRecord] @@ -918,7 +897,6 @@ Pexp_apply ...[108:11->108:42] (...[108:43->108:60]) Completable: Cexpression CArgument Value[fnTakingRecordWithOptionalField]($0)->recordField(someOptField) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[fnTakingRecordWithOptionalField]($0) --> function argument: $0 ContextPath Value[fnTakingRecordWithOptionalField] @@ -957,7 +935,6 @@ Pexp_apply ...[116:11->116:39] (...[116:40->116:56]) Completable: Cexpression CArgument Value[fnTakingRecordWithOptVariant]($0)->recordField(someVariant) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[fnTakingRecordWithOptVariant]($0) --> function argument: $0 ContextPath Value[fnTakingRecordWithOptVariant] @@ -1034,7 +1011,6 @@ Pexp_apply ...[126:11->126:31] (...[126:32->126:50]) Completable: Cexpression CArgument Value[fnTakingInlineRecord]($0)->variantPayload::WithInlineRecord($0) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[fnTakingInlineRecord]($0) --> function argument: $0 ContextPath Value[fnTakingInlineRecord] @@ -1068,7 +1044,6 @@ Pexp_apply ...[129:11->129:31] (...[129:32->129:52]) Completable: Cexpression CArgument Value[fnTakingInlineRecord]($0)->variantPayload::WithInlineRecord($0), recordBody Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[fnTakingInlineRecord]($0) --> function argument: $0 ContextPath Value[fnTakingInlineRecord] @@ -1110,7 +1085,6 @@ Pexp_apply ...[132:11->132:31] (...[132:32->132:53]) Completable: Cexpression CArgument Value[fnTakingInlineRecord]($0)=s->variantPayload::WithInlineRecord($0), recordBody Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[fnTakingInlineRecord]($0) --> function argument: $0 ContextPath Value[fnTakingInlineRecord] @@ -1140,7 +1114,6 @@ Pexp_apply ...[135:11->135:31] (...[135:32->135:66]) Completable: Cexpression CArgument Value[fnTakingInlineRecord]($0)->variantPayload::WithInlineRecord($0), recordField(nestedRecord) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[fnTakingInlineRecord]($0) --> function argument: $0 ContextPath Value[fnTakingInlineRecord] @@ -1182,7 +1155,6 @@ Pexp_apply ...[138:11->138:31] (...[138:32->138:69]) Completable: Cexpression CArgument Value[fnTakingInlineRecord]($0)->variantPayload::WithInlineRecord($0), recordField(nestedRecord), recordBody Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[fnTakingInlineRecord]($0) --> function argument: $0 ContextPath Value[fnTakingInlineRecord] @@ -1229,7 +1201,6 @@ Pexp_apply ...[159:3->159:19] (...[159:20->159:21]) Completable: Cexpression CArgument Value[fnTakingCallback]($0) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[fnTakingCallback]($0) --> function argument: $0 ContextPath Value[fnTakingCallback] @@ -1261,7 +1232,6 @@ Pexp_apply ...[162:3->162:19] (...[162:20->162:21]) Completable: Cexpression CArgument Value[fnTakingCallback]($0)=a Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[fnTakingCallback]($0) --> function argument: $0 ContextPath Value[fnTakingCallback] @@ -1281,7 +1251,6 @@ Pexp_apply ...[165:3->165:19] (...[165:20->165:21]) Completable: Cexpression CArgument Value[fnTakingCallback]($1) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[fnTakingCallback]($1) --> function argument: $1 ContextPath Value[fnTakingCallback] @@ -1313,7 +1282,6 @@ Pexp_apply ...[168:3->168:19] (...[168:20->168:21], ...[168:23->168:24]) Completable: Cexpression CArgument Value[fnTakingCallback]($2) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[fnTakingCallback]($2) --> function argument: $2 ContextPath Value[fnTakingCallback] @@ -1345,7 +1313,6 @@ Pexp_apply ...[171:3->171:19] (...[171:20->171:21], ...[171:23->171:24], ...[171 Completable: Cexpression CArgument Value[fnTakingCallback]($3) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[fnTakingCallback]($3) --> function argument: $3 ContextPath Value[fnTakingCallback] @@ -1377,7 +1344,6 @@ Pexp_apply ...[174:3->174:19] (...[174:20->174:21], ...[174:23->174:24], ...[174 Completable: Cexpression CArgument Value[fnTakingCallback]($4) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[fnTakingCallback]($4) --> function argument: $4 ContextPath Value[fnTakingCallback] @@ -1409,7 +1375,6 @@ Pexp_apply ...[177:3->177:19] (...[177:20->177:21], ...[177:23->177:24], ...[177 Completable: Cexpression CArgument Value[fnTakingCallback]($5) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[fnTakingCallback]($5) --> function argument: $5 ContextPath Value[fnTakingCallback] @@ -1445,7 +1410,6 @@ Pexp_apply ...[185:2->185:8] (...[185:9->185:10]) Completable: Cexpression CArgument Value[Js, log]($0)=s Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[Js, log]($0) --> function argument: $0 ContextPath Value[Js, log] @@ -1506,7 +1470,6 @@ Pexp_apply ...[205:3->205:10] (...[205:11->205:12]) Completable: Cexpression CArgument Value[takesCb]($0) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[takesCb]($0) --> function argument: $0 ContextPath Value[takesCb] @@ -1537,7 +1500,6 @@ Pexp_apply ...[216:3->216:11] (...[216:12->216:13]) Completable: Cexpression CArgument Value[takesCb2]($0) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[takesCb2]($0) --> function argument: $0 ContextPath Value[takesCb2] @@ -1568,7 +1530,6 @@ Pexp_apply ...[225:3->225:11] (...[225:12->225:13]) Completable: Cexpression CArgument Value[takesCb3]($0) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[takesCb3]($0) --> function argument: $0 ContextPath Value[takesCb3] @@ -1599,7 +1560,6 @@ Pexp_apply ...[232:3->232:11] (...[232:12->232:13]) Completable: Cexpression CArgument Value[takesCb4]($0) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[takesCb4]($0) --> function argument: $0 ContextPath Value[takesCb4] @@ -1630,7 +1590,6 @@ Pexp_apply ...[239:3->239:11] (...[239:12->239:13]) Completable: Cexpression CArgument Value[takesCb5]($0) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[takesCb5]($0) --> function argument: $0 ContextPath Value[takesCb5] @@ -1661,7 +1620,6 @@ Pexp_apply ...[250:3->250:20] (~updater250:22->250:29=...__ghost__[0:-1->0:-1]) Completable: Cexpression CArgument Value[commitLocalUpdate](~updater) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[commitLocalUpdate](~updater) --> function argument: updater ContextPath Value[commitLocalUpdate] @@ -1692,7 +1650,6 @@ Pexp_apply ...[257:3->257:24] (...[257:25->257:26]) Completable: Cexpression CArgument Value[fnTakingAsyncCallback]($0) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[fnTakingAsyncCallback]($0) --> function argument: $0 ContextPath Value[fnTakingAsyncCallback] @@ -1721,7 +1678,6 @@ posCursor:[262:23] posNoWhite:[262:22] Found expr:[262:3->262:24] Completable: Cexpression CArgument Value[Belt, Array, map]($1) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[Belt, Array, map]($1) --> function argument: $1 ContextPath Value[Belt, Array, map] @@ -1752,7 +1708,6 @@ Pexp_apply ...[271:3->271:14] (...[271:15->271:16]) Completable: Cexpression CArgument Value[takesExotic]($0) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[takesExotic]($0) --> function argument: $0 ContextPath Value[takesExotic] @@ -1783,7 +1738,6 @@ Pexp_apply ...[278:3->278:22] (...[278:23->278:24]) Completable: Cexpression CArgument Value[fnTakingPolyVariant]($0) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[fnTakingPolyVariant]($0) --> function argument: $0 ContextPath Value[fnTakingPolyVariant] @@ -1830,7 +1784,6 @@ Pexp_apply ...[281:3->281:22] (...[281:23->281:25], ...[290:0->290:16]) Completable: Cexpression CArgument Value[fnTakingPolyVariant]($0)=# Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[fnTakingPolyVariant]($0) --> function argument: $0 ContextPath Value[fnTakingPolyVariant] @@ -1877,7 +1830,6 @@ Pexp_apply ...[284:3->284:22] (...[284:23->284:25]) Completable: Cexpression CArgument Value[fnTakingPolyVariant]($0)=#o Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[fnTakingPolyVariant]($0) --> function argument: $0 ContextPath Value[fnTakingPolyVariant] @@ -1908,7 +1860,6 @@ Pexp_apply ...[287:3->287:22] (...[287:23->287:24]) Completable: Cexpression CArgument Value[fnTakingPolyVariant]($0)=o Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[fnTakingPolyVariant]($0) --> function argument: $0 ContextPath Value[fnTakingPolyVariant] @@ -1938,7 +1889,6 @@ XXX Not found! Completable: Cexpression Type[withIntLocal]->recordField(superInt) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath Type[withIntLocal] Path withIntLocal [nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false @@ -1967,7 +1917,6 @@ Pexp_apply ...[309:3->309:35] (...[309:36->309:37]) Completable: Cexpression CArgument Value[CompletionSupport, makeTestHidden]($0) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[CompletionSupport, makeTestHidden]($0) --> function argument: $0 ContextPath Value[CompletionSupport, makeTestHidden] @@ -1997,7 +1946,6 @@ Completable: Cexpression CArgument Value[CompletionSupport, makeTestHidden]($0) Raw opens: 1 CompletionSupport.place holder Package opens Pervasives.JsxModules.place holder Resolved opens 2 pervasives CompletionSupport.res ---> expression completion ContextPath CArgument Value[CompletionSupport, makeTestHidden]($0) --> function argument: $0 ContextPath Value[CompletionSupport, makeTestHidden] diff --git a/analysis/tests/src/expected/CompletionFunctionArguments.res.txt b/analysis/tests/src/expected/CompletionFunctionArguments.res.txt index d6d6a6ccc..e8b2447af 100644 --- a/analysis/tests/src/expected/CompletionFunctionArguments.res.txt +++ b/analysis/tests/src/expected/CompletionFunctionArguments.res.txt @@ -4,7 +4,6 @@ Pexp_apply ...[10:11->10:17] (~isOn10:19->10:23=...__ghost__[0:-1->0:-1]) Completable: Cexpression CArgument Value[someFn](~isOn) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[someFn](~isOn) --> function argument: isOn ContextPath Value[someFn] @@ -36,7 +35,6 @@ Pexp_apply ...[13:11->13:17] (~isOn13:19->13:23=...[13:24->13:25]) Completable: Cexpression CArgument Value[someFn](~isOn)=t Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[someFn](~isOn) --> function argument: isOn ContextPath Value[someFn] @@ -69,7 +67,6 @@ Pexp_apply ...[16:11->16:17] (~isOff16:19->16:24=...__ghost__[0:-1->0:-1]) Completable: Cexpression CArgument Value[someFn](~isOff) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[someFn](~isOff) --> function argument: isOff ContextPath Value[someFn] @@ -105,7 +102,6 @@ Pexp_apply ...[21:14->21:20] (~isOn21:22->21:26=...__ghost__[0:-1->0:-1]) Completable: Cexpression CArgument Value[someFn](~isOn) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[someFn](~isOn) --> function argument: isOn ContextPath Value[someFn] @@ -137,7 +133,6 @@ Pexp_apply ...[34:11->34:22] (...[34:23->34:24]) Completable: Cexpression CArgument Value[someOtherFn]($0)=f Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[someOtherFn]($0) --> function argument: $0 ContextPath Value[someOtherFn] @@ -163,7 +158,6 @@ Pexp_apply ...[51:11->51:30] (~config51:32->51:38=...__ghost__[0:-1->0:-1]) Completable: Cexpression CArgument Value[someFnTakingVariant](~config) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[someFnTakingVariant](~config) --> function argument: config ContextPath Value[someFnTakingVariant] @@ -209,7 +203,6 @@ Pexp_apply ...[54:11->54:30] (~config54:32->54:38=...[54:39->54:40]) Completable: Cexpression CArgument Value[someFnTakingVariant](~config)=O Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[someFnTakingVariant](~config) --> function argument: config ContextPath Value[someFnTakingVariant] @@ -258,7 +251,6 @@ Pexp_apply ...[57:11->57:30] (...[57:31->57:33]) Completable: Cexpression CArgument Value[someFnTakingVariant]($0)=So Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[someFnTakingVariant]($0) --> function argument: $0 ContextPath Value[someFnTakingVariant] @@ -296,7 +288,6 @@ Pexp_apply ...[60:11->60:30] (~configOpt260:32->60:42=...[60:43->60:44]) Completable: Cexpression CArgument Value[someFnTakingVariant](~configOpt2)=O Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[someFnTakingVariant](~configOpt2) --> function argument: configOpt2 ContextPath Value[someFnTakingVariant] @@ -345,7 +336,6 @@ Pexp_apply ...[63:11->63:22] (...[63:23->63:24]) Completable: Cexpression CArgument Value[someOtherFn]($0) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[someOtherFn]($0) --> function argument: $0 ContextPath Value[someOtherFn] @@ -377,7 +367,6 @@ Pexp_apply ...[66:11->66:22] (...[66:23->66:24], ...[66:26->66:27]) Completable: Cexpression CArgument Value[someOtherFn]($2) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[someOtherFn]($2) --> function argument: $2 ContextPath Value[someOtherFn] @@ -408,7 +397,6 @@ posCursor:[69:30] posNoWhite:[69:29] Found expr:[69:11->69:31] Completable: Cexpression CArgument Value[someOtherFn]($2)=t Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[someOtherFn]($2) --> function argument: $2 ContextPath Value[someOtherFn] @@ -441,7 +429,6 @@ Pexp_apply ...[76:11->76:24] (...[76:25->76:26]) Completable: Cexpression CArgument Value[fnTakingTuple]($0) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[fnTakingTuple]($0) --> function argument: $0 ContextPath Value[fnTakingTuple] @@ -469,7 +456,6 @@ Pexp_apply ...[89:11->89:25] (...[89:26->89:28]) Completable: Cexpression CArgument Value[fnTakingRecord]($0)->recordBody Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[fnTakingRecord]($0) --> function argument: $0 ContextPath Value[fnTakingRecord] diff --git a/analysis/tests/src/expected/CompletionJsx.res.txt b/analysis/tests/src/expected/CompletionJsx.res.txt index 45f9b7465..9214afb85 100644 --- a/analysis/tests/src/expected/CompletionJsx.res.txt +++ b/analysis/tests/src/expected/CompletionJsx.res.txt @@ -479,7 +479,6 @@ JSX 48:17] someProp[48:18->48:26]=...[48:18->48:26]> _chil Completable: Cexpression CJsxPropValue [SomeComponent] someProp Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CJsxPropValue [SomeComponent] someProp Path SomeComponent.make [extract_type]--> starting extraction of type: string, in env: CompletionJsx.SomeComponent. Has type arg ctx: false diff --git a/analysis/tests/src/expected/CompletionJsxProps.res.txt b/analysis/tests/src/expected/CompletionJsxProps.res.txt index daab7d244..6c58320db 100644 --- a/analysis/tests/src/expected/CompletionJsxProps.res.txt +++ b/analysis/tests/src/expected/CompletionJsxProps.res.txt @@ -4,7 +4,6 @@ JSX 0:43] on[0:44->0:46]=...__ghost__[0: Completable: Cexpression CJsxPropValue [CompletionSupport, TestComponent] on Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CJsxPropValue [CompletionSupport, TestComponent] on Path CompletionSupport.TestComponent.make [extract_type]--> starting extraction of type: bool, in env: CompletionSupport.TestComponent. Has type arg ctx: false @@ -31,7 +30,6 @@ JSX 3:43] on[3:44->3:46]=...[3:47->3:48] Completable: Cexpression CJsxPropValue [CompletionSupport, TestComponent] on=t Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CJsxPropValue [CompletionSupport, TestComponent] on Path CompletionSupport.TestComponent.make [extract_type]--> starting extraction of type: bool, in env: CompletionSupport.TestComponent. Has type arg ctx: false @@ -52,7 +50,6 @@ JSX 6:43] test[6:44->6:48]=...[6:49->6:5 Completable: Cexpression CJsxPropValue [CompletionSupport, TestComponent] test=T Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CJsxPropValue [CompletionSupport, TestComponent] test Path CompletionSupport.TestComponent.make [extract_type]--> starting extraction of type: testVariant, in env: CompletionSupport.TestComponent. Has type arg ctx: false @@ -105,7 +102,6 @@ JSX 9:43] polyArg[9:44->9:51]=...__ghost Completable: Cexpression CJsxPropValue [CompletionSupport, TestComponent] polyArg Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CJsxPropValue [CompletionSupport, TestComponent] polyArg Path CompletionSupport.TestComponent.make [extract_type]--> starting extraction of type: [#one | #three(int, bool) | #two | #two2], in env: CompletionSupport.TestComponent. Has type arg ctx: false @@ -152,7 +148,6 @@ JSX 12:43] polyArg[12:44->12:51]=...[12 Completable: Cexpression CJsxPropValue [CompletionSupport, TestComponent] polyArg=#t Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CJsxPropValue [CompletionSupport, TestComponent] polyArg Path CompletionSupport.TestComponent.make [extract_type]--> starting extraction of type: [#one | #three(int, bool) | #two | #two2], in env: CompletionSupport.TestComponent. Has type arg ctx: false @@ -191,7 +186,6 @@ JSX 15:15] muted[15:16->15:21]=...__ghost__[0:-1->0:-1]> _children: Completable: Cexpression CJsxPropValue [div] muted Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CJsxPropValue [div] muted Path ReactDOM.domProps Path Pervasives.JsxDOM.domProps @@ -219,7 +213,6 @@ JSX 18:15] onMouseEnter[18:16->18:28]=...__ghost__[0:-1->0:-1]> _ch Completable: Cexpression CJsxPropValue [div] onMouseEnter Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CJsxPropValue [div] onMouseEnter Path ReactDOM.domProps Path Pervasives.JsxDOM.domProps @@ -247,7 +240,6 @@ JSX 22:43] testArr[22:44->22:51]=...__g Completable: Cexpression CJsxPropValue [CompletionSupport, TestComponent] testArr Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CJsxPropValue [CompletionSupport, TestComponent] testArr Path CompletionSupport.TestComponent.make [extract_type]--> starting extraction of type: array, in env: CompletionSupport.TestComponent. Has type arg ctx: false @@ -271,7 +263,6 @@ JSX 26:43] testArr[26:44->26:51]=...[26 Completable: Cexpression CJsxPropValue [CompletionSupport, TestComponent] testArr->array Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CJsxPropValue [CompletionSupport, TestComponent] testArr Path CompletionSupport.TestComponent.make [extract_type]--> starting extraction of type: array, in env: CompletionSupport.TestComponent. Has type arg ctx: false diff --git a/analysis/tests/src/expected/CompletionTypeAnnotation.res.txt b/analysis/tests/src/expected/CompletionTypeAnnotation.res.txt index ad0b8a485..2b0d71203 100644 --- a/analysis/tests/src/expected/CompletionTypeAnnotation.res.txt +++ b/analysis/tests/src/expected/CompletionTypeAnnotation.res.txt @@ -3,7 +3,6 @@ XXX Not found! Completable: Cexpression Type[someRecord] Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath Type[someRecord] Path someRecord [nested]--> running nested in env: CompletionTypeAnnotation. Has type arg ctx: false @@ -25,7 +24,6 @@ XXX Not found! Completable: Cexpression Type[someRecord]->recordBody Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath Type[someRecord] Path someRecord [nested]--> running nested in env: CompletionTypeAnnotation. Has type arg ctx: false @@ -49,7 +47,6 @@ XXX Not found! Completable: Cexpression Type[someVariant] Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath Type[someVariant] Path someVariant [nested]--> running nested in env: CompletionTypeAnnotation. Has type arg ctx: false @@ -78,7 +75,6 @@ XXX Not found! Completable: Cexpression Type[someVariant]=O Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath Type[someVariant] Path someVariant [nested]--> running nested in env: CompletionTypeAnnotation. Has type arg ctx: false @@ -112,7 +108,6 @@ XXX Not found! Completable: Cexpression Type[somePolyVariant] Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath Type[somePolyVariant] Path somePolyVariant [nested]--> running nested in env: CompletionTypeAnnotation. Has type arg ctx: false @@ -141,7 +136,6 @@ XXX Not found! Completable: Cexpression Type[somePolyVariant]=#o Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath Type[somePolyVariant] Path somePolyVariant [nested]--> running nested in env: CompletionTypeAnnotation. Has type arg ctx: false @@ -162,7 +156,6 @@ XXX Not found! Completable: Cexpression Type[someFunc] Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath Type[someFunc] Path someFunc [nested]--> running nested in env: CompletionTypeAnnotation. Has type arg ctx: false @@ -185,7 +178,6 @@ XXX Not found! Completable: Cexpression Type[someTuple] Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath Type[someTuple] Path someTuple [nested]--> running nested in env: CompletionTypeAnnotation. Has type arg ctx: false @@ -206,7 +198,6 @@ XXX Not found! Completable: Cexpression Type[someTuple]->tuple($1) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath Type[someTuple] Path someTuple [nested]--> running nested in env: CompletionTypeAnnotation. Has type arg ctx: false @@ -249,7 +240,6 @@ XXX Not found! Completable: Cexpression option Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath option ContextPath Type[someVariant] Path someVariant @@ -293,7 +283,6 @@ XXX Not found! Completable: Cexpression option->variantPayload::Some($0) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath option ContextPath Type[someVariant] Path someVariant @@ -325,7 +314,6 @@ XXX Not found! Completable: Cexpression array Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath array ContextPath Type[someVariant] Path someVariant @@ -348,7 +336,6 @@ XXX Not found! Completable: Cexpression array->array Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath array ContextPath Type[someVariant] Path someVariant @@ -379,7 +366,6 @@ XXX Not found! Completable: Cexpression array> Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath array> ContextPath option ContextPath Type[someVariant] @@ -403,7 +389,6 @@ XXX Not found! Completable: Cexpression option>->variantPayload::Some($0), array Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath option> ContextPath array ContextPath Type[someVariant] diff --git a/analysis/tests/src/expected/Fragment.res.txt b/analysis/tests/src/expected/Fragment.res.txt index 9e0f7910b..d01b9e99a 100644 --- a/analysis/tests/src/expected/Fragment.res.txt +++ b/analysis/tests/src/expected/Fragment.res.txt @@ -15,7 +15,6 @@ Pexp_construct []:__ghost__[9:10->9:67] None Completable: Cexpression CTypeAtPos()=[]->variantPayload::::($1) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CTypeAtPos() [extract_type]--> starting extraction of type: React.element, in env: Fragment. Has type arg ctx: false [extract_type]--> starting extraction of type: React.element, in env: Fragment. Has type arg ctx: false diff --git a/analysis/tests/src/expected/Jsx2.res.txt b/analysis/tests/src/expected/Jsx2.res.txt index 77a889638..d563c5f1d 100644 --- a/analysis/tests/src/expected/Jsx2.res.txt +++ b/analysis/tests/src/expected/Jsx2.res.txt @@ -9,7 +9,6 @@ JSX 8:5] second[8:6->8:12]=...[8:13->8:15]> _children:None Completable: Cexpression CJsxPropValue [M] second=fi Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CJsxPropValue [M] second Path M.make [extract_type]--> starting extraction of type: string, in env: Jsx2.M. Has type arg ctx: false diff --git a/analysis/tests/src/expected/Reprod.res.txt b/analysis/tests/src/expected/Reprod.res.txt index 3b5d3d2ea..aba1c1041 100644 --- a/analysis/tests/src/expected/Reprod.res.txt +++ b/analysis/tests/src/expected/Reprod.res.txt @@ -4,7 +4,6 @@ Pexp_apply ...[7:11->7:20] (~variables7:22->7:31=...[7:32->7:55]) Completable: Cexpression CArgument Value[Query, use](~variables)->recordField(location), variantPayload::ByAddress($0) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CArgument Value[Query, use](~variables) --> function argument: variables ContextPath Value[Query, use] diff --git a/analysis/tests/src/expected/TypeAtPosCompletion.res.txt b/analysis/tests/src/expected/TypeAtPosCompletion.res.txt index 9aeb76ef0..3c0a8a0b2 100644 --- a/analysis/tests/src/expected/TypeAtPosCompletion.res.txt +++ b/analysis/tests/src/expected/TypeAtPosCompletion.res.txt @@ -3,7 +3,6 @@ posCursor:[7:17] posNoWhite:[7:15] Found expr:[6:16->9:1] Completable: Cexpression CTypeAtPos()->recordBody Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CTypeAtPos() [extract_type]--> starting extraction of type: optRecord, in env: TypeAtPosCompletion. Has type arg ctx: false [extract_type]--> starting extraction of type: optRecord, in env: TypeAtPosCompletion. Has type arg ctx: false @@ -36,7 +35,6 @@ posCursor:[16:18] posNoWhite:[16:16] Found expr:[15:2->18:3] Completable: Cexpression CTypeAtPos()->variantPayload::One($1), recordBody Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CTypeAtPos() [extract_type]--> starting extraction of type: someVariant, in env: TypeAtPosCompletion. Has type arg ctx: false [extract_type]--> starting extraction of type: someVariant, in env: TypeAtPosCompletion. Has type arg ctx: false @@ -74,7 +72,6 @@ posCursor:[22:12] posNoWhite:[22:11] Found expr:[21:10->24:1] Completable: Cexpression CTypeAtPos()->array Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ---> expression completion ContextPath CTypeAtPos() [extract_type]--> starting extraction of type: array, in env: TypeAtPosCompletion. Has type arg ctx: false [extract_type]--> starting extraction of type: array, in env: TypeAtPosCompletion. Has type arg ctx: false From 36d9d2bc85a09f392827255f05c224b45f3f9031 Mon Sep 17 00:00:00 2001 From: Gabriel Nordeborn Date: Mon, 8 Jan 2024 19:41:11 +0100 Subject: [PATCH 11/17] turn off verbose logging --- analysis/src/Cli.ml | 1 - .../tests/src/expected/Completion.res.txt | 22 - .../expected/CompletionExpressions.res.txt | 672 ------------------ .../CompletionFunctionArguments.res.txt | 125 ---- .../expected/CompletionInferValues.res.txt | 92 --- .../tests/src/expected/CompletionJsx.res.txt | 4 - .../src/expected/CompletionJsxProps.res.txt | 45 -- .../src/expected/CompletionPattern.res.txt | 484 ------------- .../expected/CompletionTypeAnnotation.res.txt | 55 -- .../tests/src/expected/Destructuring.res.txt | 37 - .../tests/src/expected/EnvCompletion.res.txt | 220 ------ .../src/expected/ExhaustiveSwitch.res.txt | 25 +- analysis/tests/src/expected/Fragment.res.txt | 8 - analysis/tests/src/expected/Hover.res.txt | 1 - analysis/tests/src/expected/Jsx2.res.txt | 4 - analysis/tests/src/expected/Reprod.res.txt | 187 ----- .../src/expected/TypeAtPosCompletion.res.txt | 36 - analysis/tests/src/expected/Xform.res.txt | 4 - 18 files changed, 1 insertion(+), 2021 deletions(-) diff --git a/analysis/src/Cli.ml b/analysis/src/Cli.ml index dc55b2d5d..d2ed112cd 100644 --- a/analysis/src/Cli.ml +++ b/analysis/src/Cli.ml @@ -195,7 +195,6 @@ let main () = Printf.printf "\"%s\"" (Json.escape (Commands.format ~path)) | [_; "test"; path] -> Cfg.supportsSnippets := true; - Debug.debugLevel := Verbose; Commands.test ~path | args when List.mem "-h" args || List.mem "--help" args -> prerr_endline help | _ -> diff --git a/analysis/tests/src/expected/Completion.res.txt b/analysis/tests/src/expected/Completion.res.txt index d9a4deca8..a959525bb 100644 --- a/analysis/tests/src/expected/Completion.res.txt +++ b/analysis/tests/src/expected/Completion.res.txt @@ -520,10 +520,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CJsxPropValue [O, Comp] second Path O.Comp.make -[extract_type]--> starting extraction of type: string, in env: Completion.O.Comp. Has type arg ctx: false -[nested]--> running nested in env: Completion.O.Comp. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "zzz", "kind": 12, @@ -1746,9 +1742,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 3 pervasives Completion.res Completion.res ContextPath Value[x] Path x -[extract_type]--> starting extraction of type: 'a, in env: Completion. Has type arg ctx: false -[extract_type]--> starting extraction of type: 'a, in env: Completion. Has type arg ctx: false -[extract_type]--> miss Completable: Cpath Value[T] Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder Package opens Pervasives.JsxModules.place holder @@ -2150,9 +2143,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 3 pervasives Completion.res Completion.res ContextPath Type[someVariantWithDeprecated] Path someVariantWithDeprecated -[nested]--> running nested in env: Completion. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "DoNotUseMe", "kind": 4, @@ -2207,18 +2197,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 3 pervasives Completion.res Completion.res ContextPath Type[withUncurried] Path withUncurried -[nested]--> running nested in env: Completion. Has type arg ctx: false -[nested]--> trying to move into record field -[nested]--> found record field type -[nested]--> extracting from type (. int) => unit in env Completion -[extract_type]--> starting extraction of type: (. int) => unit, in env: Completion. Has type arg ctx: false -[extract_type]--> starting extraction of type: (. int) => unit, in env: Completion. Has type arg ctx: false -[nested]--> running nested in env: Completion. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion -[extract_type]--> starting extraction of type: unit, in env: Completion. Has type arg ctx: false -[extract_type]--> digging for type unit in Completion -[extract_type]--> found nothing when digging [{ "label": "(. v) => {}", "kind": 12, diff --git a/analysis/tests/src/expected/CompletionExpressions.res.txt b/analysis/tests/src/expected/CompletionExpressions.res.txt index f59c7e926..0b5a19564 100644 --- a/analysis/tests/src/expected/CompletionExpressions.res.txt +++ b/analysis/tests/src/expected/CompletionExpressions.res.txt @@ -8,9 +8,6 @@ ContextPath Value[s] Path s ContextPath Value[f] Path f -[extract_type]--> starting extraction of type: (bool, option>), in env: CompletionExpressions. Has type arg ctx: false -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> reached end of pattern, returning type [{ "label": "(_, _)", "kind": 12, @@ -28,20 +25,8 @@ Completable: Cexpression CArgument Value[fnTakingRecord]($0)->recordBody Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[fnTakingRecord]($0) ---> function argument: $0 ContextPath Value[fnTakingRecord] Path fnTakingRecord ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type someRecord in CompletionExpressions -[extract_type]--> found record -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type someRecord in CompletionExpressions -[extract_type]--> found record ---> found type in nested expression completion [{ "label": "age", "kind": 5, @@ -87,20 +72,8 @@ Completable: Cexpression CArgument Value[fnTakingRecord]($0)=n->recordBody Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[fnTakingRecord]($0) ---> function argument: $0 ContextPath Value[fnTakingRecord] Path fnTakingRecord ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type someRecord in CompletionExpressions -[extract_type]--> found record -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type someRecord in CompletionExpressions -[extract_type]--> found record ---> found type in nested expression completion [{ "label": "nested", "kind": 5, @@ -116,24 +89,8 @@ Completable: Cexpression CArgument Value[fnTakingRecord]($0)->recordField(offlin Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[fnTakingRecord]($0) ---> function argument: $0 ContextPath Value[fnTakingRecord] Path fnTakingRecord ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type someRecord in CompletionExpressions -[extract_type]--> found record -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> trying to move into record field -[nested]--> found record field type -[nested]--> extracting from type bool in env CompletionExpressions -[extract_type]--> starting extraction of type: bool, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: bool, in env: CompletionExpressions. Has type arg ctx: false -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "true", "kind": 4, @@ -155,20 +112,8 @@ Completable: Cexpression CArgument Value[fnTakingRecord]($0)->recordBody Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[fnTakingRecord]($0) ---> function argument: $0 ContextPath Value[fnTakingRecord] Path fnTakingRecord ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type someRecord in CompletionExpressions -[extract_type]--> found record -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type someRecord in CompletionExpressions -[extract_type]--> found record ---> found type in nested expression completion [{ "label": "offline", "kind": 5, @@ -208,20 +153,8 @@ Completable: Cexpression CArgument Value[fnTakingRecord]($0)->recordBody Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[fnTakingRecord]($0) ---> function argument: $0 ContextPath Value[fnTakingRecord] Path fnTakingRecord ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type someRecord in CompletionExpressions -[extract_type]--> found record -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type someRecord in CompletionExpressions -[extract_type]--> found record ---> found type in nested expression completion [{ "label": "online", "kind": 5, @@ -255,27 +188,8 @@ Completable: Cexpression CArgument Value[fnTakingRecord]($0)->recordField(nested Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[fnTakingRecord]($0) ---> function argument: $0 ContextPath Value[fnTakingRecord] Path fnTakingRecord ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type someRecord in CompletionExpressions -[extract_type]--> found record -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> trying to move into record field -[nested]--> found record field type -[nested]--> extracting from type option in env CompletionExpressions -[extract_type]--> starting extraction of type: option, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: option, in env: CompletionExpressions. Has type arg ctx: false -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion -[extract_type]--> starting extraction of type: otherRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type otherRecord in CompletionExpressions -[extract_type]--> found record [{ "label": "Some(nested)", "kind": 12, @@ -315,23 +229,8 @@ Completable: Cexpression CArgument Value[fnTakingRecord]($0)->recordField(nested Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[fnTakingRecord]($0) ---> function argument: $0 ContextPath Value[fnTakingRecord] Path fnTakingRecord ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type someRecord in CompletionExpressions -[extract_type]--> found record -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> trying to move into record field -[nested]--> found record field type -[nested]--> extracting from type option in env CompletionExpressions -[extract_type]--> starting extraction of type: option, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: option, in env: CompletionExpressions. Has type arg ctx: false -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false ---> could not resolve nested expression path [] Complete src/CompletionExpressions.res 47:51 @@ -341,31 +240,8 @@ Completable: Cexpression CArgument Value[fnTakingRecord]($0)->recordField(nested Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[fnTakingRecord]($0) ---> function argument: $0 ContextPath Value[fnTakingRecord] Path fnTakingRecord ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type someRecord in CompletionExpressions -[extract_type]--> found record -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> trying to move into record field -[nested]--> found record field type -[nested]--> extracting from type option in env CompletionExpressions -[extract_type]--> starting extraction of type: option, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: option, in env: CompletionExpressions. Has type arg ctx: false -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> moving into option Some -[extract_type]--> starting extraction of type: otherRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type otherRecord in CompletionExpressions -[extract_type]--> found record -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: otherRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type otherRecord in CompletionExpressions -[extract_type]--> found record ---> found type in nested expression completion [{ "label": "someField", "kind": 5, @@ -387,26 +263,8 @@ Completable: Cexpression CArgument Value[fnTakingRecord]($0)->recordField(varian Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[fnTakingRecord]($0) ---> function argument: $0 ContextPath Value[fnTakingRecord] Path fnTakingRecord ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type someRecord in CompletionExpressions -[extract_type]--> found record -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> trying to move into record field -[nested]--> found record field type -[nested]--> extracting from type someVariant in env CompletionExpressions -[extract_type]--> starting extraction of type: someVariant, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: someVariant, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type someVariant in CompletionExpressions -[extract_type]--> found variant -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "One", "kind": 4, @@ -440,26 +298,8 @@ Completable: Cexpression CArgument Value[fnTakingRecord]($0)=O->recordField(vari Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[fnTakingRecord]($0) ---> function argument: $0 ContextPath Value[fnTakingRecord] Path fnTakingRecord ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type someRecord in CompletionExpressions -[extract_type]--> found record -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> trying to move into record field -[nested]--> found record field type -[nested]--> extracting from type someVariant in env CompletionExpressions -[extract_type]--> starting extraction of type: someVariant, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: someVariant, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type someVariant in CompletionExpressions -[extract_type]--> found variant -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "One", "kind": 4, @@ -477,31 +317,8 @@ Completable: Cexpression CArgument Value[fnTakingRecord]($0)->recordField(polyva Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[fnTakingRecord]($0) ---> function argument: $0 ContextPath Value[fnTakingRecord] Path fnTakingRecord ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type someRecord in CompletionExpressions -[extract_type]--> found record -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> trying to move into record field -[nested]--> found record field type -[nested]--> extracting from type somePolyVariant in env CompletionExpressions -[extract_type]--> starting extraction of type: somePolyVariant, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: somePolyVariant, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type somePolyVariant in CompletionExpressions -[extract_type]--> found type manifest -[extract_type]--> starting extraction of type: [#one | #three(someRecord, bool) | #two(bool)], in env: CompletionExpressions. Has type arg ctx: false -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type someRecord in CompletionExpressions -[extract_type]--> found record -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "{}", "kind": 12, @@ -520,29 +337,8 @@ Completable: Cexpression CArgument Value[fnTakingRecord]($0)->recordField(polyva Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[fnTakingRecord]($0) ---> function argument: $0 ContextPath Value[fnTakingRecord] Path fnTakingRecord ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type someRecord in CompletionExpressions -[extract_type]--> found record -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> trying to move into record field -[nested]--> found record field type -[nested]--> extracting from type somePolyVariant in env CompletionExpressions -[extract_type]--> starting extraction of type: somePolyVariant, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: somePolyVariant, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type somePolyVariant in CompletionExpressions -[extract_type]--> found type manifest -[extract_type]--> starting extraction of type: [#one | #three(someRecord, bool) | #two(bool)], in env: CompletionExpressions. Has type arg ctx: false -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: bool, in env: CompletionExpressions. Has type arg ctx: false -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "true", "kind": 4, @@ -564,29 +360,8 @@ Completable: Cexpression CArgument Value[fnTakingRecord]($0)=t->recordField(poly Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[fnTakingRecord]($0) ---> function argument: $0 ContextPath Value[fnTakingRecord] Path fnTakingRecord ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type someRecord in CompletionExpressions -[extract_type]--> found record -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> trying to move into record field -[nested]--> found record field type -[nested]--> extracting from type somePolyVariant in env CompletionExpressions -[extract_type]--> starting extraction of type: somePolyVariant, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: somePolyVariant, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type somePolyVariant in CompletionExpressions -[extract_type]--> found type manifest -[extract_type]--> starting extraction of type: [#one | #three(someRecord, bool) | #two(bool)], in env: CompletionExpressions. Has type arg ctx: false -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: bool, in env: CompletionExpressions. Has type arg ctx: false -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "true", "kind": 4, @@ -602,16 +377,8 @@ Completable: Cexpression CArgument Value[fnTakingArray]($0) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[fnTakingArray]($0) ---> function argument: $0 ContextPath Value[fnTakingArray] Path fnTakingArray ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: array>, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: array>, in env: CompletionExpressions. Has type arg ctx: false -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "[]", "kind": 12, @@ -630,19 +397,8 @@ Completable: Cexpression CArgument Value[fnTakingArray]($0)->array Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[fnTakingArray]($0) ---> function argument: $0 ContextPath Value[fnTakingArray] Path fnTakingArray ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: array>, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: array>, in env: CompletionExpressions. Has type arg ctx: false -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: option, in env: CompletionExpressions. Has type arg ctx: false -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion -[extract_type]--> starting extraction of type: bool, in env: CompletionExpressions. Has type arg ctx: false [{ "label": "None", "kind": 12, @@ -678,16 +434,8 @@ Completable: Cexpression CArgument Value[fnTakingArray]($0)=s Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[fnTakingArray]($0) ---> function argument: $0 ContextPath Value[fnTakingArray] Path fnTakingArray ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: array>, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: array>, in env: CompletionExpressions. Has type arg ctx: false -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "s", "kind": 12, @@ -703,21 +451,8 @@ Completable: Cexpression CArgument Value[fnTakingArray]($0)->array, variantPaylo Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[fnTakingArray]($0) ---> function argument: $0 ContextPath Value[fnTakingArray] Path fnTakingArray ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: array>, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: array>, in env: CompletionExpressions. Has type arg ctx: false -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: option, in env: CompletionExpressions. Has type arg ctx: false -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> moving into option Some -[extract_type]--> starting extraction of type: bool, in env: CompletionExpressions. Has type arg ctx: false -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "true", "kind": 4, @@ -739,19 +474,8 @@ Completable: Cexpression CArgument Value[fnTakingArray]($0)->array Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[fnTakingArray]($0) ---> function argument: $0 ContextPath Value[fnTakingArray] Path fnTakingArray ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: array>, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: array>, in env: CompletionExpressions. Has type arg ctx: false -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: option, in env: CompletionExpressions. Has type arg ctx: false -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion -[extract_type]--> starting extraction of type: bool, in env: CompletionExpressions. Has type arg ctx: false [{ "label": "None", "kind": 12, @@ -787,19 +511,8 @@ Completable: Cexpression CArgument Value[fnTakingArray]($0)->array Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[fnTakingArray]($0) ---> function argument: $0 ContextPath Value[fnTakingArray] Path fnTakingArray ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: array>, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: array>, in env: CompletionExpressions. Has type arg ctx: false -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: option, in env: CompletionExpressions. Has type arg ctx: false -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion -[extract_type]--> starting extraction of type: bool, in env: CompletionExpressions. Has type arg ctx: false [{ "label": "None", "kind": 12, @@ -835,18 +548,8 @@ Completable: Cexpression CArgument Value[fnTakingRecord]($0)=so Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[fnTakingRecord]($0) ---> function argument: $0 ContextPath Value[fnTakingRecord] Path fnTakingRecord ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: someRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type someRecord in CompletionExpressions -[extract_type]--> found record -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "someBoolVar", "kind": 12, @@ -862,24 +565,8 @@ Completable: Cexpression CArgument Value[fnTakingOtherRecord]($0)->recordField(o Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[fnTakingOtherRecord]($0) ---> function argument: $0 ContextPath Value[fnTakingOtherRecord] Path fnTakingOtherRecord ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: otherRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: otherRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type otherRecord in CompletionExpressions -[extract_type]--> found record -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> trying to move into record field -[nested]--> found record field type -[nested]--> extracting from type string in env CompletionExpressions -[extract_type]--> starting extraction of type: string, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: string, in env: CompletionExpressions. Has type arg ctx: false -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "\"\"", "kind": 12, @@ -898,23 +585,8 @@ Completable: Cexpression CArgument Value[fnTakingRecordWithOptionalField]($0)->r Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[fnTakingRecordWithOptionalField]($0) ---> function argument: $0 ContextPath Value[fnTakingRecordWithOptionalField] Path fnTakingRecordWithOptionalField ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: recordWithOptionalField, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: recordWithOptionalField, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type recordWithOptionalField in CompletionExpressions -[extract_type]--> found record -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> trying to move into record field -[nested]--> found record field type -[nested]--> extracting from type bool in env CompletionExpressions -[extract_type]--> starting extraction of type: bool, in env: CompletionExpressions. Has type arg ctx: false -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "true", "kind": 4, @@ -936,27 +608,8 @@ Completable: Cexpression CArgument Value[fnTakingRecordWithOptVariant]($0)->reco Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[fnTakingRecordWithOptVariant]($0) ---> function argument: $0 ContextPath Value[fnTakingRecordWithOptVariant] Path fnTakingRecordWithOptVariant ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: recordWithOptVariant, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: recordWithOptVariant, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type recordWithOptVariant in CompletionExpressions -[extract_type]--> found record -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> trying to move into record field -[nested]--> found record field type -[nested]--> extracting from type option in env CompletionExpressions -[extract_type]--> starting extraction of type: option, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: option, in env: CompletionExpressions. Has type arg ctx: false -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion -[extract_type]--> starting extraction of type: someVariant, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type someVariant in CompletionExpressions -[extract_type]--> found variant [{ "label": "Some(someVariant)", "kind": 12, @@ -1012,21 +665,8 @@ Completable: Cexpression CArgument Value[fnTakingInlineRecord]($0)->variantPaylo Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[fnTakingInlineRecord]($0) ---> function argument: $0 ContextPath Value[fnTakingInlineRecord] Path fnTakingInlineRecord ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: variantWithInlineRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: variantWithInlineRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type variantWithInlineRecord in CompletionExpressions -[extract_type]--> found variant -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> trying to move into variant payload $0 of constructor 'WithInlineRecord' -[nested]--> found constructor (inline record) -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "{}", "kind": 4, @@ -1045,20 +685,8 @@ Completable: Cexpression CArgument Value[fnTakingInlineRecord]($0)->variantPaylo Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[fnTakingInlineRecord]($0) ---> function argument: $0 ContextPath Value[fnTakingInlineRecord] Path fnTakingInlineRecord ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: variantWithInlineRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: variantWithInlineRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type variantWithInlineRecord in CompletionExpressions -[extract_type]--> found variant -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> trying to move into variant payload $0 of constructor 'WithInlineRecord' -[nested]--> found constructor (inline record) -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false ---> found type in nested expression completion [{ "label": "someBoolField", "kind": 4, @@ -1086,20 +714,8 @@ Completable: Cexpression CArgument Value[fnTakingInlineRecord]($0)=s->variantPay Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[fnTakingInlineRecord]($0) ---> function argument: $0 ContextPath Value[fnTakingInlineRecord] Path fnTakingInlineRecord ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: variantWithInlineRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: variantWithInlineRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type variantWithInlineRecord in CompletionExpressions -[extract_type]--> found variant -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> trying to move into variant payload $0 of constructor 'WithInlineRecord' -[nested]--> found constructor (inline record) -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false ---> found type in nested expression completion [{ "label": "someBoolField", "kind": 4, @@ -1115,29 +731,8 @@ Completable: Cexpression CArgument Value[fnTakingInlineRecord]($0)->variantPaylo Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[fnTakingInlineRecord]($0) ---> function argument: $0 ContextPath Value[fnTakingInlineRecord] Path fnTakingInlineRecord ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: variantWithInlineRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: variantWithInlineRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type variantWithInlineRecord in CompletionExpressions -[extract_type]--> found variant -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> trying to move into variant payload $0 of constructor 'WithInlineRecord' -[nested]--> found constructor (inline record) -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> trying to move into record field -[nested]--> found record field type -[nested]--> extracting from type otherRecord in env CompletionExpressions -[extract_type]--> starting extraction of type: otherRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: otherRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type otherRecord in CompletionExpressions -[extract_type]--> found record -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "{}", "kind": 12, @@ -1156,31 +751,8 @@ Completable: Cexpression CArgument Value[fnTakingInlineRecord]($0)->variantPaylo Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[fnTakingInlineRecord]($0) ---> function argument: $0 ContextPath Value[fnTakingInlineRecord] Path fnTakingInlineRecord ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: variantWithInlineRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: variantWithInlineRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type variantWithInlineRecord in CompletionExpressions -[extract_type]--> found variant -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> trying to move into variant payload $0 of constructor 'WithInlineRecord' -[nested]--> found constructor (inline record) -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> trying to move into record field -[nested]--> found record field type -[nested]--> extracting from type otherRecord in env CompletionExpressions -[extract_type]--> starting extraction of type: otherRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: otherRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type otherRecord in CompletionExpressions -[extract_type]--> found record -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: otherRecord, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type otherRecord in CompletionExpressions -[extract_type]--> found record ---> found type in nested expression completion [{ "label": "someField", "kind": 5, @@ -1202,19 +774,8 @@ Completable: Cexpression CArgument Value[fnTakingCallback]($0) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[fnTakingCallback]($0) ---> function argument: $0 ContextPath Value[fnTakingCallback] Path fnTakingCallback ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: unit => unit, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: unit => unit, in env: CompletionExpressions. Has type arg ctx: false -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion -[extract_type]--> starting extraction of type: unit, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type unit in CompletionExpressions -[extract_type]--> found nothing when digging [{ "label": "() => {}", "kind": 12, @@ -1233,16 +794,8 @@ Completable: Cexpression CArgument Value[fnTakingCallback]($0)=a Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[fnTakingCallback]($0) ---> function argument: $0 ContextPath Value[fnTakingCallback] Path fnTakingCallback ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: unit => unit, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: unit => unit, in env: CompletionExpressions. Has type arg ctx: false -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [] Complete src/CompletionExpressions.res 165:22 @@ -1252,19 +805,8 @@ Completable: Cexpression CArgument Value[fnTakingCallback]($1) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[fnTakingCallback]($1) ---> function argument: $1 ContextPath Value[fnTakingCallback] Path fnTakingCallback ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: bool => unit, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: bool => unit, in env: CompletionExpressions. Has type arg ctx: false -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion -[extract_type]--> starting extraction of type: unit, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type unit in CompletionExpressions -[extract_type]--> found nothing when digging [{ "label": "v => {}", "kind": 12, @@ -1283,19 +825,8 @@ Completable: Cexpression CArgument Value[fnTakingCallback]($2) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[fnTakingCallback]($2) ---> function argument: $2 ContextPath Value[fnTakingCallback] Path fnTakingCallback ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: ReactEvent.Mouse.t => unit, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: ReactEvent.Mouse.t => unit, in env: CompletionExpressions. Has type arg ctx: false -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion -[extract_type]--> starting extraction of type: unit, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type unit in CompletionExpressions -[extract_type]--> found nothing when digging [{ "label": "event => {}", "kind": 12, @@ -1314,19 +845,8 @@ Completable: Cexpression CArgument Value[fnTakingCallback]($3) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[fnTakingCallback]($3) ---> function argument: $3 ContextPath Value[fnTakingCallback] Path fnTakingCallback ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: (~on: bool, ~off: bool=?, variant) => int, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: (~on: bool, ~off: bool=?, variant) => int, in env: CompletionExpressions. Has type arg ctx: false -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion -[extract_type]--> starting extraction of type: int, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type int in CompletionExpressions -[extract_type]--> found nothing when digging [{ "label": "(~on, ~off=?, variant) => {}", "kind": 12, @@ -1345,19 +865,8 @@ Completable: Cexpression CArgument Value[fnTakingCallback]($4) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[fnTakingCallback]($4) ---> function argument: $4 ContextPath Value[fnTakingCallback] Path fnTakingCallback ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: (bool, option, bool) => unit, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: (bool, option, bool) => unit, in env: CompletionExpressions. Has type arg ctx: false -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion -[extract_type]--> starting extraction of type: unit, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type unit in CompletionExpressions -[extract_type]--> found nothing when digging [{ "label": "(v1, v2, v3) => {}", "kind": 12, @@ -1376,19 +885,8 @@ Completable: Cexpression CArgument Value[fnTakingCallback]($5) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[fnTakingCallback]($5) ---> function argument: $5 ContextPath Value[fnTakingCallback] Path fnTakingCallback ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: (~on: bool=?, ~off: bool=?, unit) => int, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: (~on: bool=?, ~off: bool=?, unit) => int, in env: CompletionExpressions. Has type arg ctx: false -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion -[extract_type]--> starting extraction of type: int, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type int in CompletionExpressions -[extract_type]--> found nothing when digging [{ "label": "(~on=?, ~off=?, ()) => {}", "kind": 12, @@ -1411,16 +909,8 @@ Completable: Cexpression CArgument Value[Js, log]($0)=s Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[Js, log]($0) ---> function argument: $0 ContextPath Value[Js, log] Path Js.log ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: 'a, in env: Js. Has type arg ctx: false -[extract_type]--> starting extraction of type: 'a, in env: Js. Has type arg ctx: false -[extract_type]--> found type variable: 'a. Trying to instantiate with no type args ctx -[extract_type]--> could not instantiate 'a. Skipping. ---> could not get completions for context path [{ "label": "second2", "kind": 12, @@ -1471,18 +961,8 @@ Completable: Cexpression CArgument Value[takesCb]($0) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[takesCb]($0) ---> function argument: $0 ContextPath Value[takesCb] Path takesCb ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: someTyp => 'a, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: someTyp => 'a, in env: CompletionExpressions. Has type arg ctx: false -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion -[extract_type]--> starting extraction of type: 'a, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> miss [{ "label": "someTyp => {}", "kind": 12, @@ -1501,18 +981,8 @@ Completable: Cexpression CArgument Value[takesCb2]($0) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[takesCb2]($0) ---> function argument: $0 ContextPath Value[takesCb2] Path takesCb2 ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: Environment.t => 'a, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: Environment.t => 'a, in env: CompletionExpressions. Has type arg ctx: false -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion -[extract_type]--> starting extraction of type: 'a, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> miss [{ "label": "environment => {}", "kind": 12, @@ -1531,18 +1001,8 @@ Completable: Cexpression CArgument Value[takesCb3]($0) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[takesCb3]($0) ---> function argument: $0 ContextPath Value[takesCb3] Path takesCb3 ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: apiCallResult => 'a, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: apiCallResult => 'a, in env: CompletionExpressions. Has type arg ctx: false -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion -[extract_type]--> starting extraction of type: 'a, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> miss [{ "label": "apiCallResult => {}", "kind": 12, @@ -1561,18 +1021,8 @@ Completable: Cexpression CArgument Value[takesCb4]($0) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[takesCb4]($0) ---> function argument: $0 ContextPath Value[takesCb4] Path takesCb4 ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: option => 'a, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: option => 'a, in env: CompletionExpressions. Has type arg ctx: false -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion -[extract_type]--> starting extraction of type: 'a, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> miss [{ "label": "apiCallResult => {}", "kind": 12, @@ -1591,18 +1041,8 @@ Completable: Cexpression CArgument Value[takesCb5]($0) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[takesCb5]($0) ---> function argument: $0 ContextPath Value[takesCb5] Path takesCb5 ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: array> => 'a, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: array> => 'a, in env: CompletionExpressions. Has type arg ctx: false -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion -[extract_type]--> starting extraction of type: 'a, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> miss [{ "label": "apiCallResults => {}", "kind": 12, @@ -1621,18 +1061,8 @@ Completable: Cexpression CArgument Value[commitLocalUpdate](~updater) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[commitLocalUpdate](~updater) ---> function argument: updater ContextPath Value[commitLocalUpdate] Path commitLocalUpdate ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: RecordSourceSelectorProxy.t => unit, in env: CompletionExpressions. Has type arg ctx: false -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion -[extract_type]--> starting extraction of type: unit, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type unit in CompletionExpressions -[extract_type]--> found nothing when digging [{ "label": "recordSourceSelectorProxy => {}", "kind": 12, @@ -1651,17 +1081,8 @@ Completable: Cexpression CArgument Value[fnTakingAsyncCallback]($0) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[fnTakingAsyncCallback]($0) ---> function argument: $0 ContextPath Value[fnTakingAsyncCallback] Path fnTakingAsyncCallback ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: unit => promise, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: unit => promise, in env: CompletionExpressions. Has type arg ctx: false -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion -[extract_type]--> starting extraction of type: promise, in env: CompletionExpressions. Has type arg ctx: false [{ "label": "async () => {}", "kind": 12, @@ -1679,18 +1100,8 @@ Completable: Cexpression CArgument Value[Belt, Array, map]($1) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[Belt, Array, map]($1) ---> function argument: $1 ContextPath Value[Belt, Array, map] Path Belt.Array.map ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: 'a => 'b, in env: Belt_Array. Has type arg ctx: false -[nested]--> running nested in env: Belt_Array. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion -[extract_type]--> starting extraction of type: 'b, in env: Belt_Array. Has type arg ctx: false -[extract_type]--> found type variable: 'b. Trying to instantiate with no type args ctx -[extract_type]--> could not instantiate 'b. Skipping. [{ "label": "v => {}", "kind": 12, @@ -1709,19 +1120,8 @@ Completable: Cexpression CArgument Value[takesExotic]($0) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[takesExotic]($0) ---> function argument: $0 ContextPath Value[takesExotic] Path takesExotic ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: exoticPolyvariant, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: exoticPolyvariant, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type exoticPolyvariant in CompletionExpressions -[extract_type]--> found type manifest -[extract_type]--> starting extraction of type: [#"some exotic"], in env: CompletionExpressions. Has type arg ctx: false -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "#\"some exotic\"", "kind": 4, @@ -1739,19 +1139,8 @@ Completable: Cexpression CArgument Value[fnTakingPolyVariant]($0) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[fnTakingPolyVariant]($0) ---> function argument: $0 ContextPath Value[fnTakingPolyVariant] Path fnTakingPolyVariant ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: somePolyVariant, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: somePolyVariant, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type somePolyVariant in CompletionExpressions -[extract_type]--> found type manifest -[extract_type]--> starting extraction of type: [#one | #three(someRecord, bool) | #two(bool)], in env: CompletionExpressions. Has type arg ctx: false -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "#one", "kind": 4, @@ -1785,19 +1174,8 @@ Completable: Cexpression CArgument Value[fnTakingPolyVariant]($0)=# Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[fnTakingPolyVariant]($0) ---> function argument: $0 ContextPath Value[fnTakingPolyVariant] Path fnTakingPolyVariant ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: somePolyVariant, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: somePolyVariant, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type somePolyVariant in CompletionExpressions -[extract_type]--> found type manifest -[extract_type]--> starting extraction of type: [#one | #three(someRecord, bool) | #two(bool)], in env: CompletionExpressions. Has type arg ctx: false -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "#one", "kind": 4, @@ -1831,19 +1209,8 @@ Completable: Cexpression CArgument Value[fnTakingPolyVariant]($0)=#o Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[fnTakingPolyVariant]($0) ---> function argument: $0 ContextPath Value[fnTakingPolyVariant] Path fnTakingPolyVariant ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: somePolyVariant, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: somePolyVariant, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type somePolyVariant in CompletionExpressions -[extract_type]--> found type manifest -[extract_type]--> starting extraction of type: [#one | #three(someRecord, bool) | #two(bool)], in env: CompletionExpressions. Has type arg ctx: false -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "#one", "kind": 4, @@ -1861,19 +1228,8 @@ Completable: Cexpression CArgument Value[fnTakingPolyVariant]($0)=o Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[fnTakingPolyVariant]($0) ---> function argument: $0 ContextPath Value[fnTakingPolyVariant] Path fnTakingPolyVariant ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: somePolyVariant, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: somePolyVariant, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type somePolyVariant in CompletionExpressions -[extract_type]--> found type manifest -[extract_type]--> starting extraction of type: [#one | #three(someRecord, bool) | #two(bool)], in env: CompletionExpressions. Has type arg ctx: false -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "#one", "kind": 4, @@ -1891,16 +1247,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Type[withIntLocal] Path withIntLocal -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> trying to move into record field -[nested]--> found record field type -[nested]--> extracting from type SuperInt.t in env CompletionExpressions -[extract_type]--> starting extraction of type: SuperInt.t, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> starting extraction of type: SuperInt.t, in env: CompletionExpressions. Has type arg ctx: false -[extract_type]--> digging for type SuperInt.t in CompletionExpressions -[nested]--> running nested in env: CompletionExpressions. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "SuperInt.make()", "kind": 12, @@ -1918,17 +1264,8 @@ Completable: Cexpression CArgument Value[CompletionSupport, makeTestHidden]($0) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[CompletionSupport, makeTestHidden]($0) ---> function argument: $0 ContextPath Value[CompletionSupport, makeTestHidden] Path CompletionSupport.makeTestHidden ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: TestHidden.t, in env: CompletionSupport. Has type arg ctx: false -[extract_type]--> starting extraction of type: TestHidden.t, in env: CompletionSupport. Has type arg ctx: false -[extract_type]--> digging for type TestHidden.t in CompletionSupport -[nested]--> running nested in env: CompletionSupport. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "CompletionSupport.TestHidden.make()", "kind": 12, @@ -1947,17 +1284,8 @@ Raw opens: 1 CompletionSupport.place holder Package opens Pervasives.JsxModules.place holder Resolved opens 2 pervasives CompletionSupport.res ContextPath CArgument Value[CompletionSupport, makeTestHidden]($0) ---> function argument: $0 ContextPath Value[CompletionSupport, makeTestHidden] Path CompletionSupport.makeTestHidden ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: TestHidden.t, in env: CompletionSupport. Has type arg ctx: false -[extract_type]--> starting extraction of type: TestHidden.t, in env: CompletionSupport. Has type arg ctx: false -[extract_type]--> digging for type TestHidden.t in CompletionSupport -[nested]--> running nested in env: CompletionSupport. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "TestHidden.make()", "kind": 12, diff --git a/analysis/tests/src/expected/CompletionFunctionArguments.res.txt b/analysis/tests/src/expected/CompletionFunctionArguments.res.txt index e8b2447af..85010ef4f 100644 --- a/analysis/tests/src/expected/CompletionFunctionArguments.res.txt +++ b/analysis/tests/src/expected/CompletionFunctionArguments.res.txt @@ -5,16 +5,8 @@ Completable: Cexpression CArgument Value[someFn](~isOn) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[someFn](~isOn) ---> function argument: isOn ContextPath Value[someFn] Path someFn ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: bool, in env: CompletionFunctionArguments. Has type arg ctx: false -[extract_type]--> starting extraction of type: bool, in env: CompletionFunctionArguments. Has type arg ctx: false -[nested]--> running nested in env: CompletionFunctionArguments. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "true", "kind": 4, @@ -36,16 +28,8 @@ Completable: Cexpression CArgument Value[someFn](~isOn)=t Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[someFn](~isOn) ---> function argument: isOn ContextPath Value[someFn] Path someFn ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: bool, in env: CompletionFunctionArguments. Has type arg ctx: false -[extract_type]--> starting extraction of type: bool, in env: CompletionFunctionArguments. Has type arg ctx: false -[nested]--> running nested in env: CompletionFunctionArguments. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "true", "kind": 4, @@ -68,16 +52,8 @@ Completable: Cexpression CArgument Value[someFn](~isOff) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[someFn](~isOff) ---> function argument: isOff ContextPath Value[someFn] Path someFn ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: bool, in env: CompletionFunctionArguments. Has type arg ctx: false -[extract_type]--> starting extraction of type: bool, in env: CompletionFunctionArguments. Has type arg ctx: false -[nested]--> running nested in env: CompletionFunctionArguments. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "true", "kind": 4, @@ -103,16 +79,8 @@ Completable: Cexpression CArgument Value[someFn](~isOn) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[someFn](~isOn) ---> function argument: isOn ContextPath Value[someFn] Path someFn ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: bool, in env: CompletionFunctionArguments. Has type arg ctx: false -[extract_type]--> starting extraction of type: bool, in env: CompletionFunctionArguments. Has type arg ctx: false -[nested]--> running nested in env: CompletionFunctionArguments. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "true", "kind": 4, @@ -134,16 +102,8 @@ Completable: Cexpression CArgument Value[someOtherFn]($0)=f Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[someOtherFn]($0) ---> function argument: $0 ContextPath Value[someOtherFn] Path someOtherFn ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: bool, in env: CompletionFunctionArguments. Has type arg ctx: false -[extract_type]--> starting extraction of type: bool, in env: CompletionFunctionArguments. Has type arg ctx: false -[nested]--> running nested in env: CompletionFunctionArguments. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "false", "kind": 4, @@ -159,18 +119,8 @@ Completable: Cexpression CArgument Value[someFnTakingVariant](~config) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[someFnTakingVariant](~config) ---> function argument: config ContextPath Value[someFnTakingVariant] Path someFnTakingVariant ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: someVariant, in env: CompletionFunctionArguments. Has type arg ctx: false -[extract_type]--> starting extraction of type: someVariant, in env: CompletionFunctionArguments. Has type arg ctx: false -[extract_type]--> digging for type someVariant in CompletionFunctionArguments -[extract_type]--> found variant -[nested]--> running nested in env: CompletionFunctionArguments. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "One", "kind": 4, @@ -204,18 +154,8 @@ Completable: Cexpression CArgument Value[someFnTakingVariant](~config)=O Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[someFnTakingVariant](~config) ---> function argument: config ContextPath Value[someFnTakingVariant] Path someFnTakingVariant ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: someVariant, in env: CompletionFunctionArguments. Has type arg ctx: false -[extract_type]--> starting extraction of type: someVariant, in env: CompletionFunctionArguments. Has type arg ctx: false -[extract_type]--> digging for type someVariant in CompletionFunctionArguments -[extract_type]--> found variant -[nested]--> running nested in env: CompletionFunctionArguments. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "One", "kind": 4, @@ -252,19 +192,8 @@ Completable: Cexpression CArgument Value[someFnTakingVariant]($0)=So Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[someFnTakingVariant]($0) ---> function argument: $0 ContextPath Value[someFnTakingVariant] Path someFnTakingVariant ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: option, in env: CompletionFunctionArguments. Has type arg ctx: false -[extract_type]--> starting extraction of type: option, in env: CompletionFunctionArguments. Has type arg ctx: false -[nested]--> running nested in env: CompletionFunctionArguments. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion -[extract_type]--> starting extraction of type: someVariant, in env: CompletionFunctionArguments. Has type arg ctx: false -[extract_type]--> digging for type someVariant in CompletionFunctionArguments -[extract_type]--> found variant [{ "label": "Some(_)", "kind": 12, @@ -289,18 +218,8 @@ Completable: Cexpression CArgument Value[someFnTakingVariant](~configOpt2)=O Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[someFnTakingVariant](~configOpt2) ---> function argument: configOpt2 ContextPath Value[someFnTakingVariant] Path someFnTakingVariant ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: someVariant, in env: CompletionFunctionArguments. Has type arg ctx: false -[extract_type]--> starting extraction of type: someVariant, in env: CompletionFunctionArguments. Has type arg ctx: false -[extract_type]--> digging for type someVariant in CompletionFunctionArguments -[extract_type]--> found variant -[nested]--> running nested in env: CompletionFunctionArguments. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "One", "kind": 4, @@ -337,16 +256,8 @@ Completable: Cexpression CArgument Value[someOtherFn]($0) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[someOtherFn]($0) ---> function argument: $0 ContextPath Value[someOtherFn] Path someOtherFn ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: bool, in env: CompletionFunctionArguments. Has type arg ctx: false -[extract_type]--> starting extraction of type: bool, in env: CompletionFunctionArguments. Has type arg ctx: false -[nested]--> running nested in env: CompletionFunctionArguments. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "true", "kind": 4, @@ -368,16 +279,8 @@ Completable: Cexpression CArgument Value[someOtherFn]($2) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[someOtherFn]($2) ---> function argument: $2 ContextPath Value[someOtherFn] Path someOtherFn ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: bool, in env: CompletionFunctionArguments. Has type arg ctx: false -[extract_type]--> starting extraction of type: bool, in env: CompletionFunctionArguments. Has type arg ctx: false -[nested]--> running nested in env: CompletionFunctionArguments. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "true", "kind": 4, @@ -398,16 +301,8 @@ Completable: Cexpression CArgument Value[someOtherFn]($2)=t Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[someOtherFn]($2) ---> function argument: $2 ContextPath Value[someOtherFn] Path someOtherFn ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: bool, in env: CompletionFunctionArguments. Has type arg ctx: false -[extract_type]--> starting extraction of type: bool, in env: CompletionFunctionArguments. Has type arg ctx: false -[nested]--> running nested in env: CompletionFunctionArguments. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "true", "kind": 4, @@ -430,16 +325,8 @@ Completable: Cexpression CArgument Value[fnTakingTuple]($0) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[fnTakingTuple]($0) ---> function argument: $0 ContextPath Value[fnTakingTuple] Path fnTakingTuple ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: (int, int, float), in env: CompletionFunctionArguments. Has type arg ctx: false -[extract_type]--> starting extraction of type: (int, int, float), in env: CompletionFunctionArguments. Has type arg ctx: false -[nested]--> running nested in env: CompletionFunctionArguments. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "(_, _, _)", "kind": 12, @@ -457,20 +344,8 @@ Completable: Cexpression CArgument Value[fnTakingRecord]($0)->recordBody Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[fnTakingRecord]($0) ---> function argument: $0 ContextPath Value[fnTakingRecord] Path fnTakingRecord ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: someRecord, in env: CompletionFunctionArguments. Has type arg ctx: false -[extract_type]--> starting extraction of type: someRecord, in env: CompletionFunctionArguments. Has type arg ctx: false -[extract_type]--> digging for type someRecord in CompletionFunctionArguments -[extract_type]--> found record -[nested]--> running nested in env: CompletionFunctionArguments. Has type arg ctx: false -[extract_type]--> starting extraction of type: someRecord, in env: CompletionFunctionArguments. Has type arg ctx: false -[extract_type]--> digging for type someRecord in CompletionFunctionArguments -[extract_type]--> found record ---> found type in nested expression completion [{ "label": "age", "kind": 5, diff --git a/analysis/tests/src/expected/CompletionInferValues.res.txt b/analysis/tests/src/expected/CompletionInferValues.res.txt index d8ce972b1..d9e28dd9c 100644 --- a/analysis/tests/src/expected/CompletionInferValues.res.txt +++ b/analysis/tests/src/expected/CompletionInferValues.res.txt @@ -94,15 +94,9 @@ ContextPath Value[someRecord]."" ContextPath Value[someRecord] Path someRecord ContextPath CArgument CArgument Value[someFnWithCallback]($0)(~someRecord) ---> function argument: someRecord ContextPath CArgument Value[someFnWithCallback]($0) ---> function argument: $0 ContextPath Value[someFnWithCallback] Path someFnWithCallback ---> found function type ---> found function argument! ---> found function type ---> found function argument! [{ "label": "name", "kind": 5, @@ -132,17 +126,11 @@ ContextPath Value[someRecord]."" ContextPath Value[someRecord] Path someRecord ContextPath CArgument CArgument Value[aliasedFn]($0)(~someRecord) ---> function argument: someRecord ContextPath CArgument Value[aliasedFn]($0) ---> function argument: $0 ContextPath Value[aliasedFn] Path aliasedFn ContextPath Value[someFnWithCallback] Path someFnWithCallback ---> found function type ---> found function argument! ---> found function type ---> found function argument! [{ "label": "name", "kind": 5, @@ -169,15 +157,9 @@ ContextPath Value[event]->pr ContextPath Value[event] Path event ContextPath CArgument CArgument Value[reactEventFn]($0)($0) ---> function argument: $0 ContextPath CArgument Value[reactEventFn]($0) ---> function argument: $0 ContextPath Value[reactEventFn] Path reactEventFn ---> found function type ---> found function argument! ---> found function type ---> found function argument! CPPipe env:CompletionInferValues CPPipe type path:ReactEvent.Mouse.t CPPipe pathFromEnv:ReactEvent.Mouse found:false @@ -202,12 +184,9 @@ ContextPath Value[event]->pr <> ContextPath Value[event] Path event ContextPath CArgument CJsxPropValue [div] onMouseEnter($0) ---> function argument: $0 ContextPath CJsxPropValue [div] onMouseEnter Path ReactDOM.domProps Path Pervasives.JsxDOM.domProps ---> found function type ---> found function argument! CPPipe env:CompletionInferValues CPPipe type path:JsxEventC.Mouse.t CPPipe pathFromEnv:JsxEventC.Mouse found:false @@ -232,11 +211,8 @@ ContextPath Value[event]->pr <> ContextPath Value[event] Path event ContextPath CArgument CJsxPropValue [Div] onMouseEnter($0) ---> function argument: $0 ContextPath CJsxPropValue [Div] onMouseEnter Path Div.make ---> found function type ---> found function argument! CPPipe env:CompletionInferValues envFromCompletionItem:CompletionInferValues.Div CPPipe type path:Pervasives.JsxEvent.Mouse.t CPPipe pathFromEnv:Pervasives.JsxEvent.Mouse found:false @@ -393,7 +369,6 @@ ContextPath Value[x] Path x ContextPath Type[someRecordWithNestedStuff] Path someRecordWithNestedStuff -[nested_pattern_path] [{ "label": "name", "kind": 5, @@ -422,7 +397,6 @@ ContextPath Value[x] Path x ContextPath Type[someRecordWithNestedStuff] Path someRecordWithNestedStuff -[nested_pattern_path] [{ "label": "someRecord", "kind": 5, @@ -445,8 +419,6 @@ ContextPath Value[x] Path x ContextPath Type[someRecordWithNestedStuff] Path someRecordWithNestedStuff -[nested_pattern_path] -[nested_pattern_path] [{ "label": "name", "kind": 5, @@ -474,7 +446,6 @@ ContextPath Value[x] Path x ContextPath Type[someRecordWithNestedStuff] Path someRecordWithNestedStuff -[nested_pattern_path] CPPipe env:CompletionInferValues Path Js.String2.slic [{ @@ -504,7 +475,6 @@ ContextPath Value[x] Path x ContextPath Type[someRecordWithNestedStuff] Path someRecordWithNestedStuff -[nested_pattern_path] CPPipe env:CompletionInferValues Path Belt.Int.toS [{ @@ -531,8 +501,6 @@ ContextPath Value[x] Path x ContextPath Type[otherNestedRecord] Path otherNestedRecord -[nested_pattern_path] -[nested_pattern_path] CPPipe env:CompletionInferValues Path Belt.Int.toS [{ @@ -560,8 +528,6 @@ ContextPath Value[x] Path x ContextPath Type[otherNestedRecord] Path otherNestedRecord -[nested_pattern_path] -[nested_pattern_path] CPPipe env:CompletionInferValues Path Belt.Int.toS [{ @@ -585,9 +551,6 @@ ContextPath Value[x] Path x ContextPath Type[otherNestedRecord] Path otherNestedRecord -[nested_pattern_path] -[nested_pattern_path] -[nested_pattern_path] CPPipe env:CompletionInferValues Path Js.String2.slic [{ @@ -617,9 +580,6 @@ ContextPath Value[x] Path x ContextPath Type[otherNestedRecord] Path otherNestedRecord -[nested_pattern_path] -[nested_pattern_path] -[nested_pattern_path] CPPipe env:CompletionInferValues Path Js.String2.slic [{ @@ -649,9 +609,6 @@ ContextPath Value[x] Path x ContextPath Type[otherNestedRecord] Path otherNestedRecord -[nested_pattern_path] -[nested_pattern_path] -[nested_pattern_path] CPPipe env:CompletionInferValues Path Js.String2.slic [{ @@ -683,7 +640,6 @@ Path x ContextPath array ContextPath Type[otherNestedRecord] Path otherNestedRecord -[nested_pattern_path] [{ "label": "someRecord", "kind": 5, @@ -729,22 +685,9 @@ Completable: Cpattern CArgument CArgument Value[fnWithRecordCallback]($0)($0)->r Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument CArgument Value[fnWithRecordCallback]($0)($0) ---> function argument: $0 ContextPath CArgument Value[fnWithRecordCallback]($0) ---> function argument: $0 ContextPath Value[fnWithRecordCallback] Path fnWithRecordCallback ---> found function type ---> found function argument! ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: someRecord, in env: CompletionInferValues. Has type arg ctx: false -[extract_type]--> digging for type someRecord in CompletionInferValues -[extract_type]--> found record -[nested]--> running nested in env: CompletionInferValues. Has type arg ctx: false -[extract_type]--> starting extraction of type: someRecord, in env: CompletionInferValues. Has type arg ctx: false -[extract_type]--> digging for type someRecord in CompletionInferValues -[extract_type]--> found record [{ "label": "name", "kind": 5, @@ -773,16 +716,9 @@ ContextPath Value[root] Path root ContextPath CPatternPath(CArgument CArgument Value[fn2](~cb)($0))->recordField(root) ContextPath CArgument CArgument Value[fn2](~cb)($0) ---> function argument: $0 ContextPath CArgument Value[fn2](~cb) ---> function argument: cb ContextPath Value[fn2] Path fn2 ---> found function type ---> found function argument! ---> found function type ---> found function argument! -[nested_pattern_path] CPPipe env:CompletionInferValues CPPipe type path:ReactDOM.Client.Root.t CPPipe pathFromEnv:ReactDOM.Client.Root found:false @@ -815,16 +751,9 @@ ContextPath Value[root] Path root ContextPath CPatternPath(CArgument CArgument Value[fn3](~cb)($0))->recordField(root) ContextPath CArgument CArgument Value[fn3](~cb)($0) ---> function argument: $0 ContextPath CArgument Value[fn3](~cb) ---> function argument: cb ContextPath Value[fn3] Path fn3 ---> found function type ---> found function argument! ---> found function type ---> found function argument! -[nested_pattern_path] CPPipe env:CompletionInferValues CPPipe type path:CompletionSupport.Test.t CPPipe pathFromEnv:CompletionSupport.Test found:false @@ -857,9 +786,6 @@ Resolved opens 1 pervasives ContextPath Value[Belt, Int, toString](Nolabel) ContextPath Value[Belt, Int, toString] Path Belt.Int.toString -[extract_type]--> starting extraction of type: string, in env: Belt_Int. Has type arg ctx: false -[nested]--> running nested in env: Belt_Int. Has type arg ctx: false -[nested]--> reached end of pattern, returning type [{ "label": "\"\"", "kind": 12, @@ -879,9 +805,6 @@ Resolved opens 1 pervasives ContextPath Value[Js, String2, split](Nolabel, Nolabel) ContextPath Value[Js, String2, split] Path Js.String2.split -[extract_type]--> starting extraction of type: array, in env: Js_string2. Has type arg ctx: false -[nested]--> running nested in env: Js_string2. Has type arg ctx: false -[nested]--> reached end of pattern, returning type [{ "label": "[]", "kind": 12, @@ -907,16 +830,9 @@ ContextPath Value[support] Path support ContextPath CPatternPath(CArgument CArgument Value[CompletionSupport2, makeRenderer](~render)($0))->recordField(support) ContextPath CArgument CArgument Value[CompletionSupport2, makeRenderer](~render)($0) ---> function argument: $0 ContextPath CArgument Value[CompletionSupport2, makeRenderer](~render) ---> function argument: render ContextPath Value[CompletionSupport2, makeRenderer] Path CompletionSupport2.makeRenderer ---> found function type ---> found function argument! ---> found function type ---> found function argument! -[nested_pattern_path] [{ "label": "root", "kind": 5, @@ -939,17 +855,9 @@ ContextPath Value[root] Path root ContextPath CPatternPath(CArgument CArgument Value[CompletionSupport2, makeRenderer](~render)($0))->recordField(support)->recordField(root) ContextPath CArgument CArgument Value[CompletionSupport2, makeRenderer](~render)($0) ---> function argument: $0 ContextPath CArgument Value[CompletionSupport2, makeRenderer](~render) ---> function argument: render ContextPath Value[CompletionSupport2, makeRenderer] Path CompletionSupport2.makeRenderer ---> found function type ---> found function argument! ---> found function type ---> found function argument! -[nested_pattern_path] -[nested_pattern_path] CPPipe env:CompletionInferValues envFromCompletionItem:CompletionSupport2.Internal CPPipe type path:ReactDOM.Client.Root.t CPPipe pathFromEnv:ReactDOM.Client.Root found:false diff --git a/analysis/tests/src/expected/CompletionJsx.res.txt b/analysis/tests/src/expected/CompletionJsx.res.txt index 9214afb85..234b2b221 100644 --- a/analysis/tests/src/expected/CompletionJsx.res.txt +++ b/analysis/tests/src/expected/CompletionJsx.res.txt @@ -481,10 +481,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CJsxPropValue [SomeComponent] someProp Path SomeComponent.make -[extract_type]--> starting extraction of type: string, in env: CompletionJsx.SomeComponent. Has type arg ctx: false -[nested]--> running nested in env: CompletionJsx.SomeComponent. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "\"\"", "kind": 12, diff --git a/analysis/tests/src/expected/CompletionJsxProps.res.txt b/analysis/tests/src/expected/CompletionJsxProps.res.txt index 6c58320db..b4612a73a 100644 --- a/analysis/tests/src/expected/CompletionJsxProps.res.txt +++ b/analysis/tests/src/expected/CompletionJsxProps.res.txt @@ -6,10 +6,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CJsxPropValue [CompletionSupport, TestComponent] on Path CompletionSupport.TestComponent.make -[extract_type]--> starting extraction of type: bool, in env: CompletionSupport.TestComponent. Has type arg ctx: false -[nested]--> running nested in env: CompletionSupport.TestComponent. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "true", "kind": 4, @@ -32,10 +28,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CJsxPropValue [CompletionSupport, TestComponent] on Path CompletionSupport.TestComponent.make -[extract_type]--> starting extraction of type: bool, in env: CompletionSupport.TestComponent. Has type arg ctx: false -[nested]--> running nested in env: CompletionSupport.TestComponent. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "true", "kind": 4, @@ -52,12 +44,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CJsxPropValue [CompletionSupport, TestComponent] test Path CompletionSupport.TestComponent.make -[extract_type]--> starting extraction of type: testVariant, in env: CompletionSupport.TestComponent. Has type arg ctx: false -[extract_type]--> digging for type testVariant in CompletionSupport.TestComponent -[extract_type]--> found variant -[nested]--> running nested in env: CompletionSupport.TestComponent. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "Two", "kind": 4, @@ -104,10 +90,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CJsxPropValue [CompletionSupport, TestComponent] polyArg Path CompletionSupport.TestComponent.make -[extract_type]--> starting extraction of type: [#one | #three(int, bool) | #two | #two2], in env: CompletionSupport.TestComponent. Has type arg ctx: false -[nested]--> running nested in env: CompletionSupport.TestComponent. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "#one", "kind": 4, @@ -150,10 +132,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CJsxPropValue [CompletionSupport, TestComponent] polyArg Path CompletionSupport.TestComponent.make -[extract_type]--> starting extraction of type: [#one | #three(int, bool) | #two | #two2], in env: CompletionSupport.TestComponent. Has type arg ctx: false -[nested]--> running nested in env: CompletionSupport.TestComponent. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "#three(_, _)", "kind": 4, @@ -189,10 +167,6 @@ Resolved opens 1 pervasives ContextPath CJsxPropValue [div] muted Path ReactDOM.domProps Path Pervasives.JsxDOM.domProps -[extract_type]--> starting extraction of type: bool, in env: CompletionJsxProps. Has type arg ctx: false -[nested]--> running nested in env: CompletionJsxProps. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "true", "kind": 4, @@ -216,13 +190,6 @@ Resolved opens 1 pervasives ContextPath CJsxPropValue [div] onMouseEnter Path ReactDOM.domProps Path Pervasives.JsxDOM.domProps -[extract_type]--> starting extraction of type: JsxEventC.Mouse.t => unit, in env: CompletionJsxProps. Has type arg ctx: false -[nested]--> running nested in env: CompletionJsxProps. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion -[extract_type]--> starting extraction of type: unit, in env: CompletionJsxProps. Has type arg ctx: false -[extract_type]--> digging for type unit in CompletionJsxProps -[extract_type]--> found nothing when digging [{ "label": "event => {}", "kind": 12, @@ -242,10 +209,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CJsxPropValue [CompletionSupport, TestComponent] testArr Path CompletionSupport.TestComponent.make -[extract_type]--> starting extraction of type: array, in env: CompletionSupport.TestComponent. Has type arg ctx: false -[nested]--> running nested in env: CompletionSupport.TestComponent. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "[]", "kind": 12, @@ -265,14 +228,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CJsxPropValue [CompletionSupport, TestComponent] testArr Path CompletionSupport.TestComponent.make -[extract_type]--> starting extraction of type: array, in env: CompletionSupport.TestComponent. Has type arg ctx: false -[nested]--> running nested in env: CompletionSupport.TestComponent. Has type arg ctx: false -[extract_type]--> starting extraction of type: testVariant, in env: CompletionSupport.TestComponent. Has type arg ctx: false -[extract_type]--> digging for type testVariant in CompletionSupport.TestComponent -[extract_type]--> found variant -[nested]--> running nested in env: CompletionSupport.TestComponent. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "One", "kind": 4, diff --git a/analysis/tests/src/expected/CompletionPattern.res.txt b/analysis/tests/src/expected/CompletionPattern.res.txt index b6c5a5c57..850c64919 100644 --- a/analysis/tests/src/expected/CompletionPattern.res.txt +++ b/analysis/tests/src/expected/CompletionPattern.res.txt @@ -9,10 +9,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[v] Path v -[extract_type]--> starting extraction of type: (bool, option, (bool, bool)), in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: (bool, option, (bool, bool)), in env: CompletionPattern. Has type arg ctx: false -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> reached end of pattern, returning type [{ "label": "(_, _, _)", "kind": 12, @@ -31,14 +27,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[v] Path v -[extract_type]--> starting extraction of type: (bool, option, (bool, bool)), in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: (bool, option, (bool, bool)), in env: CompletionPattern. Has type arg ctx: false -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> trying to move into tuple -[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -56,18 +44,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[v] Path v -[extract_type]--> starting extraction of type: (bool, option, (bool, bool)), in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: (bool, option, (bool, bool)), in env: CompletionPattern. Has type arg ctx: false -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> trying to move into tuple -[extract_type]--> starting extraction of type: (bool, bool), in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: (bool, bool), in env: CompletionPattern. Has type arg ctx: false -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> trying to move into tuple -[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> reached end of pattern, returning type [{ "label": "false", "kind": 4, @@ -83,10 +59,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[x] Path x -[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -108,10 +80,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[x] Path x -[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -127,11 +95,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[f] Path f -[extract_type]--> starting extraction of type: someRecord, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> digging for type someRecord in CompletionPattern -[extract_type]--> found record -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> reached end of pattern, returning type [{ "label": "{}", "kind": 22, @@ -150,13 +113,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[f] Path f -[extract_type]--> starting extraction of type: someRecord, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> digging for type someRecord in CompletionPattern -[extract_type]--> found record -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: someRecord, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> digging for type someRecord in CompletionPattern -[extract_type]--> found record [{ "label": "first", "kind": 5, @@ -190,13 +146,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[f] Path f -[extract_type]--> starting extraction of type: someRecord, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> digging for type someRecord in CompletionPattern -[extract_type]--> found record -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: someRecord, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> digging for type someRecord in CompletionPattern -[extract_type]--> found record [{ "label": "optThird", "kind": 5, @@ -219,13 +168,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[f] Path f -[extract_type]--> starting extraction of type: someRecord, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> digging for type someRecord in CompletionPattern -[extract_type]--> found record -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: someRecord, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> digging for type someRecord in CompletionPattern -[extract_type]--> found record [{ "label": "first", "kind": 5, @@ -243,18 +185,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[z] Path z -[extract_type]--> starting extraction of type: (someRecord, bool), in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: (someRecord, bool), in env: CompletionPattern. Has type arg ctx: false -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> trying to move into tuple -[extract_type]--> starting extraction of type: someRecord, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: someRecord, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> digging for type someRecord in CompletionPattern -[extract_type]--> found record -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: someRecord, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> digging for type someRecord in CompletionPattern -[extract_type]--> found record [{ "label": "optThird", "kind": 5, @@ -270,19 +200,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[f] Path f -[extract_type]--> starting extraction of type: someRecord, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> digging for type someRecord in CompletionPattern -[extract_type]--> found record -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> trying to move into record field -[nested]--> found record field type -[nested]--> extracting from type nestedRecord in env CompletionPattern -[extract_type]--> starting extraction of type: nestedRecord, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: nestedRecord, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> digging for type nestedRecord in CompletionPattern -[extract_type]--> found record -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> reached end of pattern, returning type [{ "label": "{}", "kind": 22, @@ -302,21 +219,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[f] Path f -[extract_type]--> starting extraction of type: someRecord, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> digging for type someRecord in CompletionPattern -[extract_type]--> found record -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> trying to move into record field -[nested]--> found record field type -[nested]--> extracting from type nestedRecord in env CompletionPattern -[extract_type]--> starting extraction of type: nestedRecord, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: nestedRecord, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> digging for type nestedRecord in CompletionPattern -[extract_type]--> found record -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: nestedRecord, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> digging for type nestedRecord in CompletionPattern -[extract_type]--> found record [{ "label": "nested", "kind": 5, @@ -334,13 +236,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[nest] Path nest -[extract_type]--> starting extraction of type: nestedRecord, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> digging for type nestedRecord in CompletionPattern -[extract_type]--> found record -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: nestedRecord, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> digging for type nestedRecord in CompletionPattern -[extract_type]--> found record [{ "label": "nested", "kind": 5, @@ -356,13 +251,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[f] Path f -[extract_type]--> starting extraction of type: someRecord, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> digging for type someRecord in CompletionPattern -[extract_type]--> found record -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: someRecord, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> digging for type someRecord in CompletionPattern -[extract_type]--> found record [{ "label": "first", "kind": 5, @@ -398,21 +286,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[f] Path f -[extract_type]--> starting extraction of type: someRecord, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> digging for type someRecord in CompletionPattern -[extract_type]--> found record -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> trying to move into record field -[nested]--> found record field type -[nested]--> extracting from type nestedRecord in env CompletionPattern -[extract_type]--> starting extraction of type: nestedRecord, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: nestedRecord, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> digging for type nestedRecord in CompletionPattern -[extract_type]--> found record -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: nestedRecord, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> digging for type nestedRecord in CompletionPattern -[extract_type]--> found record [{ "label": "nested", "kind": 5, @@ -431,18 +304,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[z] Path z -[extract_type]--> starting extraction of type: someVariant, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: someVariant, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> digging for type someVariant in CompletionPattern -[extract_type]--> found variant -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> trying to move into variant payload $0 of constructor 'Two' -[nested]--> found constructor (Args type) -[nested]--> found arg of type: bool -[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false -[nested]--> extracted type, continuing descent -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -466,18 +327,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[z] Path z -[extract_type]--> starting extraction of type: someVariant, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: someVariant, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> digging for type someVariant in CompletionPattern -[extract_type]--> found variant -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> trying to move into variant payload $0 of constructor 'Two' -[nested]--> found constructor (Args type) -[nested]--> found arg of type: bool -[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false -[nested]--> extracted type, continuing descent -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -495,22 +344,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[z] Path z -[extract_type]--> starting extraction of type: someVariant, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: someVariant, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> digging for type someVariant in CompletionPattern -[extract_type]--> found variant -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> trying to move into variant payload $0 of constructor 'Three' -[nested]--> found constructor (Args type) -[nested]--> found arg of type: someRecord -[extract_type]--> starting extraction of type: someRecord, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> digging for type someRecord in CompletionPattern -[extract_type]--> found record -[nested]--> extracted type, continuing descent -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: someRecord, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> digging for type someRecord in CompletionPattern -[extract_type]--> found record [{ "label": "first", "kind": 5, @@ -547,18 +380,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[z] Path z -[extract_type]--> starting extraction of type: someVariant, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: someVariant, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> digging for type someVariant in CompletionPattern -[extract_type]--> found variant -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> trying to move into variant payload $1 of constructor 'Three' -[nested]--> found constructor (Args type) -[nested]--> found arg of type: bool -[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false -[nested]--> extracted type, continuing descent -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -576,14 +397,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[b] Path b -[extract_type]--> starting extraction of type: somePolyVariant, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> digging for type somePolyVariant in CompletionPattern -[extract_type]--> found type manifest -[extract_type]--> starting extraction of type: [#one | #three(someRecord, bool) | #two(bool)], in env: CompletionPattern. Has type arg ctx: false -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -606,14 +419,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[b] Path b -[extract_type]--> starting extraction of type: somePolyVariant, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> digging for type somePolyVariant in CompletionPattern -[extract_type]--> found type manifest -[extract_type]--> starting extraction of type: [#one | #three(someRecord, bool) | #two(bool)], in env: CompletionPattern. Has type arg ctx: false -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -630,18 +435,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[b] Path b -[extract_type]--> starting extraction of type: somePolyVariant, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> digging for type somePolyVariant in CompletionPattern -[extract_type]--> found type manifest -[extract_type]--> starting extraction of type: [#one | #three(someRecord, bool) | #two(bool)], in env: CompletionPattern. Has type arg ctx: false -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: someRecord, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> digging for type someRecord in CompletionPattern -[extract_type]--> found record -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: someRecord, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> digging for type someRecord in CompletionPattern -[extract_type]--> found record [{ "label": "first", "kind": 5, @@ -677,14 +470,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[b] Path b -[extract_type]--> starting extraction of type: somePolyVariant, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> digging for type somePolyVariant in CompletionPattern -[extract_type]--> found type manifest -[extract_type]--> starting extraction of type: [#one | #three(someRecord, bool) | #two(bool)], in env: CompletionPattern. Has type arg ctx: false -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -700,9 +485,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[c] Path c -[extract_type]--> starting extraction of type: array, in env: CompletionPattern. Has type arg ctx: false -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> reached end of pattern, returning type [{ "label": "[]", "kind": 12, @@ -721,11 +503,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[c] Path c -[extract_type]--> starting extraction of type: array, in env: CompletionPattern. Has type arg ctx: false -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -750,14 +527,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[o] Path o -[extract_type]--> starting extraction of type: option, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: option, in env: CompletionPattern. Has type arg ctx: false -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> moving into option Some -[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -780,18 +549,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[p] Path p -[extract_type]--> starting extraction of type: multiPayloadVariant, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: multiPayloadVariant, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> digging for type multiPayloadVariant in CompletionPattern -[extract_type]--> found variant -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> trying to move into variant payload $1 of constructor 'Test' -[nested]--> found constructor (Args type) -[nested]--> found arg of type: bool -[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false -[nested]--> extracted type, continuing descent -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -815,19 +572,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[p] Path p -[extract_type]--> starting extraction of type: multiPayloadVariant, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: multiPayloadVariant, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> digging for type multiPayloadVariant in CompletionPattern -[extract_type]--> found variant -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> trying to move into variant payload $2 of constructor 'Test' -[nested]--> found constructor (Args type) -[nested]--> found arg of type: option -[extract_type]--> starting extraction of type: option, in env: CompletionPattern. Has type arg ctx: false -[nested]--> extracted type, continuing descent -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> reached end of pattern, returning type -[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false [{ "label": "None", "kind": 12, @@ -865,18 +609,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[p] Path p -[extract_type]--> starting extraction of type: multiPayloadVariant, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: multiPayloadVariant, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> digging for type multiPayloadVariant in CompletionPattern -[extract_type]--> found variant -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> trying to move into variant payload $1 of constructor 'Test' -[nested]--> found constructor (Args type) -[nested]--> found arg of type: bool -[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false -[nested]--> extracted type, continuing descent -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -900,18 +632,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[p] Path p -[extract_type]--> starting extraction of type: multiPayloadVariant, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: multiPayloadVariant, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> digging for type multiPayloadVariant in CompletionPattern -[extract_type]--> found variant -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> trying to move into variant payload $3 of constructor 'Test' -[nested]--> found constructor (Args type) -[nested]--> found arg of type: array -[extract_type]--> starting extraction of type: array, in env: CompletionPattern. Has type arg ctx: false -[nested]--> extracted type, continuing descent -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> reached end of pattern, returning type [{ "label": "[]", "kind": 12, @@ -930,14 +650,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[v] Path v -[extract_type]--> starting extraction of type: multiPayloadPolyVariant, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> digging for type multiPayloadPolyVariant in CompletionPattern -[extract_type]--> found type manifest -[extract_type]--> starting extraction of type: [#test(int, bool, option, array)], in env: CompletionPattern. Has type arg ctx: false -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -960,15 +672,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[v] Path v -[extract_type]--> starting extraction of type: multiPayloadPolyVariant, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> digging for type multiPayloadPolyVariant in CompletionPattern -[extract_type]--> found type manifest -[extract_type]--> starting extraction of type: [#test(int, bool, option, array)], in env: CompletionPattern. Has type arg ctx: false -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: option, in env: CompletionPattern. Has type arg ctx: false -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> reached end of pattern, returning type -[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false [{ "label": "None", "kind": 12, @@ -1005,14 +708,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[v] Path v -[extract_type]--> starting extraction of type: multiPayloadPolyVariant, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> digging for type multiPayloadPolyVariant in CompletionPattern -[extract_type]--> found type manifest -[extract_type]--> starting extraction of type: [#test(int, bool, option, array)], in env: CompletionPattern. Has type arg ctx: false -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -1035,14 +730,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[v] Path v -[extract_type]--> starting extraction of type: multiPayloadPolyVariant, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> digging for type multiPayloadPolyVariant in CompletionPattern -[extract_type]--> found type manifest -[extract_type]--> starting extraction of type: [#test(int, bool, option, array)], in env: CompletionPattern. Has type arg ctx: false -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: array, in env: CompletionPattern. Has type arg ctx: false -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> reached end of pattern, returning type [{ "label": "[]", "kind": 12, @@ -1062,14 +749,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[s] Path s -[extract_type]--> starting extraction of type: (bool, option, array), in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: (bool, option, array), in env: CompletionPattern. Has type arg ctx: false -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> trying to move into tuple -[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -1091,16 +770,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[s] Path s -[extract_type]--> starting extraction of type: (bool, option, array), in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: (bool, option, array), in env: CompletionPattern. Has type arg ctx: false -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> trying to move into tuple -[extract_type]--> starting extraction of type: option, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: option, in env: CompletionPattern. Has type arg ctx: false -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> reached end of pattern, returning type -[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false [{ "label": "None", "kind": 12, @@ -1136,16 +805,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[s] Path s -[extract_type]--> starting extraction of type: (bool, option, array), in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: (bool, option, array), in env: CompletionPattern. Has type arg ctx: false -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> trying to move into tuple -[extract_type]--> starting extraction of type: option, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: option, in env: CompletionPattern. Has type arg ctx: false -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> reached end of pattern, returning type -[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false [{ "label": "None", "kind": 12, @@ -1181,10 +840,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[s] Path s -[extract_type]--> starting extraction of type: (bool, option, array), in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: (bool, option, array), in env: CompletionPattern. Has type arg ctx: false -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> reached end of pattern, returning type [{ "label": "(_, _, _)", "kind": 12, @@ -1202,16 +857,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[s] Path s -[extract_type]--> starting extraction of type: (bool, option, array), in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: (bool, option, array), in env: CompletionPattern. Has type arg ctx: false -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> trying to move into tuple -[extract_type]--> starting extraction of type: option, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: option, in env: CompletionPattern. Has type arg ctx: false -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> reached end of pattern, returning type -[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false [{ "label": "None", "kind": 12, @@ -1247,12 +892,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[z] Path z -[extract_type]--> starting extraction of type: someVariant, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: someVariant, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> digging for type someVariant in CompletionPattern -[extract_type]--> found variant -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> reached end of pattern, returning type [{ "label": "One", "kind": 4, @@ -1288,18 +927,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[z] Path z -[extract_type]--> starting extraction of type: someVariant, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: someVariant, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> digging for type someVariant in CompletionPattern -[extract_type]--> found variant -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> trying to move into variant payload $0 of constructor 'Two' -[nested]--> found constructor (Args type) -[nested]--> found arg of type: bool -[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false -[nested]--> extracted type, continuing descent -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -1324,18 +951,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[z] Path z -[extract_type]--> starting extraction of type: someVariant, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: someVariant, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> digging for type someVariant in CompletionPattern -[extract_type]--> found variant -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> trying to move into variant payload $1 of constructor 'Three' -[nested]--> found constructor (Args type) -[nested]--> found arg of type: bool -[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false -[nested]--> extracted type, continuing descent -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -1358,14 +973,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[b] Path b -[extract_type]--> starting extraction of type: somePolyVariant, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> digging for type somePolyVariant in CompletionPattern -[extract_type]--> found type manifest -[extract_type]--> starting extraction of type: [#one | #three(someRecord, bool) | #two(bool)], in env: CompletionPattern. Has type arg ctx: false -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -1389,14 +996,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[b] Path b -[extract_type]--> starting extraction of type: somePolyVariant, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> digging for type somePolyVariant in CompletionPattern -[extract_type]--> found type manifest -[extract_type]--> starting extraction of type: [#one | #three(someRecord, bool) | #two(bool)], in env: CompletionPattern. Has type arg ctx: false -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> reached end of pattern, returning type [{ "label": "true", "kind": 4, @@ -1419,16 +1018,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[s] Path s -[extract_type]--> starting extraction of type: (bool, option, array), in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: (bool, option, array), in env: CompletionPattern. Has type arg ctx: false -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> trying to move into tuple -[extract_type]--> starting extraction of type: option, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: option, in env: CompletionPattern. Has type arg ctx: false -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> reached end of pattern, returning type -[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: bool, in env: CompletionPattern. Has type arg ctx: false [{ "label": "None", "kind": 12, @@ -1464,17 +1053,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[ff] Path ff -[extract_type]--> starting extraction of type: recordWithFn, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> digging for type recordWithFn in CompletionPattern -[extract_type]--> found record -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> trying to move into record field -[nested]--> found record field type -[nested]--> extracting from type unit => unit in env CompletionPattern -[extract_type]--> starting extraction of type: unit => unit, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: unit => unit, in env: CompletionPattern. Has type arg ctx: false -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> reached end of pattern, returning type [] Complete src/CompletionPattern.res 206:16 @@ -1484,9 +1062,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[xn] Path xn -[extract_type]--> starting extraction of type: exn, in env: CompletionPattern. Has type arg ctx: false -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> reached end of pattern, returning type [{ "label": "Js.Exn.Error(error)", "kind": 4, @@ -1504,13 +1079,6 @@ ContextPath await Value[getThing](Nolabel) ContextPath Value[getThing](Nolabel) ContextPath Value[getThing] Path getThing -[extract_type]--> starting extraction of type: promise, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: someVariant, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> starting extraction of type: someVariant, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> digging for type someVariant in CompletionPattern -[extract_type]--> found variant -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: false -[nested]--> reached end of pattern, returning type [{ "label": "One", "kind": 4, @@ -1547,32 +1115,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[res] Path res -[extract_type]--> starting extraction of type: result, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> digging for type Pervasives.result in CompletionPattern -[extract_type]--> found type manifest -[extract_type]--> starting extraction of type: Belt.Result.t<'a, 'b>, in env: Pervasives. Has type arg ctx: true -[extract_type]--> Type arg context. env: CompletionPattern, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b -[extract_type]--> digging for type Belt.Result.t in Pervasives -[extract_type]--> found variant -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: true -[nested]--> Type arg context. env: CompletionPattern, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b -[nested]--> trying to move into variant payload $0 of constructor 'Ok' -[nested]--> found constructor (Args type) -[nested]--> found arg of type: 'a -[extract_type]--> starting extraction of type: 'a, in env: Belt_Result. Has type arg ctx: true -[extract_type]--> Type arg context. env: CompletionPattern, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b -[extract_type]--> starting extraction of type: 'a, in env: Belt_Result. Has type arg ctx: true -[extract_type]--> Type arg context. env: CompletionPattern, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b -[extract_type]--> found type variable: 'a. Trying to instantiate with Type arg context. env: CompletionPattern, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b -[extract_type]--> SUCCEEDED instantiation, new type is: someVariant -[extract_type]--> starting extraction of type: someVariant, in env: CompletionPattern. Has type arg ctx: true -[extract_type]--> Type arg context. env: CompletionPattern, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b -[extract_type]--> digging for type someVariant in CompletionPattern -[extract_type]--> found variant -[nested]--> extracted type, continuing descent -[nested]--> running nested in env: Belt_Result. Has type arg ctx: true -[nested]--> Type arg context. env: CompletionPattern, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b -[nested]--> reached end of pattern, returning type [{ "label": "One", "kind": 4, @@ -1609,32 +1151,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[res] Path res -[extract_type]--> starting extraction of type: result, in env: CompletionPattern. Has type arg ctx: false -[extract_type]--> digging for type Pervasives.result in CompletionPattern -[extract_type]--> found type manifest -[extract_type]--> starting extraction of type: Belt.Result.t<'a, 'b>, in env: Pervasives. Has type arg ctx: true -[extract_type]--> Type arg context. env: CompletionPattern, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b -[extract_type]--> digging for type Belt.Result.t in Pervasives -[extract_type]--> found variant -[nested]--> running nested in env: CompletionPattern. Has type arg ctx: true -[nested]--> Type arg context. env: CompletionPattern, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b -[nested]--> trying to move into variant payload $0 of constructor 'Error' -[nested]--> found constructor (Args type) -[nested]--> found arg of type: 'b -[extract_type]--> starting extraction of type: 'b, in env: Belt_Result. Has type arg ctx: true -[extract_type]--> Type arg context. env: CompletionPattern, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b -[extract_type]--> starting extraction of type: 'b, in env: Belt_Result. Has type arg ctx: true -[extract_type]--> Type arg context. env: CompletionPattern, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b -[extract_type]--> found type variable: 'b. Trying to instantiate with Type arg context. env: CompletionPattern, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b -[extract_type]--> SUCCEEDED instantiation, new type is: somePolyVariant -[extract_type]--> starting extraction of type: somePolyVariant, in env: CompletionPattern. Has type arg ctx: true -[extract_type]--> Type arg context. env: CompletionPattern, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b -[extract_type]--> digging for type somePolyVariant in CompletionPattern -[extract_type]--> found type manifest -[extract_type]--> starting extraction of type: [#one | #three(someRecord, bool) | #two(bool)], in env: CompletionPattern. Has type arg ctx: false -[nested]--> extracted type, continuing descent -[nested]--> running nested in env: Belt_Result. Has type arg ctx: false -[nested]--> reached end of pattern, returning type [{ "label": "#one", "kind": 4, diff --git a/analysis/tests/src/expected/CompletionTypeAnnotation.res.txt b/analysis/tests/src/expected/CompletionTypeAnnotation.res.txt index 2b0d71203..e2db577b7 100644 --- a/analysis/tests/src/expected/CompletionTypeAnnotation.res.txt +++ b/analysis/tests/src/expected/CompletionTypeAnnotation.res.txt @@ -5,9 +5,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Type[someRecord] Path someRecord -[nested]--> running nested in env: CompletionTypeAnnotation. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "{}", "kind": 12, @@ -26,8 +23,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Type[someRecord] Path someRecord -[nested]--> running nested in env: CompletionTypeAnnotation. Has type arg ctx: false ---> found type in nested expression completion [{ "label": "age", "kind": 5, @@ -49,9 +44,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Type[someVariant] Path someVariant -[nested]--> running nested in env: CompletionTypeAnnotation. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "One", "kind": 4, @@ -77,9 +69,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Type[someVariant] Path someVariant -[nested]--> running nested in env: CompletionTypeAnnotation. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "One", "kind": 4, @@ -110,9 +99,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Type[somePolyVariant] Path somePolyVariant -[nested]--> running nested in env: CompletionTypeAnnotation. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "#one", "kind": 4, @@ -138,9 +124,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Type[somePolyVariant] Path somePolyVariant -[nested]--> running nested in env: CompletionTypeAnnotation. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "#one", "kind": 4, @@ -158,10 +141,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Type[someFunc] Path someFunc -[nested]--> running nested in env: CompletionTypeAnnotation. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion -[extract_type]--> starting extraction of type: bool, in env: CompletionTypeAnnotation. Has type arg ctx: false [{ "label": "(v1, v2) => {}", "kind": 12, @@ -180,9 +159,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Type[someTuple] Path someTuple -[nested]--> running nested in env: CompletionTypeAnnotation. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "(_, _)", "kind": 12, @@ -200,13 +176,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Type[someTuple] Path someTuple -[nested]--> running nested in env: CompletionTypeAnnotation. Has type arg ctx: false -[nested]--> trying to move into tuple -[extract_type]--> starting extraction of type: option, in env: CompletionTypeAnnotation. Has type arg ctx: false -[nested]--> running nested in env: CompletionTypeAnnotation. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion -[extract_type]--> starting extraction of type: bool, in env: CompletionTypeAnnotation. Has type arg ctx: false [{ "label": "None", "kind": 12, @@ -243,9 +212,6 @@ Resolved opens 1 pervasives ContextPath option ContextPath Type[someVariant] Path someVariant -[nested]--> running nested in env: CompletionTypeAnnotation. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "None", "kind": 12, @@ -286,11 +252,6 @@ Resolved opens 1 pervasives ContextPath option ContextPath Type[someVariant] Path someVariant -[nested]--> running nested in env: CompletionTypeAnnotation. Has type arg ctx: false -[nested]--> moving into option Some -[nested]--> running nested in env: CompletionTypeAnnotation. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "One", "kind": 4, @@ -317,9 +278,6 @@ Resolved opens 1 pervasives ContextPath array ContextPath Type[someVariant] Path someVariant -[nested]--> running nested in env: CompletionTypeAnnotation. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "[]", "kind": 12, @@ -339,10 +297,6 @@ Resolved opens 1 pervasives ContextPath array ContextPath Type[someVariant] Path someVariant -[nested]--> running nested in env: CompletionTypeAnnotation. Has type arg ctx: false -[nested]--> running nested in env: CompletionTypeAnnotation. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "One", "kind": 4, @@ -370,9 +324,6 @@ ContextPath array> ContextPath option ContextPath Type[someVariant] Path someVariant -[nested]--> running nested in env: CompletionTypeAnnotation. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "[]", "kind": 12, @@ -393,12 +344,6 @@ ContextPath option> ContextPath array ContextPath Type[someVariant] Path someVariant -[nested]--> running nested in env: CompletionTypeAnnotation. Has type arg ctx: false -[nested]--> moving into option Some -[nested]--> running nested in env: CompletionTypeAnnotation. Has type arg ctx: false -[nested]--> running nested in env: CompletionTypeAnnotation. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "One", "kind": 4, diff --git a/analysis/tests/src/expected/Destructuring.res.txt b/analysis/tests/src/expected/Destructuring.res.txt index 3538a7774..978a78816 100644 --- a/analysis/tests/src/expected/Destructuring.res.txt +++ b/analysis/tests/src/expected/Destructuring.res.txt @@ -5,14 +5,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[x] Path x -[extract_type]--> starting extraction of type: x, in env: Destructuring. Has type arg ctx: false -[extract_type]--> starting extraction of type: x, in env: Destructuring. Has type arg ctx: false -[extract_type]--> digging for type x in Destructuring -[extract_type]--> found record -[nested]--> running nested in env: Destructuring. Has type arg ctx: false -[extract_type]--> starting extraction of type: x, in env: Destructuring. Has type arg ctx: false -[extract_type]--> digging for type x in Destructuring -[extract_type]--> found record [{ "label": "age", "kind": 5, @@ -28,14 +20,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[x] Path x -[extract_type]--> starting extraction of type: x, in env: Destructuring. Has type arg ctx: false -[extract_type]--> starting extraction of type: x, in env: Destructuring. Has type arg ctx: false -[extract_type]--> digging for type x in Destructuring -[extract_type]--> found record -[nested]--> running nested in env: Destructuring. Has type arg ctx: false -[extract_type]--> starting extraction of type: x, in env: Destructuring. Has type arg ctx: false -[extract_type]--> digging for type x in Destructuring -[extract_type]--> found record [{ "label": "name", "kind": 5, @@ -59,13 +43,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[x] Path x -[extract_type]--> starting extraction of type: x, in env: Destructuring. Has type arg ctx: false -[extract_type]--> digging for type x in Destructuring -[extract_type]--> found record -[nested]--> running nested in env: Destructuring. Has type arg ctx: false -[extract_type]--> starting extraction of type: x, in env: Destructuring. Has type arg ctx: false -[extract_type]--> digging for type x in Destructuring -[extract_type]--> found record [{ "label": "age", "kind": 5, @@ -83,13 +60,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[x] Path x -[extract_type]--> starting extraction of type: x, in env: Destructuring. Has type arg ctx: false -[extract_type]--> digging for type x in Destructuring -[extract_type]--> found record -[nested]--> running nested in env: Destructuring. Has type arg ctx: false -[extract_type]--> starting extraction of type: x, in env: Destructuring. Has type arg ctx: false -[extract_type]--> digging for type x in Destructuring -[extract_type]--> found record [{ "label": "name", "kind": 5, @@ -111,13 +81,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[x] Path x -[extract_type]--> starting extraction of type: recordWithOptField, in env: Destructuring. Has type arg ctx: false -[extract_type]--> digging for type recordWithOptField in Destructuring -[extract_type]--> found record -[nested]--> running nested in env: Destructuring. Has type arg ctx: false -[extract_type]--> starting extraction of type: recordWithOptField, in env: Destructuring. Has type arg ctx: false -[extract_type]--> digging for type recordWithOptField in Destructuring -[extract_type]--> found record [{ "label": "someField", "kind": 5, diff --git a/analysis/tests/src/expected/EnvCompletion.res.txt b/analysis/tests/src/expected/EnvCompletion.res.txt index 6b7654012..da9e85f69 100644 --- a/analysis/tests/src/expected/EnvCompletion.res.txt +++ b/analysis/tests/src/expected/EnvCompletion.res.txt @@ -5,11 +5,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[res] Path res -[extract_type]--> starting extraction of type: EnvCompletionOtherFile.someResult, in env: EnvCompletion. Has type arg ctx: false -[extract_type]--> digging for type EnvCompletionOtherFile.someResult in EnvCompletion -[extract_type]--> found variant -[nested]--> running nested in env: EnvCompletion. Has type arg ctx: false -[nested]--> reached end of pattern, returning type [{ "label": "Okay(_)", "kind": 4, @@ -38,17 +33,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[res] Path res -[extract_type]--> starting extraction of type: EnvCompletionOtherFile.someResult, in env: EnvCompletion. Has type arg ctx: false -[extract_type]--> digging for type EnvCompletionOtherFile.someResult in EnvCompletion -[extract_type]--> found variant -[nested]--> running nested in env: EnvCompletion. Has type arg ctx: false -[nested]--> trying to move into variant payload $0 of constructor 'Okay' -[nested]--> found constructor (Args type) -[nested]--> found arg of type: 'a -[extract_type]--> starting extraction of type: 'a, in env: EnvCompletionOtherFile. Has type arg ctx: false -[extract_type]--> starting extraction of type: 'a, in env: EnvCompletionOtherFile. Has type arg ctx: false -[extract_type]--> found type variable: 'a. Trying to instantiate with no type args ctx -[extract_type]--> could not instantiate 'a. Skipping. Completable: Cpath Value[()] Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives @@ -66,17 +50,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[res] Path res -[extract_type]--> starting extraction of type: EnvCompletionOtherFile.someResult, in env: EnvCompletion. Has type arg ctx: false -[extract_type]--> digging for type EnvCompletionOtherFile.someResult in EnvCompletion -[extract_type]--> found variant -[nested]--> running nested in env: EnvCompletion. Has type arg ctx: false -[nested]--> trying to move into variant payload $0 of constructor 'Failure' -[nested]--> found constructor (Args type) -[nested]--> found arg of type: 'b -[extract_type]--> starting extraction of type: 'b, in env: EnvCompletionOtherFile. Has type arg ctx: false -[extract_type]--> starting extraction of type: 'b, in env: EnvCompletionOtherFile. Has type arg ctx: false -[extract_type]--> found type variable: 'b. Trying to instantiate with no type args ctx -[extract_type]--> could not instantiate 'b. Skipping. Completable: Cpath Value[()] Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives @@ -92,11 +65,6 @@ Resolved opens 1 pervasives ContextPath Value[use](Nolabel) ContextPath Value[use] Path use -[extract_type]--> starting extraction of type: EnvCompletionOtherFile.response, in env: EnvCompletion. Has type arg ctx: false -[extract_type]--> digging for type EnvCompletionOtherFile.response in EnvCompletion -[extract_type]--> found record -[nested]--> running nested in env: EnvCompletion. Has type arg ctx: false -[nested]--> reached end of pattern, returning type [{ "label": "{}", "kind": 22, @@ -116,13 +84,6 @@ Resolved opens 1 pervasives ContextPath Value[use](Nolabel) ContextPath Value[use] Path use -[extract_type]--> starting extraction of type: EnvCompletionOtherFile.response, in env: EnvCompletion. Has type arg ctx: false -[extract_type]--> digging for type EnvCompletionOtherFile.response in EnvCompletion -[extract_type]--> found record -[nested]--> running nested in env: EnvCompletion. Has type arg ctx: false -[extract_type]--> starting extraction of type: EnvCompletionOtherFile.response, in env: EnvCompletionOtherFile. Has type arg ctx: false -[extract_type]--> digging for type EnvCompletionOtherFile.response in EnvCompletionOtherFile -[extract_type]--> found record [{ "label": "stuff", "kind": 5, @@ -145,19 +106,6 @@ Resolved opens 1 pervasives ContextPath Value[use](Nolabel) ContextPath Value[use] Path use -[extract_type]--> starting extraction of type: EnvCompletionOtherFile.response, in env: EnvCompletion. Has type arg ctx: false -[extract_type]--> digging for type EnvCompletionOtherFile.response in EnvCompletion -[extract_type]--> found record -[nested]--> running nested in env: EnvCompletion. Has type arg ctx: false -[nested]--> trying to move into record field -[nested]--> found record field type -[nested]--> extracting from type theVariant in env EnvCompletionOtherFile -[extract_type]--> starting extraction of type: theVariant, in env: EnvCompletionOtherFile. Has type arg ctx: false -[extract_type]--> starting extraction of type: theVariant, in env: EnvCompletionOtherFile. Has type arg ctx: false -[extract_type]--> digging for type theVariant in EnvCompletionOtherFile -[extract_type]--> found variant -[nested]--> running nested in env: EnvCompletionOtherFile. Has type arg ctx: false -[nested]--> reached end of pattern, returning type [{ "label": "First", "kind": 4, @@ -188,27 +136,6 @@ Resolved opens 1 pervasives ContextPath Value[use](Nolabel) ContextPath Value[use] Path use -[extract_type]--> starting extraction of type: EnvCompletionOtherFile.response, in env: EnvCompletion. Has type arg ctx: false -[extract_type]--> digging for type EnvCompletionOtherFile.response in EnvCompletion -[extract_type]--> found record -[nested]--> running nested in env: EnvCompletion. Has type arg ctx: false -[nested]--> trying to move into record field -[nested]--> found record field type -[nested]--> extracting from type theVariant in env EnvCompletionOtherFile -[extract_type]--> starting extraction of type: theVariant, in env: EnvCompletionOtherFile. Has type arg ctx: false -[extract_type]--> starting extraction of type: theVariant, in env: EnvCompletionOtherFile. Has type arg ctx: false -[extract_type]--> digging for type theVariant in EnvCompletionOtherFile -[extract_type]--> found variant -[nested]--> running nested in env: EnvCompletionOtherFile. Has type arg ctx: false -[nested]--> trying to move into variant payload $0 of constructor 'Second' -[nested]--> found constructor (Args type) -[nested]--> found arg of type: r1 -[extract_type]--> starting extraction of type: r1, in env: EnvCompletionOtherFile. Has type arg ctx: false -[extract_type]--> digging for type r1 in EnvCompletionOtherFile -[extract_type]--> found record -[nested]--> extracted type, continuing descent -[nested]--> running nested in env: EnvCompletionOtherFile. Has type arg ctx: false -[nested]--> reached end of pattern, returning type [{ "label": "{}", "kind": 22, @@ -231,29 +158,6 @@ Resolved opens 1 pervasives ContextPath Value[use](Nolabel) ContextPath Value[use] Path use -[extract_type]--> starting extraction of type: EnvCompletionOtherFile.response, in env: EnvCompletion. Has type arg ctx: false -[extract_type]--> digging for type EnvCompletionOtherFile.response in EnvCompletion -[extract_type]--> found record -[nested]--> running nested in env: EnvCompletion. Has type arg ctx: false -[nested]--> trying to move into record field -[nested]--> found record field type -[nested]--> extracting from type theVariant in env EnvCompletionOtherFile -[extract_type]--> starting extraction of type: theVariant, in env: EnvCompletionOtherFile. Has type arg ctx: false -[extract_type]--> starting extraction of type: theVariant, in env: EnvCompletionOtherFile. Has type arg ctx: false -[extract_type]--> digging for type theVariant in EnvCompletionOtherFile -[extract_type]--> found variant -[nested]--> running nested in env: EnvCompletionOtherFile. Has type arg ctx: false -[nested]--> trying to move into variant payload $0 of constructor 'Second' -[nested]--> found constructor (Args type) -[nested]--> found arg of type: r1 -[extract_type]--> starting extraction of type: r1, in env: EnvCompletionOtherFile. Has type arg ctx: false -[extract_type]--> digging for type r1 in EnvCompletionOtherFile -[extract_type]--> found record -[nested]--> extracted type, continuing descent -[nested]--> running nested in env: EnvCompletionOtherFile. Has type arg ctx: false -[extract_type]--> starting extraction of type: r1, in env: EnvCompletionOtherFile. Has type arg ctx: false -[extract_type]--> digging for type r1 in EnvCompletionOtherFile -[extract_type]--> found record [{ "label": "age", "kind": 5, @@ -270,19 +174,6 @@ Resolved opens 1 pervasives ContextPath Value[use](Nolabel) ContextPath Value[use] Path use -[extract_type]--> starting extraction of type: EnvCompletionOtherFile.response, in env: EnvCompletion. Has type arg ctx: false -[extract_type]--> digging for type EnvCompletionOtherFile.response in EnvCompletion -[extract_type]--> found record -[nested]--> running nested in env: EnvCompletion. Has type arg ctx: false -[nested]--> trying to move into record field -[nested]--> found record field type -[nested]--> extracting from type someResult in env EnvCompletionOtherFile -[extract_type]--> starting extraction of type: someResult, in env: EnvCompletionOtherFile. Has type arg ctx: false -[extract_type]--> starting extraction of type: someResult, in env: EnvCompletionOtherFile. Has type arg ctx: false -[extract_type]--> digging for type someResult in EnvCompletionOtherFile -[extract_type]--> found variant -[nested]--> running nested in env: EnvCompletionOtherFile. Has type arg ctx: false -[nested]--> reached end of pattern, returning type [{ "label": "Okay(_)", "kind": 4, @@ -313,25 +204,6 @@ Resolved opens 1 pervasives ContextPath Value[use](Nolabel) ContextPath Value[use] Path use -[extract_type]--> starting extraction of type: EnvCompletionOtherFile.response, in env: EnvCompletion. Has type arg ctx: false -[extract_type]--> digging for type EnvCompletionOtherFile.response in EnvCompletion -[extract_type]--> found record -[nested]--> running nested in env: EnvCompletion. Has type arg ctx: false -[nested]--> trying to move into record field -[nested]--> found record field type -[nested]--> extracting from type someResult in env EnvCompletionOtherFile -[extract_type]--> starting extraction of type: someResult, in env: EnvCompletionOtherFile. Has type arg ctx: false -[extract_type]--> starting extraction of type: someResult, in env: EnvCompletionOtherFile. Has type arg ctx: false -[extract_type]--> digging for type someResult in EnvCompletionOtherFile -[extract_type]--> found variant -[nested]--> running nested in env: EnvCompletionOtherFile. Has type arg ctx: false -[nested]--> trying to move into variant payload $0 of constructor 'Okay' -[nested]--> found constructor (Args type) -[nested]--> found arg of type: 'a -[extract_type]--> starting extraction of type: 'a, in env: EnvCompletionOtherFile. Has type arg ctx: false -[extract_type]--> starting extraction of type: 'a, in env: EnvCompletionOtherFile. Has type arg ctx: false -[extract_type]--> found type variable: 'a. Trying to instantiate with no type args ctx -[extract_type]--> could not instantiate 'a. Skipping. Completable: Cpath Value[()] Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives @@ -353,25 +225,6 @@ Resolved opens 1 pervasives ContextPath Value[use](Nolabel) ContextPath Value[use] Path use -[extract_type]--> starting extraction of type: EnvCompletionOtherFile.response, in env: EnvCompletion. Has type arg ctx: false -[extract_type]--> digging for type EnvCompletionOtherFile.response in EnvCompletion -[extract_type]--> found record -[nested]--> running nested in env: EnvCompletion. Has type arg ctx: false -[nested]--> trying to move into record field -[nested]--> found record field type -[nested]--> extracting from type someResult in env EnvCompletionOtherFile -[extract_type]--> starting extraction of type: someResult, in env: EnvCompletionOtherFile. Has type arg ctx: false -[extract_type]--> starting extraction of type: someResult, in env: EnvCompletionOtherFile. Has type arg ctx: false -[extract_type]--> digging for type someResult in EnvCompletionOtherFile -[extract_type]--> found variant -[nested]--> running nested in env: EnvCompletionOtherFile. Has type arg ctx: false -[nested]--> trying to move into variant payload $0 of constructor 'Okay' -[nested]--> found constructor (Args type) -[nested]--> found arg of type: 'a -[extract_type]--> starting extraction of type: 'a, in env: EnvCompletionOtherFile. Has type arg ctx: false -[extract_type]--> starting extraction of type: 'a, in env: EnvCompletionOtherFile. Has type arg ctx: false -[extract_type]--> found type variable: 'a. Trying to instantiate with no type args ctx -[extract_type]--> could not instantiate 'a. Skipping. Completable: Cpath Value[()] Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives @@ -392,25 +245,6 @@ Resolved opens 1 pervasives ContextPath Value[use](Nolabel) ContextPath Value[use] Path use -[extract_type]--> starting extraction of type: EnvCompletionOtherFile.response, in env: EnvCompletion. Has type arg ctx: false -[extract_type]--> digging for type EnvCompletionOtherFile.response in EnvCompletion -[extract_type]--> found record -[nested]--> running nested in env: EnvCompletion. Has type arg ctx: false -[nested]--> trying to move into record field -[nested]--> found record field type -[nested]--> extracting from type someResult in env EnvCompletionOtherFile -[extract_type]--> starting extraction of type: someResult, in env: EnvCompletionOtherFile. Has type arg ctx: false -[extract_type]--> starting extraction of type: someResult, in env: EnvCompletionOtherFile. Has type arg ctx: false -[extract_type]--> digging for type someResult in EnvCompletionOtherFile -[extract_type]--> found variant -[nested]--> running nested in env: EnvCompletionOtherFile. Has type arg ctx: false -[nested]--> trying to move into variant payload $0 of constructor 'Okay' -[nested]--> found constructor (Args type) -[nested]--> found arg of type: 'a -[extract_type]--> starting extraction of type: 'a, in env: EnvCompletionOtherFile. Has type arg ctx: false -[extract_type]--> starting extraction of type: 'a, in env: EnvCompletionOtherFile. Has type arg ctx: false -[extract_type]--> found type variable: 'a. Trying to instantiate with no type args ctx -[extract_type]--> could not instantiate 'a. Skipping. Completable: Cpath Value[Second] Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives @@ -425,12 +259,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[res2] Path res2 -[extract_type]--> starting extraction of type: EnvCompletionOtherFile.someRecord, in env: EnvCompletion. Has type arg ctx: false -[extract_type]--> digging for type EnvCompletionOtherFile.someRecord in EnvCompletion -[extract_type]--> found record -[nested]--> running nested in env: EnvCompletion. Has type arg ctx: true -[nested]--> Type arg context. env: EnvCompletionOtherFile, typeArgs: things2, typeParams: 'thing -[nested]--> reached end of pattern, returning type [{ "label": "{}", "kind": 22, @@ -449,15 +277,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[res2] Path res2 -[extract_type]--> starting extraction of type: EnvCompletionOtherFile.someRecord, in env: EnvCompletion. Has type arg ctx: false -[extract_type]--> digging for type EnvCompletionOtherFile.someRecord in EnvCompletion -[extract_type]--> found record -[nested]--> running nested in env: EnvCompletion. Has type arg ctx: true -[nested]--> Type arg context. env: EnvCompletionOtherFile, typeArgs: things2, typeParams: 'thing -[extract_type]--> starting extraction of type: EnvCompletionOtherFile.someRecord, in env: EnvCompletionOtherFile. Has type arg ctx: true -[extract_type]--> Type arg context. env: EnvCompletionOtherFile, typeArgs: things2, typeParams: 'thing -[extract_type]--> digging for type EnvCompletionOtherFile.someRecord in EnvCompletionOtherFile -[extract_type]--> found record [{ "label": "name", "kind": 5, @@ -485,28 +304,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[res2] Path res2 -[extract_type]--> starting extraction of type: EnvCompletionOtherFile.someRecord, in env: EnvCompletion. Has type arg ctx: false -[extract_type]--> digging for type EnvCompletionOtherFile.someRecord in EnvCompletion -[extract_type]--> found record -[nested]--> running nested in env: EnvCompletion. Has type arg ctx: true -[nested]--> Type arg context. env: EnvCompletionOtherFile, typeArgs: things2, typeParams: 'thing -[nested]--> trying to move into record field -[nested]--> found record field type -[nested]--> extracting from type 'thing in env EnvCompletionOtherFile -[extract_type]--> starting extraction of type: 'thing, in env: EnvCompletionOtherFile. Has type arg ctx: true -[extract_type]--> Type arg context. env: EnvCompletionOtherFile, typeArgs: things2, typeParams: 'thing -[extract_type]--> starting extraction of type: 'thing, in env: EnvCompletionOtherFile. Has type arg ctx: true -[extract_type]--> Type arg context. env: EnvCompletionOtherFile, typeArgs: things2, typeParams: 'thing -[extract_type]--> starting extraction of type: 'thing, in env: EnvCompletionOtherFile. Has type arg ctx: true -[extract_type]--> Type arg context. env: EnvCompletionOtherFile, typeArgs: things2, typeParams: 'thing -[extract_type]--> found type variable: 'thing. Trying to instantiate with Type arg context. env: EnvCompletionOtherFile, typeArgs: things2, typeParams: 'thing -[extract_type]--> SUCCEEDED instantiation, new type is: things2 -[extract_type]--> starting extraction of type: things2, in env: EnvCompletionOtherFile. Has type arg ctx: true -[extract_type]--> Type arg context. env: EnvCompletionOtherFile, typeArgs: things2, typeParams: 'thing -[extract_type]--> digging for type things2 in EnvCompletionOtherFile -[extract_type]--> found record -[nested]--> running nested in env: EnvCompletionOtherFile. Has type arg ctx: false -[nested]--> reached end of pattern, returning type [{ "label": "{}", "kind": 22, @@ -525,23 +322,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[res2] Path res2 -[extract_type]--> starting extraction of type: EnvCompletionOtherFile.someRecord, in env: EnvCompletion. Has type arg ctx: false -[extract_type]--> digging for type EnvCompletionOtherFile.someRecord in EnvCompletion -[extract_type]--> found record -[nested]--> running nested in env: EnvCompletion. Has type arg ctx: true -[nested]--> Type arg context. env: EnvCompletionOtherFile, typeArgs: things2, typeParams: 'thing -[nested]--> trying to move into record field -[nested]--> found record field type -[nested]--> extracting from type theVariant in env EnvCompletionOtherFile -[extract_type]--> starting extraction of type: theVariant, in env: EnvCompletionOtherFile. Has type arg ctx: true -[extract_type]--> Type arg context. env: EnvCompletionOtherFile, typeArgs: things2, typeParams: 'thing -[extract_type]--> starting extraction of type: theVariant, in env: EnvCompletionOtherFile. Has type arg ctx: true -[extract_type]--> Type arg context. env: EnvCompletionOtherFile, typeArgs: things2, typeParams: 'thing -[extract_type]--> digging for type theVariant in EnvCompletionOtherFile -[extract_type]--> found variant -[nested]--> running nested in env: EnvCompletionOtherFile. Has type arg ctx: true -[nested]--> Type arg context. env: EnvCompletionOtherFile, typeArgs: things2, typeParams: 'thing -[nested]--> reached end of pattern, returning type [{ "label": "First", "kind": 4, diff --git a/analysis/tests/src/expected/ExhaustiveSwitch.res.txt b/analysis/tests/src/expected/ExhaustiveSwitch.res.txt index efa4ffc4c..71285318b 100644 --- a/analysis/tests/src/expected/ExhaustiveSwitch.res.txt +++ b/analysis/tests/src/expected/ExhaustiveSwitch.res.txt @@ -5,10 +5,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[withSomeVarian] Path withSomeVarian -[extract_type]--> starting extraction of type: someVariant, in env: ExhaustiveSwitch. Has type arg ctx: false -[extract_type]--> starting extraction of type: someVariant, in env: ExhaustiveSwitch. Has type arg ctx: false -[extract_type]--> digging for type someVariant in ExhaustiveSwitch -[extract_type]--> found variant [{ "label": "withSomeVariant", "kind": 12, @@ -33,16 +29,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[withSomePol] Path withSomePol -[extract_type]--> starting extraction of type: somePolyVariant, in env: ExhaustiveSwitch. Has type arg ctx: false -[extract_type]--> digging for type somePolyVariant in ExhaustiveSwitch -[extract_type]--> found type manifest -[extract_type]--> starting extraction of type: [ - | #"exotic ident" - | #one - | #"switch" - | #three(option) - | #two -], in env: ExhaustiveSwitch. Has type arg ctx: false [{ "label": "withSomePoly", "kind": 12, @@ -56,7 +42,7 @@ Path withSomePol "detail": "insert exhaustive switch for value", "documentation": null, "filterText": "withSomePoly", - "insertText": "withSomePoly {\n | #\"exotic ident\" => ${1:failwith(\"todo\")}\n | #one => ${2:failwith(\"todo\")}\n | #\"switch\" => ${3:failwith(\"todo\")}\n | #three(_) => ${4:failwith(\"todo\")}\n | #two => ${5:failwith(\"todo\")}\n }", + "insertText": "withSomePoly {\n | #\"switch\" => ${1:failwith(\"todo\")}\n | #one => ${2:failwith(\"todo\")}\n | #three(_) => ${3:failwith(\"todo\")}\n | #two => ${4:failwith(\"todo\")}\n | #\"exotic ident\" => ${5:failwith(\"todo\")}\n }", "insertTextFormat": 2 }] @@ -67,8 +53,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[someBoo] Path someBoo -[extract_type]--> starting extraction of type: bool, in env: ExhaustiveSwitch. Has type arg ctx: false -[extract_type]--> starting extraction of type: bool, in env: ExhaustiveSwitch. Has type arg ctx: false [{ "label": "someBool", "kind": 12, @@ -93,8 +77,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[someOp] Path someOp -[extract_type]--> starting extraction of type: option, in env: ExhaustiveSwitch. Has type arg ctx: false -[extract_type]--> starting extraction of type: option, in env: ExhaustiveSwitch. Has type arg ctx: false [{ "label": "someOpt", "kind": 12, @@ -136,9 +118,6 @@ ContextPath Value[getV] Path getV Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives -[extract_type]--> starting extraction of type: someVariant, in env: ExhaustiveSwitch. Has type arg ctx: false -[extract_type]--> digging for type someVariant in ExhaustiveSwitch -[extract_type]--> found variant Hit: Exhaustive switch {"start": {"line": 33, "character": 3}, "end": {"line": 33, "character": 10}} newText: @@ -158,8 +137,6 @@ ContextPath Value[vvv] Path vvv Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives -[extract_type]--> starting extraction of type: option, in env: ExhaustiveSwitch. Has type arg ctx: false -[extract_type]--> starting extraction of type: option, in env: ExhaustiveSwitch. Has type arg ctx: false Hit: Exhaustive switch {"start": {"line": 36, "character": 3}, "end": {"line": 36, "character": 6}} newText: diff --git a/analysis/tests/src/expected/Fragment.res.txt b/analysis/tests/src/expected/Fragment.res.txt index d01b9e99a..adb67f8d8 100644 --- a/analysis/tests/src/expected/Fragment.res.txt +++ b/analysis/tests/src/expected/Fragment.res.txt @@ -16,13 +16,5 @@ Completable: Cexpression CTypeAtPos()=[]->variantPayload::::($1) Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CTypeAtPos() -[extract_type]--> starting extraction of type: React.element, in env: Fragment. Has type arg ctx: false -[extract_type]--> starting extraction of type: React.element, in env: Fragment. Has type arg ctx: false -[extract_type]--> digging for type React.element in Fragment -[extract_type]--> found type manifest -[extract_type]--> starting extraction of type: Jsx.element, in env: React. Has type arg ctx: false -[extract_type]--> digging for type Pervasives.Jsx.element in React -[extract_type]--> found something else when digging ---> could not get completions for context path null diff --git a/analysis/tests/src/expected/Hover.res.txt b/analysis/tests/src/expected/Hover.res.txt index a195e983b..773bd50f3 100644 --- a/analysis/tests/src/expected/Hover.res.txt +++ b/analysis/tests/src/expected/Hover.res.txt @@ -259,7 +259,6 @@ Resolved opens 1 pervasives ContextPath CPatternPath(Value[x])->recordField(someField) ContextPath Value[x] Path x -[nested_pattern_path] {"contents": {"kind": "markdown", "value": "```rescript\nbool\n```"}} Hover src/Hover.res 263:8 diff --git a/analysis/tests/src/expected/Jsx2.res.txt b/analysis/tests/src/expected/Jsx2.res.txt index d563c5f1d..b6f0c10e3 100644 --- a/analysis/tests/src/expected/Jsx2.res.txt +++ b/analysis/tests/src/expected/Jsx2.res.txt @@ -11,10 +11,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CJsxPropValue [M] second Path M.make -[extract_type]--> starting extraction of type: string, in env: Jsx2.M. Has type arg ctx: false -[nested]--> running nested in env: Jsx2.M. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [] Complete src/Jsx2.res 11:20 diff --git a/analysis/tests/src/expected/Reprod.res.txt b/analysis/tests/src/expected/Reprod.res.txt index aba1c1041..fff7807f8 100644 --- a/analysis/tests/src/expected/Reprod.res.txt +++ b/analysis/tests/src/expected/Reprod.res.txt @@ -5,37 +5,8 @@ Completable: Cexpression CArgument Value[Query, use](~variables)->recordField(lo Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CArgument Value[Query, use](~variables) ---> function argument: variables ContextPath Value[Query, use] Path Query.use ---> found function type ---> found function argument! -[extract_type]--> starting extraction of type: QueryFile.Types.variables, in env: Reprod.Query. Has type arg ctx: false -[extract_type]--> starting extraction of type: QueryFile.Types.variables, in env: Reprod.Query. Has type arg ctx: false -[extract_type]--> digging for type QueryFile.Types.variables in Reprod.Query -[extract_type]--> found record -[nested]--> running nested in env: Reprod.Query. Has type arg ctx: false -[nested]--> trying to move into record field -[nested]--> found record field type -[nested]--> extracting from type location in env QueryFile.Types -[extract_type]--> starting extraction of type: location, in env: QueryFile.Types. Has type arg ctx: false -[extract_type]--> starting extraction of type: location, in env: QueryFile.Types. Has type arg ctx: false -[extract_type]--> digging for type location in QueryFile.Types -[extract_type]--> found type manifest -[extract_type]--> starting extraction of type: SchemaAssets.input_Location, in env: QueryFile.Types. Has type arg ctx: false -[extract_type]--> digging for type SchemaAssets.input_Location in QueryFile.Types -[extract_type]--> found variant -[nested]--> running nested in env: QueryFile.Types. Has type arg ctx: false -[nested]--> trying to move into variant payload $0 of constructor 'ByAddress' -[nested]--> found constructor (Args type) -[nested]--> found arg of type: input_ByAddress -[extract_type]--> starting extraction of type: input_ByAddress, in env: SchemaAssets. Has type arg ctx: false -[extract_type]--> digging for type input_ByAddress in SchemaAssets -[extract_type]--> found record -[nested]--> extracted type, continuing descent -[nested]--> running nested in env: SchemaAssets. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "{}", "kind": 12, @@ -54,29 +25,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[record] Path record -[extract_type]--> starting extraction of type: paramRecord, in env: Reprod. Has type arg ctx: false -[extract_type]--> digging for type paramRecord in Reprod -[extract_type]--> found record -[nested]--> running nested in env: Reprod. Has type arg ctx: true -[nested]--> Type arg context. env: Reprod, typeArgs: someVariant, QueryFile.Types.byAddress, typeParams: 'a, 'b -[nested]--> trying to move into record field -[nested]--> found record field type -[nested]--> extracting from type 'a in env Reprod -[extract_type]--> starting extraction of type: 'a, in env: Reprod. Has type arg ctx: true -[extract_type]--> Type arg context. env: Reprod, typeArgs: someVariant, QueryFile.Types.byAddress, typeParams: 'a, 'b -[extract_type]--> starting extraction of type: 'a, in env: Reprod. Has type arg ctx: true -[extract_type]--> Type arg context. env: Reprod, typeArgs: someVariant, QueryFile.Types.byAddress, typeParams: 'a, 'b -[extract_type]--> starting extraction of type: 'a, in env: Reprod. Has type arg ctx: true -[extract_type]--> Type arg context. env: Reprod, typeArgs: someVariant, QueryFile.Types.byAddress, typeParams: 'a, 'b -[extract_type]--> found type variable: 'a. Trying to instantiate with Type arg context. env: Reprod, typeArgs: someVariant, QueryFile.Types.byAddress, typeParams: 'a, 'b -[extract_type]--> SUCCEEDED instantiation, new type is: someVariant -[extract_type]--> starting extraction of type: someVariant, in env: Reprod. Has type arg ctx: true -[extract_type]--> Type arg context. env: Reprod, typeArgs: someVariant, QueryFile.Types.byAddress, typeParams: 'a, 'b -[extract_type]--> digging for type someVariant in Reprod -[extract_type]--> found variant -[nested]--> running nested in env: Reprod. Has type arg ctx: true -[nested]--> Type arg context. env: Reprod, typeArgs: someVariant, QueryFile.Types.byAddress, typeParams: 'a, 'b -[nested]--> reached end of pattern, returning type [{ "label": "One", "kind": 4, @@ -110,31 +58,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[record] Path record -[extract_type]--> starting extraction of type: paramRecord, in env: Reprod. Has type arg ctx: false -[extract_type]--> digging for type paramRecord in Reprod -[extract_type]--> found record -[nested]--> running nested in env: Reprod. Has type arg ctx: true -[nested]--> Type arg context. env: Reprod, typeArgs: someVariant, QueryFile.Types.byAddress, typeParams: 'a, 'b -[nested]--> trying to move into record field -[nested]--> found record field type -[nested]--> extracting from type 'b in env Reprod -[extract_type]--> starting extraction of type: 'b, in env: Reprod. Has type arg ctx: true -[extract_type]--> Type arg context. env: Reprod, typeArgs: someVariant, QueryFile.Types.byAddress, typeParams: 'a, 'b -[extract_type]--> starting extraction of type: 'b, in env: Reprod. Has type arg ctx: true -[extract_type]--> Type arg context. env: Reprod, typeArgs: someVariant, QueryFile.Types.byAddress, typeParams: 'a, 'b -[extract_type]--> starting extraction of type: 'b, in env: Reprod. Has type arg ctx: true -[extract_type]--> Type arg context. env: Reprod, typeArgs: someVariant, QueryFile.Types.byAddress, typeParams: 'a, 'b -[extract_type]--> found type variable: 'b. Trying to instantiate with Type arg context. env: Reprod, typeArgs: someVariant, QueryFile.Types.byAddress, typeParams: 'a, 'b -[extract_type]--> SUCCEEDED instantiation, new type is: QueryFile.Types.byAddress -[extract_type]--> starting extraction of type: QueryFile.Types.byAddress, in env: Reprod. Has type arg ctx: true -[extract_type]--> Type arg context. env: Reprod, typeArgs: someVariant, QueryFile.Types.byAddress, typeParams: 'a, 'b -[extract_type]--> digging for type QueryFile.Types.byAddress in Reprod -[extract_type]--> found type manifest -[extract_type]--> starting extraction of type: SchemaAssets.input_ByAddress, in env: QueryFile.Types. Has type arg ctx: false -[extract_type]--> digging for type SchemaAssets.input_ByAddress in QueryFile.Types -[extract_type]--> found record -[nested]--> running nested in env: Reprod. Has type arg ctx: false -[nested]--> reached end of pattern, returning type [{ "label": "{}", "kind": 22, @@ -156,32 +79,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[res] Path res -[extract_type]--> starting extraction of type: result, in env: Reprod. Has type arg ctx: false -[extract_type]--> digging for type Pervasives.result in Reprod -[extract_type]--> found type manifest -[extract_type]--> starting extraction of type: Belt.Result.t<'a, 'b>, in env: Pervasives. Has type arg ctx: true -[extract_type]--> Type arg context. env: Reprod, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b -[extract_type]--> digging for type Belt.Result.t in Pervasives -[extract_type]--> found variant -[nested]--> running nested in env: Reprod. Has type arg ctx: true -[nested]--> Type arg context. env: Reprod, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b -[nested]--> trying to move into variant payload $0 of constructor 'Ok' -[nested]--> found constructor (Args type) -[nested]--> found arg of type: 'a -[extract_type]--> starting extraction of type: 'a, in env: Belt_Result. Has type arg ctx: true -[extract_type]--> Type arg context. env: Reprod, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b -[extract_type]--> starting extraction of type: 'a, in env: Belt_Result. Has type arg ctx: true -[extract_type]--> Type arg context. env: Reprod, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b -[extract_type]--> found type variable: 'a. Trying to instantiate with Type arg context. env: Reprod, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b -[extract_type]--> SUCCEEDED instantiation, new type is: someVariant -[extract_type]--> starting extraction of type: someVariant, in env: Reprod. Has type arg ctx: true -[extract_type]--> Type arg context. env: Reprod, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b -[extract_type]--> digging for type someVariant in Reprod -[extract_type]--> found variant -[nested]--> extracted type, continuing descent -[nested]--> running nested in env: Belt_Result. Has type arg ctx: true -[nested]--> Type arg context. env: Reprod, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b -[nested]--> reached end of pattern, returning type [{ "label": "One", "kind": 4, @@ -218,32 +115,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[res] Path res -[extract_type]--> starting extraction of type: result, in env: Reprod. Has type arg ctx: false -[extract_type]--> digging for type Pervasives.result in Reprod -[extract_type]--> found type manifest -[extract_type]--> starting extraction of type: Belt.Result.t<'a, 'b>, in env: Pervasives. Has type arg ctx: true -[extract_type]--> Type arg context. env: Reprod, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b -[extract_type]--> digging for type Belt.Result.t in Pervasives -[extract_type]--> found variant -[nested]--> running nested in env: Reprod. Has type arg ctx: true -[nested]--> Type arg context. env: Reprod, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b -[nested]--> trying to move into variant payload $0 of constructor 'Error' -[nested]--> found constructor (Args type) -[nested]--> found arg of type: 'b -[extract_type]--> starting extraction of type: 'b, in env: Belt_Result. Has type arg ctx: true -[extract_type]--> Type arg context. env: Reprod, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b -[extract_type]--> starting extraction of type: 'b, in env: Belt_Result. Has type arg ctx: true -[extract_type]--> Type arg context. env: Reprod, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b -[extract_type]--> found type variable: 'b. Trying to instantiate with Type arg context. env: Reprod, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b -[extract_type]--> SUCCEEDED instantiation, new type is: somePolyVariant -[extract_type]--> starting extraction of type: somePolyVariant, in env: Reprod. Has type arg ctx: true -[extract_type]--> Type arg context. env: Reprod, typeArgs: someVariant, somePolyVariant, typeParams: 'a, 'b -[extract_type]--> digging for type somePolyVariant in Reprod -[extract_type]--> found type manifest -[extract_type]--> starting extraction of type: [#one | #three(someRecord, bool) | #two(bool)], in env: Reprod. Has type arg ctx: false -[nested]--> extracted type, continuing descent -[nested]--> running nested in env: Belt_Result. Has type arg ctx: false -[nested]--> reached end of pattern, returning type [{ "label": "#one", "kind": 4, @@ -280,33 +151,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[resOpt] Path resOpt -[extract_type]--> starting extraction of type: result, unit>, in env: Reprod. Has type arg ctx: false -[extract_type]--> digging for type Pervasives.result in Reprod -[extract_type]--> found type manifest -[extract_type]--> starting extraction of type: Belt.Result.t<'a, 'b>, in env: Pervasives. Has type arg ctx: true -[extract_type]--> Type arg context. env: Reprod, typeArgs: option, unit, typeParams: 'a, 'b -[extract_type]--> digging for type Belt.Result.t in Pervasives -[extract_type]--> found variant -[nested]--> running nested in env: Reprod. Has type arg ctx: true -[nested]--> Type arg context. env: Reprod, typeArgs: option, unit, typeParams: 'a, 'b -[nested]--> trying to move into variant payload $0 of constructor 'Ok' -[nested]--> found constructor (Args type) -[nested]--> found arg of type: 'a -[extract_type]--> starting extraction of type: 'a, in env: Belt_Result. Has type arg ctx: true -[extract_type]--> Type arg context. env: Reprod, typeArgs: option, unit, typeParams: 'a, 'b -[extract_type]--> starting extraction of type: 'a, in env: Belt_Result. Has type arg ctx: true -[extract_type]--> Type arg context. env: Reprod, typeArgs: option, unit, typeParams: 'a, 'b -[extract_type]--> found type variable: 'a. Trying to instantiate with Type arg context. env: Reprod, typeArgs: option, unit, typeParams: 'a, 'b -[extract_type]--> SUCCEEDED instantiation, new type is: option -[extract_type]--> starting extraction of type: option, in env: Reprod. Has type arg ctx: true -[extract_type]--> Type arg context. env: Reprod, typeArgs: option, unit, typeParams: 'a, 'b -[nested]--> extracted type, continuing descent -[nested]--> running nested in env: Belt_Result. Has type arg ctx: true -[nested]--> Type arg context. env: Reprod, typeArgs: option, unit, typeParams: 'a, 'b -[nested]--> reached end of pattern, returning type -[extract_type]--> starting extraction of type: someVariant, in env: Reprod. Has type arg ctx: false -[extract_type]--> digging for type someVariant in Reprod -[extract_type]--> found variant [{ "label": "None", "kind": 12, @@ -359,37 +203,6 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[resOpt] Path resOpt -[extract_type]--> starting extraction of type: result, unit>, in env: Reprod. Has type arg ctx: false -[extract_type]--> digging for type Pervasives.result in Reprod -[extract_type]--> found type manifest -[extract_type]--> starting extraction of type: Belt.Result.t<'a, 'b>, in env: Pervasives. Has type arg ctx: true -[extract_type]--> Type arg context. env: Reprod, typeArgs: option, unit, typeParams: 'a, 'b -[extract_type]--> digging for type Belt.Result.t in Pervasives -[extract_type]--> found variant -[nested]--> running nested in env: Reprod. Has type arg ctx: true -[nested]--> Type arg context. env: Reprod, typeArgs: option, unit, typeParams: 'a, 'b -[nested]--> trying to move into variant payload $0 of constructor 'Ok' -[nested]--> found constructor (Args type) -[nested]--> found arg of type: 'a -[extract_type]--> starting extraction of type: 'a, in env: Belt_Result. Has type arg ctx: true -[extract_type]--> Type arg context. env: Reprod, typeArgs: option, unit, typeParams: 'a, 'b -[extract_type]--> starting extraction of type: 'a, in env: Belt_Result. Has type arg ctx: true -[extract_type]--> Type arg context. env: Reprod, typeArgs: option, unit, typeParams: 'a, 'b -[extract_type]--> found type variable: 'a. Trying to instantiate with Type arg context. env: Reprod, typeArgs: option, unit, typeParams: 'a, 'b -[extract_type]--> SUCCEEDED instantiation, new type is: option -[extract_type]--> starting extraction of type: option, in env: Reprod. Has type arg ctx: true -[extract_type]--> Type arg context. env: Reprod, typeArgs: option, unit, typeParams: 'a, 'b -[nested]--> extracted type, continuing descent -[nested]--> running nested in env: Belt_Result. Has type arg ctx: true -[nested]--> Type arg context. env: Reprod, typeArgs: option, unit, typeParams: 'a, 'b -[nested]--> moving into option Some -[extract_type]--> starting extraction of type: someVariant, in env: Reprod. Has type arg ctx: true -[extract_type]--> Type arg context. env: Reprod, typeArgs: option, unit, typeParams: 'a, 'b -[extract_type]--> digging for type someVariant in Reprod -[extract_type]--> found variant -[nested]--> running nested in env: Reprod. Has type arg ctx: true -[nested]--> Type arg context. env: Reprod, typeArgs: option, unit, typeParams: 'a, 'b -[nested]--> reached end of pattern, returning type [{ "label": "One", "kind": 4, diff --git a/analysis/tests/src/expected/TypeAtPosCompletion.res.txt b/analysis/tests/src/expected/TypeAtPosCompletion.res.txt index 3c0a8a0b2..8a334e9c6 100644 --- a/analysis/tests/src/expected/TypeAtPosCompletion.res.txt +++ b/analysis/tests/src/expected/TypeAtPosCompletion.res.txt @@ -4,15 +4,6 @@ Completable: Cexpression CTypeAtPos()->recordBody Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CTypeAtPos() -[extract_type]--> starting extraction of type: optRecord, in env: TypeAtPosCompletion. Has type arg ctx: false -[extract_type]--> starting extraction of type: optRecord, in env: TypeAtPosCompletion. Has type arg ctx: false -[extract_type]--> digging for type optRecord in TypeAtPosCompletion -[extract_type]--> found record -[nested]--> running nested in env: TypeAtPosCompletion. Has type arg ctx: false -[extract_type]--> starting extraction of type: optRecord, in env: TypeAtPosCompletion. Has type arg ctx: false -[extract_type]--> digging for type optRecord in TypeAtPosCompletion -[extract_type]--> found record ---> found type in nested expression completion [{ "label": "age", "kind": 5, @@ -36,23 +27,6 @@ Completable: Cexpression CTypeAtPos()->variantPayload::One($1), recordBody Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CTypeAtPos() -[extract_type]--> starting extraction of type: someVariant, in env: TypeAtPosCompletion. Has type arg ctx: false -[extract_type]--> starting extraction of type: someVariant, in env: TypeAtPosCompletion. Has type arg ctx: false -[extract_type]--> digging for type someVariant in TypeAtPosCompletion -[extract_type]--> found variant -[nested]--> running nested in env: TypeAtPosCompletion. Has type arg ctx: false -[nested]--> trying to move into variant payload $1 of constructor 'One' -[nested]--> found constructor (Args type) -[nested]--> found arg of type: optRecord -[extract_type]--> starting extraction of type: optRecord, in env: TypeAtPosCompletion. Has type arg ctx: false -[extract_type]--> digging for type optRecord in TypeAtPosCompletion -[extract_type]--> found record -[nested]--> extracted type, continuing descent -[nested]--> running nested in env: TypeAtPosCompletion. Has type arg ctx: false -[extract_type]--> starting extraction of type: optRecord, in env: TypeAtPosCompletion. Has type arg ctx: false -[extract_type]--> digging for type optRecord in TypeAtPosCompletion -[extract_type]--> found record ---> found type in nested expression completion [{ "label": "age", "kind": 5, @@ -73,16 +47,6 @@ Completable: Cexpression CTypeAtPos()->array Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath CTypeAtPos() -[extract_type]--> starting extraction of type: array, in env: TypeAtPosCompletion. Has type arg ctx: false -[extract_type]--> starting extraction of type: array, in env: TypeAtPosCompletion. Has type arg ctx: false -[nested]--> running nested in env: TypeAtPosCompletion. Has type arg ctx: false -[extract_type]--> starting extraction of type: optRecord, in env: TypeAtPosCompletion. Has type arg ctx: false -[extract_type]--> starting extraction of type: optRecord, in env: TypeAtPosCompletion. Has type arg ctx: false -[extract_type]--> digging for type optRecord in TypeAtPosCompletion -[extract_type]--> found record -[nested]--> running nested in env: TypeAtPosCompletion. Has type arg ctx: false -[nested]--> reached end of pattern, returning type ---> found type in nested expression completion [{ "label": "{}", "kind": 12, diff --git a/analysis/tests/src/expected/Xform.res.txt b/analysis/tests/src/expected/Xform.res.txt index 852725180..0af705bff 100644 --- a/analysis/tests/src/expected/Xform.res.txt +++ b/analysis/tests/src/expected/Xform.res.txt @@ -7,8 +7,6 @@ ContextPath Value[kind] Path kind Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives -[extract_type]--> starting extraction of type: 'a, in env: Xform. Has type arg ctx: false -[extract_type]--> miss Hit: Replace with switch {"start": {"line": 6, "character": 0}, "end": {"line": 11, "character": 1}} newText: @@ -110,8 +108,6 @@ ContextPath Value[name] Path name Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives -[extract_type]--> starting extraction of type: string, in env: Xform. Has type arg ctx: false -[extract_type]--> starting extraction of type: string, in env: Xform. Has type arg ctx: false Hit: Add braces to function {"start": {"line": 48, "character": 0}, "end": {"line": 48, "character": 25}} newText: From 4320187181eb2e14cad0090d76bfef822a74e3b7 Mon Sep 17 00:00:00 2001 From: Gabriel Nordeborn Date: Wed, 10 Jan 2024 14:35:23 +0100 Subject: [PATCH 12/17] fix type args env for type manifests --- analysis/src/Commands.ml | 4 +- analysis/src/CompletionBackEnd.ml | 85 +++--- analysis/src/SharedTypes.ml | 17 +- analysis/src/TypeUtils.ml | 272 +++++++++--------- .../tests/src/expected/EnvCompletion.res.txt | 108 ++++--- 5 files changed, 271 insertions(+), 215 deletions(-) diff --git a/analysis/src/Commands.ml b/analysis/src/Commands.ml index 486f46743..3a91151cc 100644 --- a/analysis/src/Commands.ml +++ b/analysis/src/Commands.ml @@ -163,7 +163,7 @@ let references ~path ~pos ~debug = in print_endline (if allLocs = [] then Protocol.null - else "[\n" ^ (allLocs |> String.concat ",\n") ^ "\n]") + else "[\n" ^ (allLocs |> String.concat ",\n") ^ "\n]") let rename ~path ~pos ~newName ~debug = let result = @@ -304,6 +304,8 @@ let test ~path = (match String.sub rest 0 3 with | "db+" -> Log.verbose := true | "db-" -> Log.verbose := false + | "dv+" -> Debug.debugLevel := Verbose + | "dv-" -> Debug.debugLevel := Off | "def" -> print_endline ("Definition " ^ path ^ " " ^ string_of_int line ^ ":" diff --git a/analysis/src/CompletionBackEnd.ml b/analysis/src/CompletionBackEnd.ml index 7ab70ecac..c9a5f2eb5 100644 --- a/analysis/src/CompletionBackEnd.ml +++ b/analysis/src/CompletionBackEnd.ml @@ -1205,12 +1205,15 @@ let printConstructorArgs ~mode ~asSnippet argsLen = if List.length !args > 0 then "(" ^ (!args |> String.concat ", ") ^ ")" else "" -let rec completeTypedValue ~rawOpens ~full ~prefix ~completionContext ~mode - (t : SharedTypes.completionType) = +let rec completeTypedValue ?(typeArgContext : typeArgContext option) ~rawOpens + ~full ~prefix ~completionContext ~mode (t : SharedTypes.completionType) = let emptyCase = emptyCase ~mode in let printConstructorArgs = printConstructorArgs ~mode in + let createWithSnippet = Completion.createWithSnippet ?typeArgContext in + let create = Completion.create ?typeArgContext in match t with | TtypeT {env; path} -> + if Debug.verbose () then print_endline "[complete_typed_value]--> TtypeT"; (* Find all functions in the module that returns type t *) let rec fnReturnsTypeT t = match t.Types.desc with @@ -1258,18 +1261,20 @@ let rec completeTypedValue ~rawOpens ~full ~prefix ~completionContext ~mode item)); Hashtbl.fold (fun fnName typeExpr all -> - Completion.createWithSnippet + createWithSnippet ~name:(Printf.sprintf "%s()" fnName) ~insertText:(fnName ^ "($0)") ~kind:(Value typeExpr) ~env () :: all) functionsReturningTypeT [] | Tbool env -> + if Debug.verbose () then print_endline "[complete_typed_value]--> Tbool"; [ - Completion.create "true" ~kind:(Label "bool") ~env; - Completion.create "false" ~kind:(Label "bool") ~env; + create "true" ~kind:(Label "bool") ~env; + create "false" ~kind:(Label "bool") ~env; ] |> filterItems ~prefix | Tvariant {env; constructors; variantDecl; variantName} -> + if Debug.verbose () then print_endline "[complete_typed_value]--> Tvariant"; constructors |> List.map (fun (constructor : Constructor.t) -> let numArgs = @@ -1277,7 +1282,7 @@ let rec completeTypedValue ~rawOpens ~full ~prefix ~completionContext ~mode | InlineRecord _ -> 1 | Args args -> List.length args in - Completion.createWithSnippet ?deprecated:constructor.deprecated + createWithSnippet ?deprecated:constructor.deprecated ~name: (constructor.cname.txt ^ printConstructorArgs numArgs ~asSnippet:false) @@ -1290,9 +1295,11 @@ let rec completeTypedValue ~rawOpens ~full ~prefix ~completionContext ~mode ~env ()) |> filterItems ~prefix | Tpolyvariant {env; constructors; typeExpr} -> + if Debug.verbose () then + print_endline "[complete_typed_value]--> Tpolyvariant"; constructors |> List.map (fun (constructor : polyVariantConstructor) -> - Completion.createWithSnippet + createWithSnippet ~name: ("#" ^ constructor.displayName ^ printConstructorArgs @@ -1311,6 +1318,7 @@ let rec completeTypedValue ~rawOpens ~full ~prefix ~completionContext ~mode |> filterItems ~prefix:(if Utils.startsWith prefix "#" then prefix else "#" ^ prefix) | Toption (env, t) -> + if Debug.verbose () then print_endline "[complete_typed_value]--> Toption"; let innerType = match t with | ExtractedType t -> Some (t, None) @@ -1335,8 +1343,7 @@ let rec completeTypedValue ~rawOpens ~full ~prefix ~completionContext ~mode in let noneCase = Completion.create "None" ~kind:(kindFromInnerType t) ~env in let someAnyCase = - Completion.createWithSnippet ~name:"Some(_)" ~kind:(kindFromInnerType t) - ~env + createWithSnippet ~name:"Some(_)" ~kind:(kindFromInnerType t) ~env ~insertText:(Printf.sprintf "Some(%s)" (emptyCase 1)) () in @@ -1344,7 +1351,7 @@ let rec completeTypedValue ~rawOpens ~full ~prefix ~completionContext ~mode match completionContext with | Some (Completable.CameFromRecordField fieldName) -> [ - Completion.createWithSnippet + createWithSnippet ~name:("Some(" ^ fieldName ^ ")") ~kind:(kindFromInnerType t) ~env ~insertText:("Some(" ^ fieldName ^ ")$0") @@ -1356,6 +1363,7 @@ let rec completeTypedValue ~rawOpens ~full ~prefix ~completionContext ~mode in completions @ expandedCompletions |> filterItems ~prefix | Tresult {env; okType; errorType} -> + if Debug.verbose () then print_endline "[complete_typed_value]--> Tresult"; let okInnerType = okType |> TypeUtils.extractType2 ~env ~package:full.package in @@ -1397,12 +1405,12 @@ let rec completeTypedValue ~rawOpens ~full ~prefix ~completionContext ~mode }) in let okAnyCase = - Completion.createWithSnippet ~name:"Ok(_)" ~kind:(Value okType) ~env + createWithSnippet ~name:"Ok(_)" ~kind:(Value okType) ~env ~insertText:(Printf.sprintf "Ok(%s)" (emptyCase 1)) () in let errorAnyCase = - Completion.createWithSnippet ~name:"Error(_)" ~kind:(Value errorType) ~env + createWithSnippet ~name:"Error(_)" ~kind:(Value errorType) ~env ~insertText:(Printf.sprintf "Error(%s)" (emptyCase 1)) () in @@ -1410,7 +1418,7 @@ let rec completeTypedValue ~rawOpens ~full ~prefix ~completionContext ~mode match completionContext with | Some (Completable.CameFromRecordField fieldName) -> [ - Completion.createWithSnippet + createWithSnippet ~name:("Ok(" ^ fieldName ^ ")") ~kind:(Value okType) ~env ~insertText:("Ok(" ^ fieldName ^ ")$0") @@ -1423,14 +1431,16 @@ let rec completeTypedValue ~rawOpens ~full ~prefix ~completionContext ~mode completions @ expandedOkCompletions @ expandedErrorCompletions |> filterItems ~prefix | Tuple (env, exprs, typ) -> + if Debug.verbose () then print_endline "[complete_typed_value]--> Tuple"; let numExprs = List.length exprs in [ - Completion.createWithSnippet + createWithSnippet ~name:(printConstructorArgs numExprs ~asSnippet:false) ~insertText:(printConstructorArgs numExprs ~asSnippet:true) ~kind:(Value typ) ~env (); ] | Trecord {env; fields} as extractedType -> ( + if Debug.verbose () then print_endline "[complete_typed_value]--> Trecord"; (* As we're completing for a record, we'll need a hint (completionContext) here to figure out whether we should complete for a record field, or the record body itself. *) @@ -1442,8 +1452,7 @@ let rec completeTypedValue ~rawOpens ~full ~prefix ~completionContext ~mode |> List.map (fun (field : field) -> match (field.optional, mode) with | true, Pattern Destructuring -> - Completion.create ("?" ^ field.fname.txt) - ?deprecated:field.deprecated + create ("?" ^ field.fname.txt) ?deprecated:field.deprecated ~docstring: [ field.fname.txt @@ -1454,7 +1463,7 @@ let rec completeTypedValue ~rawOpens ~full ~prefix ~completionContext ~mode (Field (field, TypeUtils.extractedTypeToString extractedType)) ~env | _ -> - Completion.create field.fname.txt ?deprecated:field.deprecated + create field.fname.txt ?deprecated:field.deprecated ~kind: (Field (field, TypeUtils.extractedTypeToString extractedType)) ~env) @@ -1462,7 +1471,7 @@ let rec completeTypedValue ~rawOpens ~full ~prefix ~completionContext ~mode | _ -> if prefix = "" then [ - Completion.createWithSnippet ~name:"{}" + createWithSnippet ~name:"{}" ~insertText:(if !Cfg.supportsSnippets then "{$0}" else "{}") ~sortText:"A" ~kind: @@ -1475,27 +1484,30 @@ let rec completeTypedValue ~rawOpens ~full ~prefix ~completionContext ~mode ] else []) | TinlineRecord {env; fields} -> ( + if Debug.verbose () then + print_endline "[complete_typed_value]--> TinlineRecord"; match completionContext with | Some (Completable.RecordField {seenFields}) -> fields |> List.filter (fun (field : field) -> List.mem field.fname.txt seenFields = false) |> List.map (fun (field : field) -> - Completion.create field.fname.txt ~kind:(Label "Inline record") + create field.fname.txt ~kind:(Label "Inline record") ?deprecated:field.deprecated ~env) |> filterItems ~prefix | _ -> if prefix = "" then [ - Completion.createWithSnippet ~name:"{}" + createWithSnippet ~name:"{}" ~insertText:(if !Cfg.supportsSnippets then "{$0}" else "{}") ~sortText:"A" ~kind:(Label "Inline record") ~env (); ] else []) | Tarray (env, typ) -> + if Debug.verbose () then print_endline "[complete_typed_value]--> Tarray"; if prefix = "" then [ - Completion.createWithSnippet ~name:"[]" + createWithSnippet ~name:"[]" ~insertText:(if !Cfg.supportsSnippets then "[$0]" else "[]") ~sortText:"A" ~kind: @@ -1511,9 +1523,10 @@ let rec completeTypedValue ~rawOpens ~full ~prefix ~completionContext ~mode ] else [] | Tstring env -> + if Debug.verbose () then print_endline "[complete_typed_value]--> Tstring"; if prefix = "" then [ - Completion.createWithSnippet ~name:"\"\"" + createWithSnippet ~name:"\"\"" ~insertText:(if !Cfg.supportsSnippets then "\"$0\"" else "\"\"") ~sortText:"A" ~kind: @@ -1523,6 +1536,8 @@ let rec completeTypedValue ~rawOpens ~full ~prefix ~completionContext ~mode else [] | Tfunction {env; typ; args; uncurried; returnType} when prefix = "" && mode = Expression -> + if Debug.verbose () then + print_endline "[complete_typed_value]--> Tfunction #1"; let shouldPrintAsUncurried = uncurried && !Config.uncurried <> Uncurried in let mkFnArgs ~asSnippet = match args with @@ -1565,7 +1580,7 @@ let rec completeTypedValue ~rawOpens ~full ~prefix ~completionContext ~mode in let asyncPrefix = if isAsync then "async " else "" in [ - Completion.createWithSnippet + createWithSnippet ~name:(asyncPrefix ^ mkFnArgs ~asSnippet:false ^ " => {}") ~insertText: (asyncPrefix @@ -1574,10 +1589,14 @@ let rec completeTypedValue ~rawOpens ~full ~prefix ~completionContext ~mode ^ if !Cfg.supportsSnippets then "{$0}" else "{}") ~sortText:"A" ~kind:(Value typ) ~env (); ] - | Tfunction _ -> [] + | Tfunction _ -> + if Debug.verbose () then + print_endline "[complete_typed_value]--> Tfunction #other"; + [] | Texn env -> + if Debug.verbose () then print_endline "[complete_typed_value]--> Texn"; [ - Completion.create + create (full.package.builtInCompletionModules.exnModulePath @ ["Error(error)"] |> ident) ~kind:(Label "Catches errors from JavaScript errors.") @@ -1589,7 +1608,9 @@ let rec completeTypedValue ~rawOpens ~full ~prefix ~completionContext ~mode ] ~env; ] - | Tpromise _ -> [] + | Tpromise _ -> + if Debug.verbose () then print_endline "[complete_typed_value]--> Tpromise"; + [] module StringSet = Set.Make (String) @@ -1832,11 +1853,11 @@ let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover completable = |> TypeUtils.resolveNested2 ?typeArgContext ~env ~full ~nested) with | None -> fallbackOrEmpty () - | Some (typ, _env, completionContext) -> + | Some (typ, _env, completionContext, typeArgContext) -> let items = typ - |> completeTypedValue ~rawOpens ~mode:(Pattern patternMode) ~full - ~prefix ~completionContext + |> completeTypedValue ?typeArgContext ~rawOpens + ~mode:(Pattern patternMode) ~full ~prefix ~completionContext in fallbackOrEmpty ~items ()) | None -> fallbackOrEmpty ()) @@ -1867,7 +1888,7 @@ let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover completable = if Debug.verbose () then print_endline "--> could not resolve nested expression path"; regularCompletions - | Some (typ, _env, completionContext) -> ( + | Some (typ, _env, completionContext, typeArgContext) -> ( if Debug.verbose () then print_endline "--> found type in nested expression completion"; (* Wrap the insert text in braces when we're completing the root of a @@ -1881,8 +1902,8 @@ let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover completable = in let items = typ - |> completeTypedValue ~rawOpens ~mode:Expression ~full ~prefix - ~completionContext + |> completeTypedValue ?typeArgContext ~rawOpens ~mode:Expression ~full + ~prefix ~completionContext |> List.map (fun (c : Completion.t) -> if wrapInsertTextInBraces then { diff --git a/analysis/src/SharedTypes.ml b/analysis/src/SharedTypes.ml index a4554b941..cc25c5031 100644 --- a/analysis/src/SharedTypes.ml +++ b/analysis/src/SharedTypes.ml @@ -311,6 +311,12 @@ end = struct {env with exported = structure.exported; pathRev; parent = Some env} end +type typeArgContext = { + env: QueryEnv.t; + typeArgs: Types.type_expr list; + typeParams: Types.type_expr list; +} + type polyVariantConstructor = { name: string; displayName: string; @@ -779,10 +785,11 @@ module Completion = struct docstring: string list; kind: kind; detail: string option; + typeArgContext: typeArgContext option; } - let create ~kind ~env ?(docstring = []) ?filterText ?detail ?deprecated - ?insertText name = + let create ~kind ~env ?typeArgContext ?(docstring = []) ?filterText ?detail + ?deprecated ?insertText name = { name; env; @@ -794,10 +801,11 @@ module Completion = struct insertTextFormat = None; filterText; detail; + typeArgContext; } - let createWithSnippet ~name ?insertText ~kind ~env ?sortText ?deprecated - ?filterText ?detail ?(docstring = []) () = + let createWithSnippet ~name ?typeArgContext ?insertText ~kind ~env ?sortText + ?deprecated ?filterText ?detail ?(docstring = []) () = { name; env; @@ -809,6 +817,7 @@ module Completion = struct insertTextFormat = Some Protocol.Snippet; filterText; detail; + typeArgContext; } (* https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_completion *) diff --git a/analysis/src/TypeUtils.ml b/analysis/src/TypeUtils.ml index 421dc1170..e259fa0dd 100644 --- a/analysis/src/TypeUtils.ml +++ b/analysis/src/TypeUtils.ml @@ -1,10 +1,63 @@ open SharedTypes -type typeArgContext = { - env: QueryEnv.t; - typeArgs: Types.type_expr list; - typeParams: Types.type_expr list; -} +let debugLogTypeArgContext {env; typeArgs; typeParams} = + Printf.sprintf "Type arg context. env: %s, typeArgs: %s, typeParams: %s\n" + (Debug.debugPrintEnv env) + (typeArgs |> List.map Shared.typeToString |> String.concat ", ") + (typeParams |> List.map Shared.typeToString |> String.concat ", ") + +let rec pathFromTypeExpr (t : Types.type_expr) = + match t.desc with + | Tconstr (Pident {name = "function$"}, [t; _], _) -> pathFromTypeExpr t + | Tconstr (path, _typeArgs, _) + | Tlink {desc = Tconstr (path, _typeArgs, _)} + | Tsubst {desc = Tconstr (path, _typeArgs, _)} + | Tpoly ({desc = Tconstr (path, _typeArgs, _)}, []) -> + Some path + | _ -> None + +let printRecordFromFields ?name (fields : field list) = + (match name with + | None -> "" + | Some name -> "type " ^ name ^ " = ") + ^ "{" + ^ (fields + |> List.map (fun f -> f.fname.txt ^ ": " ^ Shared.typeToString f.typ) + |> String.concat ", ") + ^ "}" + +let rec extractedTypeToString ?(inner = false) = function + | Tuple (_, _, typ) + | Tpolyvariant {typeExpr = typ} + | Tfunction {typ} + | Trecord {definition = `TypeExpr typ} -> + if inner then + match pathFromTypeExpr typ with + | None -> "record" (* Won't happen *) + | Some p -> p |> SharedTypes.pathIdentToString + else Shared.typeToString typ + | Tbool _ -> "bool" + | Tstring _ -> "string" + | TtypeT _ -> "type t" + | Tarray (_, TypeExpr innerTyp) -> + "array<" ^ Shared.typeToString innerTyp ^ ">" + | Tarray (_, ExtractedType innerTyp) -> + "array<" ^ extractedTypeToString ~inner:true innerTyp ^ ">" + | Toption (_, TypeExpr innerTyp) -> + "option<" ^ Shared.typeToString innerTyp ^ ">" + | Tresult {okType; errorType} -> + "result<" ^ Shared.typeToString okType ^ ", " + ^ Shared.typeToString errorType + ^ ">" + | Toption (_, ExtractedType innerTyp) -> + "option<" ^ extractedTypeToString ~inner:true innerTyp ^ ">" + | Tpromise (_, innerTyp) -> "promise<" ^ Shared.typeToString innerTyp ^ ">" + | Tvariant {variantDecl; variantName} -> + if inner then variantName else Shared.declToString variantName variantDecl + | Trecord {definition = `NameOnly name; fields} -> + if inner then name else printRecordFromFields ~name fields + | TinlineRecord {fields} -> printRecordFromFields fields + | Texn _ -> "exn" let getExtractedType maybeRes = match maybeRes with @@ -173,6 +226,23 @@ let rec extractFunctionType ~env ~package typ = in loop ~env [] typ +let maybeSetTypeArgCtx ?typeArgContextFromTypeManifest ~typeParams ~typeArgs env + = + match typeArgContextFromTypeManifest with + | Some typeArgContextFromTypeManifest -> Some typeArgContextFromTypeManifest + | None -> + let typeArgContext = + if List.length typeParams > 0 then Some {env; typeParams; typeArgs} + else None + in + (match typeArgContext with + | None -> () + | Some typeArgContext -> + if Debug.verbose () then + Printf.printf "[#type_arg_ctx]--> setting new type arg ctx: %s" + (debugLogTypeArgContext typeArgContext)); + typeArgContext + let rec extractFunctionType2 ?typeArgContext ~env ~package typ = let rec loop ?typeArgContext ~env acc (t : Types.type_expr) = match t.desc with @@ -188,10 +258,7 @@ let rec extractFunctionType2 ?typeArgContext ~env ~package typ = { item = {decl = {type_manifest = Some t1; type_params = typeParams}}; } ) -> - let typeArgContext = - if List.length typeParams > 0 then Some {env; typeParams; typeArgs} - else None - in + let typeArgContext = maybeSetTypeArgCtx ~typeParams ~typeArgs env in loop ?typeArgContext ~env acc t1 | _ -> (List.rev acc, t, typeArgContext)) | _ -> (List.rev acc, t, typeArgContext) @@ -261,15 +328,12 @@ let rec extractType ~env ~package (t : Types.type_expr) = | _args, _tRet -> None) | _ -> None -let debugLogTypeArgContext {env; typeArgs; typeParams} = - Printf.sprintf "Type arg context. env: %s, typeArgs: %s, typeParams: %s\n" - (Debug.debugPrintEnv env) - (typeArgs |> List.map Shared.typeToString |> String.concat ", ") - (typeParams |> List.map Shared.typeToString |> String.concat ", ") - -let rec extractType2 ?(typeArgContext : typeArgContext option) ~env ~package +let rec extractType2 ?(printOpeningDebug = true) + ?(typeArgContext : typeArgContext option) + ?(typeArgContextFromTypeManifest : typeArgContext option) ~env ~package (t : Types.type_expr) = - if Debug.verbose () then + let maybeSetTypeArgCtx = maybeSetTypeArgCtx ?typeArgContextFromTypeManifest in + if Debug.verbose () && printOpeningDebug then Printf.printf "[extract_type]--> starting extraction of type: %s, in env: %s. Has type \ arg ctx: %b\n" @@ -278,14 +342,14 @@ let rec extractType2 ?(typeArgContext : typeArgContext option) ~env ~package (match typeArgContext with | None -> () | Some typeArgContext -> - if Debug.verbose () then + if Debug.verbose () && printOpeningDebug then Printf.printf "[extract_type]--> %s" (debugLogTypeArgContext typeArgContext)); let extractType = extractType2 in let instantiateType = instantiateType2 in match t.desc with | Tlink t1 | Tsubst t1 | Tpoly (t1, []) -> - extractType ?typeArgContext ~env ~package t1 + extractType ?typeArgContext ~printOpeningDebug:false ~env ~package t1 | Tconstr (Path.Pident {name = "option"}, [payloadTypeExpr], _) -> Some (Toption (env, TypeExpr payloadTypeExpr), typeArgContext) | Tconstr (Path.Pident {name = "promise"}, [payloadTypeExpr], _) -> @@ -324,34 +388,42 @@ let rec extractType2 ?(typeArgContext : typeArgContext option) ~env ~package {item = {decl = {type_manifest = Some t1; type_params}}} ) -> if Debug.verbose () then print_endline "[extract_type]--> found type manifest"; + (* Type manifests inherit the last type args ctx that wasn't for a type manifest *) let typeArgContext = - if List.length type_params > 0 then - Some {env; typeParams = type_params; typeArgs} - else None + maybeSetTypeArgCtx ~typeParams:type_params ~typeArgs env in - t1 |> extractType ?typeArgContext ~env:envFromDeclaration ~package - | Some (env, {name; item = {decl; kind = Type.Variant constructors}}) -> + t1 + |> extractType ?typeArgContextFromTypeManifest:typeArgContext + ?typeArgContext ~env:envFromDeclaration ~package + | Some (envFromItem, {name; item = {decl; kind = Type.Variant constructors}}) + -> if Debug.verbose () then print_endline "[extract_type]--> found variant"; + let typeArgContext = + maybeSetTypeArgCtx ~typeParams:decl.type_params ~typeArgs env + in Some ( Tvariant - {env; constructors; variantName = name.txt; variantDecl = decl}, + { + env = envFromItem; + constructors; + variantName = name.txt; + variantDecl = decl; + }, typeArgContext ) - | Some (env, {item = {kind = Record fields; decl}}) -> + | Some (envFromDeclaration, {item = {kind = Record fields; decl}}) -> if Debug.verbose () then print_endline "[extract_type]--> found record"; (* Need to create a new type arg context here because we're sending along a type expr that might have type vars. *) let typeArgContext = - if List.length typeArgs > 0 then - Some {env; typeParams = decl.type_params; typeArgs} - else None + maybeSetTypeArgCtx ~typeParams:decl.type_params ~typeArgs env in - Some (Trecord {env; fields; definition = `TypeExpr t}, typeArgContext) - | Some (env, {item = {name = "t"; decl = {type_params}}}) -> + Some + ( Trecord {env = envFromDeclaration; fields; definition = `TypeExpr t}, + typeArgContext ) + | Some (envFromDeclaration, {item = {name = "t"; decl = {type_params}}}) -> let typeArgContext = - if List.length typeArgs > 0 then - Some {env; typeParams = type_params; typeArgs} - else None + maybeSetTypeArgCtx ~typeParams:type_params ~typeArgs env in - Some (TtypeT {env; path}, typeArgContext) + Some (TtypeT {env = envFromDeclaration; path}, typeArgContext) | None -> if Debug.verbose () then print_endline "[extract_type]--> found nothing when digging"; @@ -459,16 +531,6 @@ let getBuiltinFromTypePath path = Some Result | _ -> None -let rec pathFromTypeExpr (t : Types.type_expr) = - match t.desc with - | Tconstr (Pident {name = "function$"}, [t; _], _) -> pathFromTypeExpr t - | Tconstr (path, _typeArgs, _) - | Tlink {desc = Tconstr (path, _typeArgs, _)} - | Tsubst {desc = Tconstr (path, _typeArgs, _)} - | Tpoly ({desc = Tconstr (path, _typeArgs, _)}, []) -> - Some path - | _ -> None - let rec digToRelevantTemplateNameType ~env ~package ?(suffix = "") (t : Types.type_expr) = match t.desc with @@ -547,8 +609,6 @@ type ctx = Rfield of string (** A record field of name *) let rec resolveNested ~env ~full ~nested ?ctx (typ : completionType) = match nested with | [] -> - if Debug.verbose () then - print_endline "[nested]--> reached end of pattern, returning type"; Some ( typ, env, @@ -559,13 +619,8 @@ let rec resolveNested ~env ~full ~nested ?ctx (typ : completionType) = | patternPath :: nested -> ( match (patternPath, typ) with | Completable.NTupleItem {itemNum}, Tuple (env, tupleItems, _) -> ( - if Debug.verbose () then - print_endline "[nested]--> trying to move into tuple"; match List.nth_opt tupleItems itemNum with - | None -> - if Debug.verbose () then - print_endline "[nested]--> tuple element not found"; - None + | None -> None | Some typ -> typ |> extractType ~env ~package:full.package @@ -573,25 +628,14 @@ let rec resolveNested ~env ~full ~nested ?ctx (typ : completionType) = typ |> resolveNested ~env ~full ~nested)) | ( NFollowRecordField {fieldName}, (TinlineRecord {env; fields} | Trecord {env; fields}) ) -> ( - if Debug.verbose () then - print_endline "[nested]--> trying to move into record field"; match fields |> List.find_opt (fun (field : field) -> field.fname.txt = fieldName) with - | None -> - if Debug.verbose () then - print_endline "[nested]--> did not find record field"; - None + | None -> None | Some {typ; optional} -> - if Debug.verbose () then - print_endline "[nested]--> found record field type"; let typ = if optional then Utils.unwrapIfOption typ else typ in - if Debug.verbose () then - print_endline - (Printf.sprintf "[nested]--> extracting from type %s in env %s" - (Shared.typeToString typ) (Debug.debugPrintEnv env)); typ |> extractType ~env ~package:full.package |> Utils.Option.flatMap (fun typ -> @@ -612,63 +656,37 @@ let rec resolveNested ~env ~full ~nested ?ctx (typ : completionType) = Some (Completable.RecordField {seenFields}) ) | ( NVariantPayload {constructorName = "Some"; itemNum = 0}, Toption (env, ExtractedType typ) ) -> - if Debug.verbose () then - print_endline "[nested]--> moving into option Some"; typ |> resolveNested ~env ~full ~nested | ( NVariantPayload {constructorName = "Some"; itemNum = 0}, Toption (env, TypeExpr typ) ) -> - if Debug.verbose () then - print_endline "[nested]--> moving into option Some"; typ |> extractType ~env ~package:full.package |> Utils.Option.flatMap (fun t -> t |> resolveNested ~env ~full ~nested) | NVariantPayload {constructorName = "Ok"; itemNum = 0}, Tresult {okType} -> - if Debug.verbose () then print_endline "[nested]--> moving into result Ok"; okType |> extractType ~env ~package:full.package |> Utils.Option.flatMap (fun t -> t |> resolveNested ~env ~full ~nested) | ( NVariantPayload {constructorName = "Error"; itemNum = 0}, Tresult {errorType} ) -> - if Debug.verbose () then - print_endline "[nested]--> moving into result Error"; errorType |> extractType ~env ~package:full.package |> Utils.Option.flatMap (fun t -> t |> resolveNested ~env ~full ~nested) | NVariantPayload {constructorName; itemNum}, Tvariant {env; constructors} -> ( - if Debug.verbose () then - Printf.printf - "[nested]--> trying to move into variant payload $%i of constructor \ - '%s'\n" - itemNum constructorName; match constructors |> List.find_opt (fun (c : Constructor.t) -> c.cname.txt = constructorName) with | Some {args = Args args} -> ( - if Debug.verbose () then - print_endline "[nested]--> found constructor (Args type)"; match List.nth_opt args itemNum with - | None -> - if Debug.verbose () then - print_endline "[nested]--> did not find relevant args num"; - None + | None -> None | Some (typ, _) -> - if Debug.verbose () then - Printf.printf "[nested]--> found arg of type: %s\n" - (Shared.typeToString typ); - typ |> extractType ~env ~package:full.package |> Utils.Option.flatMap (fun typ -> - if Debug.verbose () then - print_endline - "[nested]--> extracted type, continuing descent"; typ |> resolveNested ~env ~full ~nested)) | Some {args = InlineRecord fields} when itemNum = 0 -> - if Debug.verbose () then - print_endline "[nested]--> found constructor (inline record)"; TinlineRecord {env; fields} |> resolveNested ~env ~full ~nested | _ -> None) | ( NPolyvariantPayload {constructorName; itemNum}, @@ -717,10 +735,11 @@ let rec resolveNested2 ?typeArgContext ~env ~full ~nested ?ctx Some ( typ, env, - match ctx with + (match ctx with | None -> None | Some (Rfield fieldName) -> - Some (Completable.CameFromRecordField fieldName) ) + Some (Completable.CameFromRecordField fieldName)), + typeArgContext ) | patternPath :: nested -> ( match (patternPath, typ) with | Completable.NTupleItem {itemNum}, Tuple (env, tupleItems, _) -> ( @@ -766,16 +785,24 @@ let rec resolveNested2 ?typeArgContext ~env ~full ~nested ?ctx -> typeExpr |> extractType ~env ~package:full.package - |> Option.map (fun (typ, _typeArgContext) -> - (typ, env, Some (Completable.RecordField {seenFields}))) + |> Option.map (fun (typ, typeArgContext) -> + ( typ, + env, + Some (Completable.RecordField {seenFields}), + typeArgContext )) | ( NRecordBody {seenFields}, (Trecord {env; definition = `NameOnly _} as extractedType) ) -> - Some (extractedType, env, Some (Completable.RecordField {seenFields})) + Some + ( extractedType, + env, + Some (Completable.RecordField {seenFields}), + typeArgContext ) | NRecordBody {seenFields}, TinlineRecord {env; fields} -> Some ( TinlineRecord {fields; env}, env, - Some (Completable.RecordField {seenFields}) ) + Some (Completable.RecordField {seenFields}), + typeArgContext ) | ( NVariantPayload {constructorName = "Some"; itemNum = 0}, Toption (env, ExtractedType typ) ) -> if Debug.verbose () then @@ -832,8 +859,10 @@ let rec resolveNested2 ?typeArgContext ~env ~full ~nested ?ctx |> extractType ~env ~package:full.package |> Utils.Option.flatMap (fun (typ, typeArgContext) -> if Debug.verbose () then - print_endline - "[nested]--> extracted type, continuing descent"; + Printf.printf + "[nested]--> extracted %s, continuing descent of %i items\n" + (extractedTypeToString typ) + (List.length nested); typ |> resolveNested ?typeArgContext ~env ~full ~nested)) | Some {args = InlineRecord fields} when itemNum = 0 -> if Debug.verbose () then @@ -1057,49 +1086,6 @@ let rec contextPathFromCoreType (coreType : Parsetree.core_type) = Some (CPId (lid.txt |> Utils.flattenLongIdent, Type)) | _ -> None -let printRecordFromFields ?name (fields : field list) = - (match name with - | None -> "" - | Some name -> "type " ^ name ^ " = ") - ^ "{" - ^ (fields - |> List.map (fun f -> f.fname.txt ^ ": " ^ Shared.typeToString f.typ) - |> String.concat ", ") - ^ "}" - -let rec extractedTypeToString ?(inner = false) = function - | Tuple (_, _, typ) - | Tpolyvariant {typeExpr = typ} - | Tfunction {typ} - | Trecord {definition = `TypeExpr typ} -> - if inner then - match pathFromTypeExpr typ with - | None -> "record" (* Won't happen *) - | Some p -> p |> SharedTypes.pathIdentToString - else Shared.typeToString typ - | Tbool _ -> "bool" - | Tstring _ -> "string" - | TtypeT _ -> "type t" - | Tarray (_, TypeExpr innerTyp) -> - "array<" ^ Shared.typeToString innerTyp ^ ">" - | Tarray (_, ExtractedType innerTyp) -> - "array<" ^ extractedTypeToString ~inner:true innerTyp ^ ">" - | Toption (_, TypeExpr innerTyp) -> - "option<" ^ Shared.typeToString innerTyp ^ ">" - | Tresult {okType; errorType} -> - "result<" ^ Shared.typeToString okType ^ ", " - ^ Shared.typeToString errorType - ^ ">" - | Toption (_, ExtractedType innerTyp) -> - "option<" ^ extractedTypeToString ~inner:true innerTyp ^ ">" - | Tpromise (_, innerTyp) -> "promise<" ^ Shared.typeToString innerTyp ^ ">" - | Tvariant {variantDecl; variantName} -> - if inner then variantName else Shared.declToString variantName variantDecl - | Trecord {definition = `NameOnly name; fields} -> - if inner then name else printRecordFromFields ~name fields - | TinlineRecord {fields} -> printRecordFromFields fields - | Texn _ -> "exn" - let unwrapCompletionTypeIfOption (t : SharedTypes.completionType) = match t with | Toption (_, ExtractedType unwrapped) -> unwrapped diff --git a/analysis/tests/src/expected/EnvCompletion.res.txt b/analysis/tests/src/expected/EnvCompletion.res.txt index da9e85f69..f512374c2 100644 --- a/analysis/tests/src/expected/EnvCompletion.res.txt +++ b/analysis/tests/src/expected/EnvCompletion.res.txt @@ -33,12 +33,23 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[res] Path res -Completable: Cpath Value[()] -Package opens Pervasives.JsxModules.place holder -Resolved opens 1 pervasives -ContextPath Value[()] -Path () -[] +[{ + "label": "One", + "kind": 4, + "tags": [], + "detail": "One\n\ntype things = One | Two", + "documentation": null, + "insertText": "One", + "insertTextFormat": 2 + }, { + "label": "Two", + "kind": 4, + "tags": [], + "detail": "Two\n\ntype things = One | Two", + "documentation": null, + "insertText": "Two", + "insertTextFormat": 2 + }] Complete src/EnvCompletion.res 16:26 posCursor:[16:26] posNoWhite:[16:25] Found pattern:[16:18->16:27] @@ -50,12 +61,16 @@ Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives ContextPath Value[res] Path res -Completable: Cpath Value[()] -Package opens Pervasives.JsxModules.place holder -Resolved opens 1 pervasives -ContextPath Value[()] -Path () -[] +[{ + "label": "\"\"", + "kind": 12, + "tags": [], + "detail": "string", + "documentation": null, + "sortText": "A", + "insertText": "\"$0\"", + "insertTextFormat": 2 + }] Complete src/EnvCompletion.res 19:19 XXX Not found! @@ -204,12 +219,23 @@ Resolved opens 1 pervasives ContextPath Value[use](Nolabel) ContextPath Value[use] Path use -Completable: Cpath Value[()] -Package opens Pervasives.JsxModules.place holder -Resolved opens 1 pervasives -ContextPath Value[()] -Path () -[] +[{ + "label": "First", + "kind": 4, + "tags": [], + "detail": "First\n\ntype theVariant = First | Second(r1)", + "documentation": null, + "insertText": "First", + "insertTextFormat": 2 + }, { + "label": "Second(_)", + "kind": 4, + "tags": [], + "detail": "Second(r1)\n\ntype theVariant = First | Second(r1)", + "documentation": null, + "insertText": "Second(${1:_})", + "insertTextFormat": 2 + }] Complete src/EnvCompletion.res 40:38 posCursor:[40:38] posNoWhite:[40:37] Found pattern:[40:20->40:42] @@ -225,12 +251,16 @@ Resolved opens 1 pervasives ContextPath Value[use](Nolabel) ContextPath Value[use] Path use -Completable: Cpath Value[()] -Package opens Pervasives.JsxModules.place holder -Resolved opens 1 pervasives -ContextPath Value[()] -Path () -[] +[{ + "label": "{}", + "kind": 22, + "tags": [], + "detail": "r1", + "documentation": null, + "sortText": "A", + "insertText": "{$0}", + "insertTextFormat": 2 + }] Complete src/EnvCompletion.res 43:39 posCursor:[43:39] posNoWhite:[43:38] Found pattern:[43:20->43:44] @@ -245,12 +275,13 @@ Resolved opens 1 pervasives ContextPath Value[use](Nolabel) ContextPath Value[use] Path use -Completable: Cpath Value[Second] -Package opens Pervasives.JsxModules.place holder -Resolved opens 1 pervasives -ContextPath Value[Second] -Path Second -[] +[{ + "label": "age", + "kind": 5, + "tags": [], + "detail": "age: int\n\nr1", + "documentation": null + }] Complete src/EnvCompletion.res 52:18 XXX Not found! @@ -305,13 +336,20 @@ Resolved opens 1 pervasives ContextPath Value[res2] Path res2 [{ - "label": "{}", - "kind": 22, + "label": "Four", + "kind": 4, "tags": [], - "detail": "things2", + "detail": "Four\n\ntype things2 = Four | Five", "documentation": null, - "sortText": "A", - "insertText": "{$0}", + "insertText": "Four", + "insertTextFormat": 2 + }, { + "label": "Five", + "kind": 4, + "tags": [], + "detail": "Five\n\ntype things2 = Four | Five", + "documentation": null, + "insertText": "Five", "insertTextFormat": 2 }] From ca8af6f3fdb0c65d663174cb12bdaa928d63850b Mon Sep 17 00:00:00 2001 From: Gabriel Nordeborn Date: Wed, 10 Jan 2024 14:37:26 +0100 Subject: [PATCH 13/17] better --- analysis/src/TypeUtils.ml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/analysis/src/TypeUtils.ml b/analysis/src/TypeUtils.ml index e259fa0dd..0c1c5c2e4 100644 --- a/analysis/src/TypeUtils.ml +++ b/analysis/src/TypeUtils.ml @@ -388,13 +388,16 @@ let rec extractType2 ?(printOpeningDebug = true) {item = {decl = {type_manifest = Some t1; type_params}}} ) -> if Debug.verbose () then print_endline "[extract_type]--> found type manifest"; - (* Type manifests inherit the last type args ctx that wasn't for a type manifest *) + + (* Type manifests inherit the last type args ctx that wasn't for a type manifest. + This is because the manifest itself doesn't have type args and an env that can + be used to instantiate. *) let typeArgContext = maybeSetTypeArgCtx ~typeParams:type_params ~typeArgs env in t1 |> extractType ?typeArgContextFromTypeManifest:typeArgContext - ?typeArgContext ~env:envFromDeclaration ~package + ~env:envFromDeclaration ~package | Some (envFromItem, {name; item = {decl; kind = Type.Variant constructors}}) -> if Debug.verbose () then print_endline "[extract_type]--> found variant"; From f800d30600836154faf13eda3cd677a6effc83ce Mon Sep 17 00:00:00 2001 From: Gabriel Nordeborn Date: Wed, 10 Jan 2024 14:52:05 +0100 Subject: [PATCH 14/17] remove old resolveNested entirely --- analysis/src/CompletionBackEnd.ml | 5 +- analysis/src/TypeUtils.ml | 113 +----------------------------- 2 files changed, 4 insertions(+), 114 deletions(-) diff --git a/analysis/src/CompletionBackEnd.ml b/analysis/src/CompletionBackEnd.ml index c9a5f2eb5..a2ca8ec38 100644 --- a/analysis/src/CompletionBackEnd.ml +++ b/analysis/src/CompletionBackEnd.ml @@ -1849,8 +1849,7 @@ let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover completable = typ |> TypeUtils.extractType2 ~env ~package:full.package |> Utils.Option.flatMap (fun (typ, typeArgContext) -> - typ - |> TypeUtils.resolveNested2 ?typeArgContext ~env ~full ~nested) + typ |> TypeUtils.resolveNested ?typeArgContext ~env ~full ~nested) with | None -> fallbackOrEmpty () | Some (typ, _env, completionContext, typeArgContext) -> @@ -1883,7 +1882,7 @@ let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover completable = print_endline "--> could not get completions for context path"; regularCompletions | Some (typ, env) -> ( - match typ |> TypeUtils.resolveNested2 ~env ~full ~nested with + match typ |> TypeUtils.resolveNested ~env ~full ~nested with | None -> if Debug.verbose () then print_endline "--> could not resolve nested expression path"; diff --git a/analysis/src/TypeUtils.ml b/analysis/src/TypeUtils.ml index 0c1c5c2e4..c908e39e2 100644 --- a/analysis/src/TypeUtils.ml +++ b/analysis/src/TypeUtils.ml @@ -243,6 +243,7 @@ let maybeSetTypeArgCtx ?typeArgContextFromTypeManifest ~typeParams ~typeArgs env (debugLogTypeArgContext typeArgContext)); typeArgContext +(* TODO(env-stuff) Maybe this could be removed entirely if we can guarantee that we don't have to look up functions from in here. *) let rec extractFunctionType2 ?typeArgContext ~env ~package typ = let rec loop ?typeArgContext ~env acc (t : Types.type_expr) = match t.desc with @@ -608,119 +609,9 @@ let extractTypeFromResolvedType (typ : Type.t) ~env ~full = (** The context we just came from as we resolve the nested structure. *) type ctx = Rfield of string (** A record field of name *) -(** This moves through a nested path via a set of instructions, trying to resolve the type at the end of the path. *) -let rec resolveNested ~env ~full ~nested ?ctx (typ : completionType) = - match nested with - | [] -> - Some - ( typ, - env, - match ctx with - | None -> None - | Some (Rfield fieldName) -> - Some (Completable.CameFromRecordField fieldName) ) - | patternPath :: nested -> ( - match (patternPath, typ) with - | Completable.NTupleItem {itemNum}, Tuple (env, tupleItems, _) -> ( - match List.nth_opt tupleItems itemNum with - | None -> None - | Some typ -> - typ - |> extractType ~env ~package:full.package - |> Utils.Option.flatMap (fun typ -> - typ |> resolveNested ~env ~full ~nested)) - | ( NFollowRecordField {fieldName}, - (TinlineRecord {env; fields} | Trecord {env; fields}) ) -> ( - match - fields - |> List.find_opt (fun (field : field) -> field.fname.txt = fieldName) - with - | None -> None - | Some {typ; optional} -> - let typ = if optional then Utils.unwrapIfOption typ else typ in - - typ - |> extractType ~env ~package:full.package - |> Utils.Option.flatMap (fun typ -> - typ |> resolveNested ~ctx:(Rfield fieldName) ~env ~full ~nested)) - | NRecordBody {seenFields}, Trecord {env; definition = `TypeExpr typeExpr} - -> - typeExpr - |> extractType ~env ~package:full.package - |> Option.map (fun typ -> - (typ, env, Some (Completable.RecordField {seenFields}))) - | ( NRecordBody {seenFields}, - (Trecord {env; definition = `NameOnly _} as extractedType) ) -> - Some (extractedType, env, Some (Completable.RecordField {seenFields})) - | NRecordBody {seenFields}, TinlineRecord {env; fields} -> - Some - ( TinlineRecord {fields; env}, - env, - Some (Completable.RecordField {seenFields}) ) - | ( NVariantPayload {constructorName = "Some"; itemNum = 0}, - Toption (env, ExtractedType typ) ) -> - typ |> resolveNested ~env ~full ~nested - | ( NVariantPayload {constructorName = "Some"; itemNum = 0}, - Toption (env, TypeExpr typ) ) -> - typ - |> extractType ~env ~package:full.package - |> Utils.Option.flatMap (fun t -> t |> resolveNested ~env ~full ~nested) - | NVariantPayload {constructorName = "Ok"; itemNum = 0}, Tresult {okType} -> - okType - |> extractType ~env ~package:full.package - |> Utils.Option.flatMap (fun t -> t |> resolveNested ~env ~full ~nested) - | ( NVariantPayload {constructorName = "Error"; itemNum = 0}, - Tresult {errorType} ) -> - errorType - |> extractType ~env ~package:full.package - |> Utils.Option.flatMap (fun t -> t |> resolveNested ~env ~full ~nested) - | NVariantPayload {constructorName; itemNum}, Tvariant {env; constructors} - -> ( - match - constructors - |> List.find_opt (fun (c : Constructor.t) -> - c.cname.txt = constructorName) - with - | Some {args = Args args} -> ( - match List.nth_opt args itemNum with - | None -> None - | Some (typ, _) -> - typ - |> extractType ~env ~package:full.package - |> Utils.Option.flatMap (fun typ -> - typ |> resolveNested ~env ~full ~nested)) - | Some {args = InlineRecord fields} when itemNum = 0 -> - TinlineRecord {env; fields} |> resolveNested ~env ~full ~nested - | _ -> None) - | ( NPolyvariantPayload {constructorName; itemNum}, - Tpolyvariant {env; constructors} ) -> ( - match - constructors - |> List.find_opt (fun (c : polyVariantConstructor) -> - c.name = constructorName) - with - | None -> None - | Some constructor -> ( - match List.nth_opt constructor.args itemNum with - | None -> None - | Some typ -> - typ - |> extractType ~env ~package:full.package - |> Utils.Option.flatMap (fun typ -> - typ |> resolveNested ~env ~full ~nested))) - | NArray, Tarray (env, ExtractedType typ) -> - typ |> resolveNested ~env ~full ~nested - | NArray, Tarray (env, TypeExpr typ) -> - typ - |> extractType ~env ~package:full.package - |> Utils.Option.flatMap (fun typ -> - typ |> resolveNested ~env ~full ~nested) - | _ -> None) - -let rec resolveNested2 ?typeArgContext ~env ~full ~nested ?ctx +let rec resolveNested ?typeArgContext ~env ~full ~nested ?ctx (typ : completionType) = let extractType = extractType2 ?typeArgContext in - let resolveNested = resolveNested2 in if Debug.verbose () then Printf.printf "[nested]--> running nested in env: %s. Has type arg ctx: %b\n" From 93c17d2dd4ea876cc83a0ed6a1ad511f9c23a659 Mon Sep 17 00:00:00 2001 From: Gabriel Nordeborn Date: Wed, 10 Jan 2024 14:58:57 +0100 Subject: [PATCH 15/17] cleanup --- analysis/src/CompletionBackEnd.ml | 14 +++--- analysis/src/TypeUtils.ml | 84 +++++-------------------------- analysis/src/Xform.ml | 2 +- 3 files changed, 21 insertions(+), 79 deletions(-) diff --git a/analysis/src/CompletionBackEnd.ml b/analysis/src/CompletionBackEnd.ml index a2ca8ec38..975fef31a 100644 --- a/analysis/src/CompletionBackEnd.ml +++ b/analysis/src/CompletionBackEnd.ml @@ -637,7 +637,7 @@ let completionsGetCompletionType ~full = function | {Completion.kind = ObjLabel typ; env} :: _ | {Completion.kind = Field ({typ}, _); env} :: _ -> typ - |> TypeUtils.extractType2 ~env ~package:full.package + |> TypeUtils.extractType ~env ~package:full.package |> Option.map (fun (typ, _) -> (typ, env)) | {Completion.kind = Type typ; env} :: _ -> ( match TypeUtils.extractTypeFromResolvedType typ ~env ~full with @@ -1322,7 +1322,7 @@ let rec completeTypedValue ?(typeArgContext : typeArgContext option) ~rawOpens let innerType = match t with | ExtractedType t -> Some (t, None) - | TypeExpr t -> t |> TypeUtils.extractType2 ~env ~package:full.package + | TypeExpr t -> t |> TypeUtils.extractType ~env ~package:full.package in let expandedCompletions = match innerType with @@ -1365,10 +1365,10 @@ let rec completeTypedValue ?(typeArgContext : typeArgContext option) ~rawOpens | Tresult {env; okType; errorType} -> if Debug.verbose () then print_endline "[complete_typed_value]--> Tresult"; let okInnerType = - okType |> TypeUtils.extractType2 ~env ~package:full.package + okType |> TypeUtils.extractType ~env ~package:full.package in let errorInnerType = - errorType |> TypeUtils.extractType2 ~env ~package:full.package + errorType |> TypeUtils.extractType ~env ~package:full.package in let expandedOkCompletions = match okInnerType with @@ -1574,7 +1574,7 @@ let rec completeTypedValue ?(typeArgContext : typeArgContext option) ~rawOpens "(" ^ if shouldPrintAsUncurried then ". " else "" ^ argsText ^ ")" in let isAsync = - match TypeUtils.extractType2 ~env ~package:full.package returnType with + match TypeUtils.extractType ~env ~package:full.package returnType with | Some (Tpromise _, _) -> true | _ -> false in @@ -1847,7 +1847,7 @@ let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover completable = | Some (typ, env) -> ( match typ - |> TypeUtils.extractType2 ~env ~package:full.package + |> TypeUtils.extractType ~env ~package:full.package |> Utils.Option.flatMap (fun (typ, typeArgContext) -> typ |> TypeUtils.resolveNested ?typeArgContext ~env ~full ~nested) with @@ -1968,7 +1968,7 @@ let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover completable = |> List.map (fun (c : Completion.t) -> match c.kind with | Value typExpr -> ( - match typExpr |> TypeUtils.extractType2 ~env:c.env ~package with + match typExpr |> TypeUtils.extractType ~env:c.env ~package with | Some (Tvariant v, _) -> withExhaustiveItem c ~cases: diff --git a/analysis/src/TypeUtils.ml b/analysis/src/TypeUtils.ml index c908e39e2..534ec7391 100644 --- a/analysis/src/TypeUtils.ml +++ b/analysis/src/TypeUtils.ml @@ -266,70 +266,7 @@ let rec extractFunctionType2 ?typeArgContext ~env ~package typ = in loop ?typeArgContext ~env [] typ -(** Pulls out a type we can complete from a type expr. *) -let rec extractType ~env ~package (t : Types.type_expr) = - match t.desc with - | Tlink t1 | Tsubst t1 | Tpoly (t1, []) -> extractType ~env ~package t1 - | Tconstr (Path.Pident {name = "option"}, [payloadTypeExpr], _) -> - Some (Toption (env, TypeExpr payloadTypeExpr)) - | Tconstr (Path.Pident {name = "promise"}, [payloadTypeExpr], _) -> - Some (Tpromise (env, payloadTypeExpr)) - | Tconstr (Path.Pident {name = "array"}, [payloadTypeExpr], _) -> - Some (Tarray (env, TypeExpr payloadTypeExpr)) - | Tconstr (Path.Pident {name = "result"}, [okType; errorType], _) -> - Some (Tresult {env; okType; errorType}) - | Tconstr (Path.Pident {name = "bool"}, [], _) -> Some (Tbool env) - | Tconstr (Path.Pident {name = "string"}, [], _) -> Some (Tstring env) - | Tconstr (Path.Pident {name = "exn"}, [], _) -> Some (Texn env) - | Tconstr (Pident {name = "function$"}, [t; _], _) -> ( - (* Uncurried functions. *) - match extractFunctionType t ~env ~package with - | args, tRet when args <> [] -> - Some (Tfunction {env; args; typ = t; uncurried = true; returnType = tRet}) - | _args, _tRet -> None) - | Tconstr (path, typeArgs, _) -> ( - match References.digConstructor ~env ~package path with - | Some (env, {item = {decl = {type_manifest = Some t1; type_params}}}) -> - t1 - |> instantiateType ~typeParams:type_params ~typeArgs - |> extractType ~env ~package - | Some (env, {name; item = {decl; kind = Type.Variant constructors}}) -> - Some - (Tvariant - {env; constructors; variantName = name.txt; variantDecl = decl}) - | Some (env, {item = {kind = Record fields}}) -> - Some (Trecord {env; fields; definition = `TypeExpr t}) - | Some (env, {item = {name = "t"}}) -> Some (TtypeT {env; path}) - | None -> None - | _ -> None) - | Ttuple expressions -> Some (Tuple (env, expressions, t)) - | Tvariant {row_fields} -> - let constructors = - row_fields - |> List.map (fun (label, field) -> - { - name = label; - displayName = Utils.printMaybeExoticIdent ~allowUident:true label; - args = - (* Multiple arguments are represented as a Ttuple, while a single argument is just the type expression itself. *) - (match field with - | Types.Rpresent (Some typeExpr) -> ( - match typeExpr.desc with - | Ttuple args -> args - | _ -> [typeExpr]) - | _ -> []); - }) - in - Some (Tpolyvariant {env; constructors; typeExpr = t}) - | Tarrow _ -> ( - match extractFunctionType t ~env ~package with - | args, tRet when args <> [] -> - Some - (Tfunction {env; args; typ = t; uncurried = false; returnType = tRet}) - | _args, _tRet -> None) - | _ -> None - -let rec extractType2 ?(printOpeningDebug = true) +let rec extractType ?(printOpeningDebug = true) ?(typeArgContext : typeArgContext option) ?(typeArgContextFromTypeManifest : typeArgContext option) ~env ~package (t : Types.type_expr) = @@ -346,7 +283,6 @@ let rec extractType2 ?(printOpeningDebug = true) if Debug.verbose () && printOpeningDebug then Printf.printf "[extract_type]--> %s" (debugLogTypeArgContext typeArgContext)); - let extractType = extractType2 in let instantiateType = instantiateType2 in match t.desc with | Tlink t1 | Tsubst t1 | Tpoly (t1, []) -> @@ -604,14 +540,14 @@ let extractTypeFromResolvedType (typ : Type.t) ~env ~full = | Abstract _ | Open -> ( match typ.decl.type_manifest with | None -> None - | Some t -> t |> extractType ~env ~package:full.package) + | Some t -> t |> extractType ~env ~package:full.package |> getExtractedType) (** The context we just came from as we resolve the nested structure. *) type ctx = Rfield of string (** A record field of name *) let rec resolveNested ?typeArgContext ~env ~full ~nested ?ctx (typ : completionType) = - let extractType = extractType2 ?typeArgContext in + let extractType = extractType ?typeArgContext in if Debug.verbose () then Printf.printf "[nested]--> running nested in env: %s. Has type arg ctx: %b\n" @@ -826,7 +762,8 @@ let rec resolveNestedPatternPath (typ : innerType) ~env ~full ~nested = if Debug.verbose () then print_endline "[nested_pattern_path]"; let t = match typ with - | TypeExpr t -> t |> extractType ~env ~package:full.package + | TypeExpr t -> + t |> extractType ~env ~package:full.package |> getExtractedType | ExtractedType t -> Some t in match nested with @@ -884,6 +821,7 @@ let rec resolveNestedPatternPath (typ : innerType) ~env ~full ~nested = | Some typ -> typ |> extractType ~env ~package:full.package + |> getExtractedType |> Utils.Option.flatMap (fun typ -> ExtractedType typ |> resolveNestedPatternPath ~env ~full ~nested)) @@ -893,6 +831,7 @@ let rec resolveNestedPatternPath (typ : innerType) ~env ~full ~nested = | Some typ -> typ |> extractType ~env ~package:full.package + |> getExtractedType |> Utils.Option.flatMap (fun typ -> ExtractedType typ |> resolveNestedPatternPath ~env ~full ~nested)) @@ -1026,7 +965,8 @@ module Codegen = struct let extractedType = match innerType with | ExtractedType t -> Some t - | TypeExpr t -> extractType t ~env ~package:full.package + | TypeExpr t -> + extractType t ~env ~package:full.package |> getExtractedType in let expandedBranches = match extractedType with @@ -1045,9 +985,11 @@ module Codegen = struct |> List.map (fun (pat : Parsetree.pattern) -> mkConstructPat ~payload:pat "Some"))) | Tresult {okType; errorType} -> - let extractedOkType = okType |> extractType ~env ~package:full.package in + let extractedOkType = + okType |> extractType ~env ~package:full.package |> getExtractedType + in let extractedErrorType = - errorType |> extractType ~env ~package:full.package + errorType |> extractType ~env ~package:full.package |> getExtractedType in let expandedOkBranches = match extractedOkType with diff --git a/analysis/src/Xform.ml b/analysis/src/Xform.ml index fdb004584..3a27a60b5 100644 --- a/analysis/src/Xform.ml +++ b/analysis/src/Xform.ml @@ -298,7 +298,7 @@ module ExhaustiveSwitch = struct match typ with | ExtractedType t -> Some t | TypeExpr t -> - TypeUtils.extractType2 t ~env ~package:full.package + TypeUtils.extractType t ~env ~package:full.package |> TypeUtils.getExtractedType in extractedType From 593e543444f8d9df93593c1a84dc1d52e0f63fa6 Mon Sep 17 00:00:00 2001 From: Gabriel Nordeborn Date: Wed, 10 Jan 2024 15:00:29 +0100 Subject: [PATCH 16/17] changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index dbbe7e6c1..787ee1883 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,8 @@ - Complete for maker-style functions (functions returning type `t` of a module) when encountering a `type t` in relevant scenarios. https://github.com/rescript-lang/rescript-vscode/pull/884 - Expand type aliases in hovers. https://github.com/rescript-lang/rescript-vscode/pull/881 +- Many bugfixes around nested pattern and expression completion. https://github.com/rescript-lang/rescript-vscode/pull/892 + #### :nail_care: Polish - Better error recovery when analysis fails. https://github.com/rescript-lang/rescript-vscode/pull/880 From 4c4c5316c133426f2eb0cf93058d10f8380adc37 Mon Sep 17 00:00:00 2001 From: Gabriel Nordeborn Date: Wed, 10 Jan 2024 15:00:47 +0100 Subject: [PATCH 17/17] changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 787ee1883..f543ec136 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,8 @@ - Complete for maker-style functions (functions returning type `t` of a module) when encountering a `type t` in relevant scenarios. https://github.com/rescript-lang/rescript-vscode/pull/884 - Expand type aliases in hovers. https://github.com/rescript-lang/rescript-vscode/pull/881 +#### :bug: Bug Fix + - Many bugfixes around nested pattern and expression completion. https://github.com/rescript-lang/rescript-vscode/pull/892 #### :nail_care: Polish