Skip to content

Commit a43eb3b

Browse files
authored
Use uncurried mode setting for outcome printer (#769)
1 parent 7fdcee7 commit a43eb3b

File tree

5 files changed

+46
-13
lines changed

5 files changed

+46
-13
lines changed

analysis/src/Cmt.ml

+7-1
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,10 @@ let fullsFromModule ~package ~moduleName =
3333

3434
let loadFullCmtFromPath ~path =
3535
let uri = Uri.fromPath path in
36-
fullFromUri ~uri
36+
let full = fullFromUri ~uri in
37+
match full with
38+
| None -> None
39+
| Some full ->
40+
(* Turn on uncurried for the outcome printer *)
41+
if full.package.uncurried then Config.uncurried := Uncurried;
42+
Some full

analysis/src/Packages.ml

+6
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ let newBsPackage ~rootPath =
2929
| Some libBs ->
3030
Some
3131
(let namespace = FindFiles.getNamespace config in
32+
let uncurried =
33+
let ns = config |> Json.get "uncurried" in
34+
Option.bind ns Json.bool
35+
in
36+
let uncurried = uncurried = Some true in
3237
let sourceDirectories =
3338
FindFiles.getSourceDirectories ~includeDev:true ~baseDir:rootPath
3439
config
@@ -144,6 +149,7 @@ let newBsPackage ~rootPath =
144149
resultModulePath = ["Belt"; "Result"];
145150
exnModulePath = ["Js"; "Exn"];
146151
});
152+
uncurried;
147153
})))
148154
| None -> None)
149155

analysis/src/SharedTypes.ml

+1
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,7 @@ type package = {
471471
namespace: string option;
472472
builtInCompletionModules: builtInCompletionModules;
473473
opens: path list;
474+
uncurried: bool;
474475
}
475476

476477
let allFilesInPackage package =

analysis/tests/package-lock.json

+29-12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

analysis/vendor/res_syntax/res_outcome_printer.ml

+3
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,9 @@ let rec printOutTypeDoc (outType : Outcometree.out_type) =
319319
]
320320

321321
and printOutArrowType ~uncurried typ =
322+
let uncurried =
323+
if !Config.uncurried <> Legacy then not uncurried else uncurried
324+
in
322325
let typArgs, typ = collectArrowArgs typ [] in
323326
let args =
324327
Doc.join

0 commit comments

Comments
 (0)