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

Parse class exprs and types without trailing semicolon #2040

Merged
merged 2 commits into from
Jul 2, 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
12 changes: 6 additions & 6 deletions formatTest/typeCheckedTests/expected_output/attributes.re
Original file line number Diff line number Diff line change
Expand Up @@ -261,28 +261,28 @@ class type addablePointClassType = {
addablePointClassType,
addablePointClassType
) =>
int
int;
}
[@structureItem]
and anotherClassType = {
pub foo: int;
pub bar: int
pub bar: int;
};

class type _x =
[@bs]
{
pub height: int
pub height: int;
};

class type _y = {
[@bs.set]
pub height: int
pub height: int;
};

[@attr]
class type _z = {
pub height: int
pub height: int;
};

module NestedModule = {
Expand All @@ -296,7 +296,7 @@ module type HasAttrs = {
[@sigItem]
class type foo = {
pub foo: int;
pub bar: int
pub bar: int;
};
[@sigItem]
class fooBar : (int) => foo;
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 @@ -209,7 +209,7 @@ class myClassWithAnnotatedReturnType
(init)
: {
pub x: int;
pub y: int
pub y: int;
} = {
pub x: int = init;
pub y = init;
Expand All @@ -221,7 +221,7 @@ class myClassWithAnnotatedReturnType2
(init)
: {
pub x: int;
pub y: int
pub y: int;
} = {
pub x: int = init;
pub y = init;
Expand All @@ -234,7 +234,7 @@ class myClassWithAnnotatedReturnType3
(init)
: {
pub x: int;
pub y: int
pub y: int;
} = {
pub x: int = init;
pub y: int = init;
Expand Down Expand Up @@ -263,7 +263,7 @@ class myClassWithAnnotatedReturnType3_annotated_constructor:
(int) =>
{
pub x: int;
pub y: int
pub y: int;
} =
fun (init) => {
pub x: int = init;
Expand All @@ -282,15 +282,15 @@ module HasTupleClasses: {
(int) =>
{
pub x: int;
pub y: int
pub y: int;
};
/**
* anotherExportedClass.
*/
class anotherExportedClass ('a, 'b) :
(('a, 'b)) =>
{
pub pr: ('a, 'b)
pub pr: ('a, 'b);
};
} = {
/**
Expand Down Expand Up @@ -363,7 +363,7 @@ class type addablePointClassType = {
addablePointClassType,
addablePointClassType
) =>
int
int;
};

/**
Expand Down
23 changes: 21 additions & 2 deletions formatTest/unit_tests/expected_output/class_types.re
Original file line number Diff line number Diff line change
@@ -1,10 +1,29 @@
class type _module ('provider_impl) = {};
type t;
class type bzz = {
inherit _module(t)
inherit _module(t);
};

class type t = {
as 'a;
constraint 'a = #s
constraint 'a = #s;
};

/* https://github.com/facebook/reason/issues/2037 */
class type xt = {
as 'a;
};

class x = {
as self;
};

class type classWithNoArgType = {
pub x: int;
pub y: int;
};

class classWithNoArg = {
pub x = 0;
pub y = 0;
};
4 changes: 2 additions & 2 deletions formatTest/unit_tests/expected_output/uncurried.re
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class type _rect =
pub height: int;
[@bs.set]
pub width: int;
pub draw: unit => unit
pub draw: unit => unit;
};

class type _rect =
Expand All @@ -92,7 +92,7 @@ class type _rect =
pub height: int;
[@bs.set]
pub width: int;
pub draw: unit => unit
pub draw: unit => unit;
};

funWithCb("text", (.) => doStuff());
Expand Down
6 changes: 3 additions & 3 deletions formatTest/unit_tests/expected_output/whitespace.rei
Original file line number Diff line number Diff line change
Expand Up @@ -177,20 +177,20 @@ module X = MX;

/** doc attr attached */
class type x = {
pub height: int
pub height: int;
};

/** doc attr with newline */

class type x = {
pub height: int
pub height: int;
};

/** doc attr with newline and comment */

/* test */
class type x = {
pub height: int
pub height: int;
};

/** doc attr attached */;
Expand Down
17 changes: 17 additions & 0 deletions formatTest/unit_tests/input/class_types.re
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,20 @@ class type bzz = {
class type t = { as 'a;
constraint 'a = #s
};

/* https://github.com/facebook/reason/issues/2037 */
class type xt = { as 'a };

class x = {
as self
};

class type classWithNoArgType {
pub x : int;
pub y : int
};

class classWithNoArg {
pub x = 0;
pub y = 0
};
Loading