Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use uncurried mode setting for outcome printer #769

Merged
merged 3 commits into from
Apr 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion analysis/src/Cmt.ml
Original file line number Diff line number Diff line change
@@ -33,4 +33,10 @@ let fullsFromModule ~package ~moduleName =

let loadFullCmtFromPath ~path =
let uri = Uri.fromPath path in
fullFromUri ~uri
let full = fullFromUri ~uri in
match full with
| None -> None
| Some full ->
(* Turn on uncurried for the outcome printer *)
if full.package.uncurried then Config.uncurried := Uncurried;
Some full
6 changes: 6 additions & 0 deletions analysis/src/Packages.ml
Original file line number Diff line number Diff line change
@@ -29,6 +29,11 @@ let newBsPackage ~rootPath =
| Some libBs ->
Some
(let namespace = FindFiles.getNamespace config in
let uncurried =
let ns = config |> Json.get "uncurried" in
Option.bind ns Json.bool
in
let uncurried = uncurried = Some true in
let sourceDirectories =
FindFiles.getSourceDirectories ~includeDev:true ~baseDir:rootPath
config
@@ -144,6 +149,7 @@ let newBsPackage ~rootPath =
resultModulePath = ["Belt"; "Result"];
exnModulePath = ["Js"; "Exn"];
});
uncurried;
})))
| None -> None)

1 change: 1 addition & 0 deletions analysis/src/SharedTypes.ml
Original file line number Diff line number Diff line change
@@ -471,6 +471,7 @@ type package = {
namespace: string option;
builtInCompletionModules: builtInCompletionModules;
opens: path list;
uncurried: bool;
}

let allFilesInPackage package =
41 changes: 29 additions & 12 deletions analysis/tests/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions analysis/vendor/res_syntax/res_outcome_printer.ml
Original file line number Diff line number Diff line change
@@ -319,6 +319,9 @@ let rec printOutTypeDoc (outType : Outcometree.out_type) =
]

and printOutArrowType ~uncurried typ =
let uncurried =
if !Config.uncurried <> Legacy then not uncurried else uncurried
in
let typArgs, typ = collectArrowArgs typ [] in
let args =
Doc.join