Skip to content

Commit 0f47216

Browse files
committed
Reason V4 [Stacked Diff 3/n #2614] [Parse Hashtags for polymorphic variants]
Summary: Implements parsing for "hashtags" polymorphic variant constructors. Since Reason Syntax still supports object syntax, we needed to rearrange some syntactic real estate to make this work. ```reason let red = #FF000; let isRed = color => switch(color) { | #FF0000 => true | _ => false }; let callAMethod = someObject::methodName(isRed, "testing red"); let templateLiteral = ` String template literals are still using backticks. String template literals are still using backticks. `; ``` Test Plan: Reviewers: CC:
1 parent 5ee062e commit 0f47216

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+1925
-361
lines changed

esy.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,6 @@
8585
},
8686
"scripts": {
8787
"test": "esy x make test-once-installed",
88-
"doc": "esy dune build @doc"
88+
"doc": "esy build dune build @doc"
8989
}
9090
}

formatTest/typeCheckedTests/expected_output/arityConversion.re

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[@reason.version 3.7];
2+
23
Some((1, 2, 3));
34

45
type bcd =

formatTest/typeCheckedTests/expected_output/attributes.re

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
* This has a nice side effect when printing the terms:
88
* If a node has attributes attached to it,
99
*/;
10-
[@reason.version 3.7];
1110

1211
/**Floating comment text should be removed*/;
12+
[@reason.version 3.7];
1313

1414
/**
1515
* Core language features:
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* Even if you have an explicit v3.6 marker.
3+
* This whole file wil be auto-upaded to 3.8 becase something uses
4+
* angle brackets.
5+
*/;
6+
[@reason.version 3.8];
7+
let watchThisIsOldStyle: list<int> = [1, 2];
8+
9+
let watchThisIsOldStylePoly = #hello;
10+
11+
/**
12+
* This will cause the whole file to be promoted.
13+
*/
14+
let x: list<int> = [1, 3];
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[@reason.version 3.8];
2+
/**
3+
* Test auto-promotion based on feature inference even if no version
4+
* tag. By default you're using the old 3.7.
5+
*/
6+
let watchThisIsOldStyle: list<int> = [1, 2];
7+
8+
let watchThisIsOldStylePoly = #hello;
9+
10+
/**
11+
* This will cause the whole file to be promoted.
12+
*/
13+
let x: list<int> = [1, 3];
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[@reason.version 3.7];
2+
/**
3+
* This should just print a 3.7 version attr at the top.
4+
*/
5+
let watchThisIsOldStyle: list(int) = [1, 2];

formatTest/typeCheckedTests/expected_output/comments.re

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
/* **** comment */
22
/*** comment */
3-
/** docstring */;
3+
/*** docstring */;
4+
45
[@reason.version 3.7];
56

67
/* comment */
7-
/** docstring */;
8+
/*** docstring */;
89
/*** comment */
910
/**** comment */
1011
/***** comment */

formatTest/typeCheckedTests/expected_output/comments.rei

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
/* **** comment */
22
/*** comment */
33
/*** docstring */
4+
5+
[@reason.version 3.7];
6+
47
/* comment */
58
/*** docstring */
69
/*** comment */
710
/**** comment */
811
/***** comment */
912

1013
/** */;
11-
[@reason.version 3.7];
12-
1314
/*** */
1415
/**** */
1516

formatTest/typeCheckedTests/expected_output/comments.rei.4.07.0

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* **** comment */
22
/*** comment */
33
/** docstring */;
4+
45
[@reason.version 3.7];
56

67
/* comment */

formatTest/typeCheckedTests/expected_output/comments.rei.4.07.1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* **** comment */
22
/*** comment */
33
/** docstring */;
4+
45
[@reason.version 3.7];
56

67
/* comment */

0 commit comments

Comments
 (0)