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

Proposal: Pad record braces #2390

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions formatTest/typeCheckedTests/expected_output/attributes.re
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ let x =
let x =
[@onEverything] (- add(thisVal, thisVal));

let bothTrue = (x, y) => {contents: x && y};
let bothTrue = (x, y) => { contents: x && y };
let something =
[@onEverythingToRightOfEquals]
(bothTrue(true, true))^;
Expand Down Expand Up @@ -414,7 +414,7 @@ external render: (reactElement, element) => unit =
external createCompositeElementInternalHack:
(
reactClass,
{.. "reasonProps": 'props},
{.. "reasonProps": 'props },
array(reactElement)
) =>
reactElement =
Expand Down Expand Up @@ -638,7 +638,7 @@ module Fmt = {
};

Fmt.([@foo] barBaz());
Fmt.([@foo] {x: 1});
Fmt.([@foo] { x: 1 });
Fmt.([@foo] [1, 2, 3]);
Fmt.([@foo] (1, 2, 3));
Fmt.([@foo] {val x = 10});
2 changes: 1 addition & 1 deletion formatTest/typeCheckedTests/expected_output/attributes.rei
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ external createClassInternalHack:
external createCompositeElementInternalHack:
(
reactClass,
t({.. reasonProps: 'props}),
t({.. reasonProps: 'props }),
array(reactElement)
) =>
reactElement =
Expand Down
4 changes: 2 additions & 2 deletions formatTest/typeCheckedTests/expected_output/comments.re
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ let result =

let result =
switch (None) {
| Some({fieldOne: 20}) =>
| Some({ fieldOne: 20 }) =>
/* Where does this comment go? */
let tmp = 0;
2 + tmp;
| Some({fieldOne: n}) =>
| Some({ fieldOne: n }) =>
/* How about this one */
let tmp = n;
n + tmp;
Expand Down
2 changes: 1 addition & 1 deletion formatTest/typeCheckedTests/expected_output/imperative.re
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ switch (
| () => ()
};

let shouldStillLoop = {contents: false};
let shouldStillLoop = { contents: false };

while (shouldStillLoop.contents) {
print_string("You're in a while loop");
Expand Down
12 changes: 6 additions & 6 deletions formatTest/typeCheckedTests/expected_output/jsx.re
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ module Namespace = {
module Optional1 = {
let createElement = (~required, ~children, ()) => {
switch (required) {
| Some(a) => {displayName: a}
| None => {displayName: "nope"}
| Some(a) => { displayName: a }
| None => { displayName: "nope" }
};
};
};
Expand All @@ -114,8 +114,8 @@ module Optional2 = {
let createElement =
(~optional=?, ~children, ()) => {
switch (optional) {
| Some(a) => {displayName: a}
| None => {displayName: "nope"}
| Some(a) => { displayName: a }
| None => { displayName: "nope" }
};
};
};
Expand All @@ -124,8 +124,8 @@ module DefaultArg = {
let createElement =
(~default=Some("foo"), ~children, ()) => {
switch (default) {
| Some(a) => {displayName: a}
| None => {displayName: "nope"}
| Some(a) => { displayName: a }
| None => { displayName: "nope" }
};
};
};
Expand Down
5 changes: 3 additions & 2 deletions formatTest/typeCheckedTests/expected_output/lazy.re
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ let myComputation =

type myRecord = {myRecordField: int};

let operateOnLazyValue = (lazy {myRecordField}) => {
let operateOnLazyValue =
(lazy { myRecordField }) => {
let tmp = myRecordField;
tmp + tmp;
};

let result =
operateOnLazyValue(
lazy({myRecordField: 100}),
lazy({ myRecordField: 100 }),
);

type box('a) =
Expand Down
14 changes: 7 additions & 7 deletions formatTest/typeCheckedTests/expected_output/oo.re
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ type closedObj = {.};
let (<..>) = (a, b) => a + b;
let five = 2 <..> 3;

type nestedObj = {. bar: {. a: int}};
type nestedObj = {. bar: {. a: int } };

let (>>) = (a, b) => a > b;

Expand Down Expand Up @@ -156,9 +156,9 @@ let anonClosedObject: {
};

let onlyHasX = {pub x = 0};
let xs: list({. x: int}) = [
let xs: list({. x: int }) = [
onlyHasX,
(anonClosedObject :> {. x: int}),
(anonClosedObject :> {. x: int }),
];

let constrainedAndCoerced = (
Expand All @@ -168,21 +168,21 @@ let constrainedAndCoerced = (
x: int,
y: int,
}) :>
list({. x: int})
list({. x: int })
);

/* If one day, unparenthesized type constraints are allowed on the RHS of a
* record value, we're going to have to be careful here because >} is parsed as
* a separate kind of token (for now). Any issues would likely be caught in the
* idempotent test case.
*/
let xs: ref({. x: int}) = {
contents: (anonClosedObject :> {. x: int}),
let xs: ref({. x: int }) = {
contents: (anonClosedObject :> {. x: int }),
};

let coercedReturn = {
let tmp = anonClosedObject;
(tmp :> {. x: int});
(tmp :> {. x: int });
};

let acceptsOpenAnonObjAsArg =
Expand Down