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

Fix pretty printing of Ptyp_poly (docking of .) #2097

Merged
merged 1 commit into from
Jul 30, 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
2 changes: 1 addition & 1 deletion formatTest/unit_tests/expected_output/variants.re
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ let result =
};

let rec commentPolymorphicCases:
'a .
'a.
option('a) => int
=
fun
Expand Down
16 changes: 8 additions & 8 deletions formatTest/unit_tests/expected_output/wrappingTest.re
Original file line number Diff line number Diff line change
Expand Up @@ -2079,7 +2079,7 @@ let (
"wrap",
);

let myPolyFunc: 'a .'a => 'a = o => o;
let myPolyFunc: 'a. 'a => 'a = o => o;
let myNonPolyFunc: 'a => 'a = o => o;

let locallyAbstractFunc = (type a, input: a) => input;
Expand All @@ -2092,7 +2092,7 @@ let locallyAbstractFuncAnnotated: type a. a => a =
Examples of how long versions of these should be wrapped: df stands for
"desired formatting" when the function binding itself must wrap.
*/
let df_myPolyFunc: 'a .'a => 'a = o => o;
let df_myPolyFunc: 'a. 'a => 'a = o => o;
let df_myNonPolyFunc: 'a => 'a = o => o;

type nameBlahType = {nameBlah: int};
Expand Down Expand Up @@ -2195,7 +2195,7 @@ let df_locallyAbstractFuncAnnotated: 'figureMeOut =
);

let createTuple_thisFuncShouldWrapCorrectlyNow:
'a .
'a.
('a, 'a, 'a) => ('a, 'a, 'a)
=
(someVar, someVar2, someVar3) => (
Expand Down Expand Up @@ -2675,24 +2675,24 @@ let produceRecord = x => /*commentAfterArg*/ {
};

let myPolyFuncCommentBeforeColon /*beforeColon */:
'a .
'a.
'a => 'a
=
o => o;
let myPolyFuncCommentAfterColon: 'a .'a => 'a =
let myPolyFuncCommentAfterColon: 'a. 'a => 'a =
/*afterColon */
o => o;
let myPolyFuncCommentBeforeArrow: 'a .'a => 'a =
let myPolyFuncCommentBeforeArrow: 'a. 'a => 'a =
/*beforeArrow */
o => o;
let myPolyFuncCommentAfterArrow:
'a .
'a.
'a => /*afterArrow */ 'a
=
o => o;
/* THIS IS THE ONLY TEST THAT IS FAILING DUE TO BEING NON-IDEMPOTENT */
/* let myPolyFuncCommentBeforeEqual : 'a . ('a) => 'a /*beforeEqual */ = fun(o) => o; */
let myPolyFuncCommentAfterEqual: 'a .'a => 'a =
let myPolyFuncCommentAfterEqual: 'a. 'a => 'a =
/*afterEqual */ o => o;

let myNonPolyFuncCommentBeforeColon /*BeforeColon */:
Expand Down
4 changes: 2 additions & 2 deletions src/reason-parser/reason_pprint_ast.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2453,8 +2453,8 @@ let printer = object(self:'self)
let poly = match sl with
| [] -> ct
| sl ->
makeList ~break:IfNeed [
makeList ~postSpace:true [
makeList ~break:IfNeed ~postSpace:true [
makeList [
makeList ~postSpace:true (List.map (fun x -> self#tyvar x) sl);
atom ".";
];
Expand Down