Skip to content

Make uncurried mode opt-out. #6249

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

Merged
merged 2 commits into from
May 9, 2023
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@

# 11.0.0-beta.1 (Unreleased)

#### :rocket: Main New Feature
- Make uncurried mode opt-out: by default, every project is now in uncurried mode, unless `"uncurried": false` is specified in the project config. https://github.com/rescript-lang/rescript-compiler/pull/6249

# 11.0.0-alpha.6

#### :boom: Breaking Change
Expand Down
2 changes: 1 addition & 1 deletion jscomp/bsb/bsb_config_parse.ml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ let extract_gentype_config (map : json_map) : Bsb_config_types.gentype_config =

let extract_uncurried (map : json_map) : bool =
match map.?(Bsb_build_schemas.uncurried) with
| None -> false
| None -> true
| Some (True _) -> true
| Some (False _) -> false
| Some config ->
Expand Down
13 changes: 6 additions & 7 deletions jscomp/build_tests/react_ppx/src/gpr_3987_test.bs.js

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

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

13 changes: 7 additions & 6 deletions jscomp/syntax/src/res_multi_printer.ml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
let defaultPrintWidth = 100

(* Determine if the file is in uncurried mode by looking for
the fist ancestor .bsconfig and see if it contains "uncurried": true *)
the fist ancestor .bsconfig and see if it contains "uncurried": false *)
let getUncurriedFromBsconfig ~filename =
let rec findBsconfig ~dir =
let bsconfig = Filename.concat dir "bsconfig.json" in
Expand Down Expand Up @@ -42,18 +42,19 @@ let getUncurriedFromBsconfig ~filename =
lines
|> List.exists (fun line ->
let uncurried = ref false in
let true_ = ref false in
let false_ = ref false in
let words = line |> String.split_on_char ' ' in
words
|> List.iter (fun word ->
match word with
| "\"uncurried\"" | "\"uncurried\":" -> uncurried := true
| "\"uncurried\":true" | "\"uncurried\":true," ->
| "\"uncurried\":false" | "\"uncurried\":false," ->
uncurried := true;
true_ := true
| "true" | ":true" | "true," | ":true," -> true_ := true
false_ := true
| "false" | ":false" | "false," | ":false," ->
false_ := true
| _ -> ());
!uncurried && !true_)
not (!uncurried && !false_))
in
if uncurried then Config.uncurried := Uncurried

Expand Down