Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#### :bug: Bug Fix

- Fix issue with JSX V4 when component props have the default value with same name. https://github.com/rescript-lang/rescript-compiler/pull/6377
- Fixed printer with `"uncurried": false` in bsconfig. https://github.com/rescript-lang/rescript-compiler/pull/6378

# 11.0.0-rc.2

Expand Down
6 changes: 6 additions & 0 deletions jscomp/build_tests/uncurried_printer/bsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "uncurried_printer",
"version": "0.1.0",
"sources": ["src"],
"uncurried": false
}
15 changes: 15 additions & 0 deletions jscomp/build_tests/uncurried_printer/input.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const assert = require("assert");
const child_process = require("child_process");
const fs = require("fs");
const path = require("path");

const expectedContent = `let a = (. b) => b\n`;
const filePath = path.join(__dirname, "src", "a.res");

fs.writeFileSync(filePath, expectedContent, "utf-8");

child_process.execSync(`../../../rescript format -all`, { cwd: __dirname });

const content = fs.readFileSync(filePath, "utf-8");

assert.equal(content, expectedContent);
1 change: 1 addition & 0 deletions jscomp/build_tests/uncurried_printer/src/a.res
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
let a = (. b) => b
19 changes: 10 additions & 9 deletions jscomp/syntax/src/res_multi_printer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,26 @@ let getUncurriedFromBsconfig ~filename =
| None -> ()
| Some bsconfig ->
let lines = bsconfig |> String.split_on_char '\n' in
let uncurried =
let is_legacy_uncurried =
lines
|> List.exists (fun line ->
let uncurried = ref false in
let false_ = ref false in
let is_uncurried_option = ref false in
let is_option_falsy = ref false in
let words = line |> String.split_on_char ' ' in
words
|> List.iter (fun word ->
match word with
| "\"uncurried\"" | "\"uncurried\":" -> uncurried := true
| "\"uncurried\"" | "\"uncurried\":" ->
is_uncurried_option := true
| "\"uncurried\":false" | "\"uncurried\":false," ->
uncurried := true;
false_ := true
is_uncurried_option := true;
is_option_falsy := true
| "false" | ":false" | "false," | ":false," ->
false_ := true
is_option_falsy := true
| _ -> ());
not (!uncurried && !false_))
!is_uncurried_option && !is_option_falsy)
in
if uncurried then Config.uncurried := Uncurried
if not is_legacy_uncurried then Config.uncurried := Uncurried
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's great.
Perhaps the doc comment could be a little clearer too.


(* print res files to res syntax *)
let printRes ~ignoreParseErrors ~isInterface ~filename =
Expand Down