-
Notifications
You must be signed in to change notification settings - Fork 428
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reason v4 - 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:
- Loading branch information
Showing
22 changed files
with
824 additions
and
380 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
formatTest/typeCheckedTests/expected_output/autoUpgradeAngleBrackets.re
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* Even if you have an explicit v3.6 marker. | ||
* This whole file wil be auto-upaded to 3.8 becase something uses | ||
* angle brackets. | ||
*/; | ||
[@reason.version 3.8]; | ||
let watchThisIsOldStyle: list<int> = [1, 2]; | ||
|
||
let watchThisIsOldStylePoly = #hello; | ||
|
||
/** | ||
* This will cause the whole file to be promoted. | ||
*/ | ||
let x: list<int> = [1, 3]; |
13 changes: 13 additions & 0 deletions
13
formatTest/typeCheckedTests/expected_output/autoUpgradeAngleBracketsNoVersionAttr.re
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[@reason.version 3.8]; | ||
/** | ||
* Test auto-promotion based on feature inference even if no version | ||
* tag. By default you're using the old 3.7. | ||
*/ | ||
let watchThisIsOldStyle: list<int> = [1, 2]; | ||
|
||
let watchThisIsOldStylePoly = #hello; | ||
|
||
/** | ||
* This will cause the whole file to be promoted. | ||
*/ | ||
let x: list<int> = [1, 3]; |
5 changes: 5 additions & 0 deletions
5
formatTest/typeCheckedTests/expected_output/autoUpgradeDoNotAutoUpgrade.re
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[@reason.version 3.7]; | ||
/** | ||
* This should just print a 3.7 version attr at the top. | ||
*/ | ||
let watchThisIsOldStyle: list(int) = [1, 2]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
formatTest/typeCheckedTests/input/autoUpgradeAngleBrackets.re
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* Even if you have an explicit v3.6 marker. | ||
* This whole file wil be auto-upaded to 3.8 becase something uses | ||
* angle brackets. | ||
*/ | ||
[@reason.version 3.6]; | ||
let watchThisIsOldStyle : list(int) = [1, 2]; | ||
|
||
let watchThisIsOldStylePoly = `hello; | ||
|
||
/** | ||
* This will cause the whole file to be promoted. | ||
*/ | ||
let x : list<int> = [1, 3]; |
12 changes: 12 additions & 0 deletions
12
formatTest/typeCheckedTests/input/autoUpgradeAngleBracketsNoVersionAttr.re
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/** | ||
* Test auto-promotion based on feature inference even if no version | ||
* tag. By default you're using the old 3.7. | ||
*/ | ||
let watchThisIsOldStyle : list(int) = [1, 2]; | ||
|
||
let watchThisIsOldStylePoly = `hello; | ||
|
||
/** | ||
* This will cause the whole file to be promoted. | ||
*/ | ||
let x : list<int> = [1, 3]; |
5 changes: 5 additions & 0 deletions
5
formatTest/typeCheckedTests/input/autoUpgradeDoNotAutoUpgrade.re
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/** | ||
* This should just print a 3.7 version attr at the top. | ||
*/ | ||
let watchThisIsOldStyle : list(int) = [1, 2]; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.