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

Remove extra space before external type definition #1969

Merged
merged 2 commits into from
May 28, 2018
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
27 changes: 13 additions & 14 deletions formatTest/typeCheckedTests/expected_output/attributes.re
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ let myFun =
/* Bucklescript FFI item attributes */

[@bs.val]
external imul : (int, int) => int = "Math.imul";
external imul: (int, int) => int = "Math.imul";

module Js = {
type t('a);
Expand Down Expand Up @@ -391,13 +391,13 @@ type reactClass;

/* "react-dom" shouldn't spread the attribute over multiple lines */
[@bs.val] [@bs.module "react-dom"]
external render : (reactElement, element) => unit =
external render: (reactElement, element) => unit =
"render";

[@bs.module "f"] external f : int => int = "f";
[@bs.module "f"] external f: int => int = "f";

[@bs.val] [@bs.module "react"] [@bs.splice]
external createCompositeElementInternalHack :
external createCompositeElementInternalHack:
(
reactClass,
{.. "reasonProps": 'props},
Expand All @@ -406,18 +406,18 @@ external createCompositeElementInternalHack :
reactElement =
"createElement";

external add_nat : (int, int) => int =
external add_nat: (int, int) => int =
"add_nat_bytecode" "add_nat_native";

[@bs.module "Bar"]
[@ocaml.deprecated
"Use bar instead. It's a much cooler function. This string needs to be a little long"
]
external foo : bool => bool = "";
external foo: bool => bool = "";

/* Attributes on an entire polymorphic variant leaf */
[@bs.module "fs"]
external readFileSync :
external readFileSync:
(
~name: string,
[@bs.string] [
Expand All @@ -429,7 +429,7 @@ external readFileSync :
"";

[@bs.module "fs"]
external readFileSync2 :
external readFileSync2:
(
~name: string,
[@bs.string] [
Expand All @@ -444,20 +444,19 @@ external readFileSync2 :
[@test [@attr]
[%%extension]];

external debounce :
(int, [@bs.meth] unit) => unit =
external debounce: (int, [@bs.meth] unit) => unit =
"";

external debounce :
external debounce:
int => [@bs.meth] (unit => unit) =
"";

external debounce :
external debounce:
(int, [@bs.meth] (unit => unit)) =>
[@bs.meth] (unit => unit) =
"";

external debounce :
external debounce:
(
int,
[@bs.meth] (unit => unit),
Expand All @@ -466,7 +465,7 @@ external debounce :
[@bs.meth] (unit => unit) =
"";

external debounce :
external debounce:
(
int,
[@bs.meth] (unit => unit),
Expand Down
8 changes: 4 additions & 4 deletions formatTest/typeCheckedTests/expected_output/attributes.rei
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,20 @@ type reactClass;
type reactElement;

[@bs.val] [@bs.module "React"]
external createClassInternalHack :
external createClassInternalHack:
t('classSpec) => reactClass =
"createClass";

[@bs.send.pipe: array('a)]
external map : (. ('a => 'b)) => array('b) = "";
external map: (. ('a => 'b)) => array('b) = "";

[@bs.val] [@bs.module "react"]
external createClassInternalHack :
external createClassInternalHack:
t('classSpec) => reactClass =
"createClass";

[@bs.val] [@bs.module "react"] [@bs.splice]
external createCompositeElementInternalHack :
external createCompositeElementInternalHack:
(
reactClass,
t({.. reasonProps: 'props}),
Expand Down
2 changes: 1 addition & 1 deletion formatTest/unit_tests/expected_output/syntax.re
Original file line number Diff line number Diff line change
Expand Up @@ -981,7 +981,7 @@ let A | B | C = X;
/** External function declaration
*
*/
external f : int => int = "foo";
external f: int => int = "foo";

let x = {contents: 0};

Expand Down
2 changes: 1 addition & 1 deletion formatTest/unit_tests/expected_output/uncurried.re
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ add(. 2, [@bs] 3);
type timerId;

[@bs.val]
external setTimeout :
external setTimeout:
((. unit) => unit, int) => timerId =
"setTimeout";

Expand Down
6 changes: 4 additions & 2 deletions src/reason-parser/reason_pprint_ast.ml
Original file line number Diff line number Diff line change
Expand Up @@ -5839,8 +5839,10 @@ let printer = object(self:'self)
*)
method primitive_declaration vd =
let lblBefore =
label ~space:true
(makeList ~postSpace:true [atom "external"; protectIdentifier vd.pval_name.txt; atom ":"])
label
~space:true
(makeList
[(makeList ~postSpace:true [atom "external"; protectIdentifier vd.pval_name.txt]); (atom ":")])
(self#core_type vd.pval_type)
in
let frstHalf = makeList ~postSpace:true [lblBefore; atom "="] in
Expand Down