Skip to content

Commit

Permalink
rebase on master after reasonml#2050, parse #= with higher preceden…
Browse files Browse the repository at this point in the history
…ce, parens

unnecessary on the right side
  • Loading branch information
anmonteiro committed Jul 6, 2018
1 parent 1080361 commit d800d7b
Show file tree
Hide file tree
Showing 6 changed files with 4,158 additions and 3,903 deletions.
31 changes: 15 additions & 16 deletions formatTest/unit_tests/expected_output/bucklescript.re
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
bla #= 10;

bla #= (Some(10));
bla #= Some(10);

bla #= someFunc(Some(10));

test##var #= (Some(-10));
test["var"] = Some(-10);

obj##.prop;

obj##.prod := exp;

preview##style##border #= Js.string(
"1px black dashed",
);
preview["style"]["border"] =
Js.string("1px black dashed");

preview##(style##border) #= args(somenum);
(preview##(style["border"]) #= args)(somenum);

x##y##z #= (xxxx##yyyy##zzzz);
x["y"]["z"] = xxxx["yyyy"]["zzzz"];

let result =
js_method_run1((!react)#createElement, foo);
Expand All @@ -37,12 +36,12 @@ let res = z##(q["a"]); /* AST */
let res = z##(q["a"]); /* Min parens */

/* These should print the same */
let res = !x##y; /* AST */
let res = !x##y; /* Minimum parens */
let res = !x["y"]; /* AST */
let res = !x["y"]; /* Minimum parens */

/* These should print the same */
let res = !z##q##a; /* AST */
let res = !z##q##a; /* Min parens */
let res = !z["q"]["a"]; /* AST */
let res = !z["q"]["a"]; /* Min parens */

/* These should print the same */
let res = ?!!x["y"]; /* AST */
Expand All @@ -52,12 +51,12 @@ let res = ?!!x["y"]; /* Minimum parens */
let res = ?!!z##(q["a"]); /* AST */
let res = ?!!z##(q["a"]); /* Min parens */

res #= ?!!z##q;
res #= ?!!z##(q##a);
res #= ?!!z["q"];
res #= ?!!z##(q["a"]);

let result = myFunction(x(y)##z, a(b) #= c);
let result = myFunction(x(y)["z"], a(b) #= c);

(!x)##y##(b##c);
(!x)["y"]##(b["c"]);

type a = {. "foo": bar};

Expand All @@ -76,7 +75,7 @@ let b = {
let c = {
"a": a,
"b": b,
"func": a => a##c #= func(10),
"func": a => a["c"] = func(10),
};

let d = {
Expand Down
14 changes: 9 additions & 5 deletions formatTest/unit_tests/expected_output/sharpop.re
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
foo #= bar[0];

foo##bar[0] = 3;
foo["bar"][0] = 3;

foo##bar[0]##baz[1] = 3;
foo["bar"][0]["baz"][1] = 3;

foo##bar[0]##baz[1];
foo["bar"][0]["baz"][1];

foo##bar #= bar[0];
foo["bar"] = bar[0];

foo##bar##baz #= bar##baz[0];
foo["bar"]["baz"] = bar["baz"][0];

bla #= Constr(x);

bla #= M.(someFunc(Some(10)));
4 changes: 4 additions & 0 deletions formatTest/unit_tests/input/sharpop.re
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ foo##bar[0]##baz[1];
foo##bar#=bar[0];

foo##bar##baz #= bar##baz[0];

bla #= (Constr(x));

bla #= M.(someFunc(Some(10)));
Loading

0 comments on commit d800d7b

Please sign in to comment.