-
Notifications
You must be signed in to change notification settings - Fork 838
RFC FS-1005 - Underscore literals #1243
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
da4ead5
Merge pull request #1 from Microsoft/master
AviAvni 1db43d0
Merge pull request #2 from Microsoft/master
AviAvni 2329fc9
implement Underscore Literals
AviAvni 430eec5
positive tests for underscore literals
AviAvni ae68ba5
extract remove underscores to inline function
AviAvni 118cf7f
Check the value of the underscore literals are equals to rgular numer…
AviAvni 4ef264c
fix test
AviAvni 2cc7a73
fix typo
AviAvni 0705576
remove inline
AviAvni 57a2fe9
restore inline
AviAvni File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -40,4 +40,60 @@ let boolConst2 = false | |
|
|
||
| let unitConst = () | ||
|
|
||
| let creditCardNumber = 1234_5678_9012_3456L | ||
| if creditCardNumber <> 1234567890123456L then | ||
| failwith "Wrong parsing" | ||
|
|
||
| let socialSecurityNumber = 999_99_9999L | ||
| if socialSecurityNumber <> 999999999L then | ||
| failwith "Wrong parsing" | ||
|
|
||
| let pi = 3.14_15F | ||
| if pi <> 3.1415F then | ||
| failwith "Wrong parsing" | ||
|
|
||
| let hexBytes = 0xFF_EC_DE_5E | ||
| if hexBytes <> 0xFFECDE5E then | ||
| failwith "Wrong parsing" | ||
|
|
||
| let hexWords = 0xCAFE_BABE | ||
| if hexWords <> 0xCAFEBABE then | ||
| failwith "Wrong parsing" | ||
|
|
||
| let maxLong = 0x7fff_ffff_ffff_ffffL | ||
| if maxLong <> 0x7fffffffffffffffL then | ||
| failwith "Wrong parsing" | ||
|
|
||
| let nybbles = 0b0010_0101 | ||
| if nybbles <> 0b00100101 then | ||
| failwith "Wrong parsing" | ||
|
|
||
| let bytes = 0b11010010_01101001_10010100_10010010 | ||
| if bytes <> 0b11010010011010011001010010010010 then | ||
| failwith "Wrong parsing" | ||
|
|
||
| let x2 = 5_2 | ||
| if x2 <> 52 then | ||
| failwith "Wrong parsing" | ||
|
|
||
| let x4 = 5_______2 | ||
| if x4 <> 52 then | ||
| failwith "Wrong parsing" | ||
|
|
||
| let x7 = 0x5_2 | ||
| if x7 <> 0x52 then | ||
| failwith "Wrong parsing" | ||
|
|
||
| let x9 = 0_52 | ||
| if x9 <> 052 then | ||
| failwith "Wrong parsing" | ||
|
|
||
| let x10 = 05_2 | ||
| if x10 <> 052 then | ||
| failwith "Wrong parsing" | ||
|
|
||
| let x14 = 0o5_2 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we need tests that show that the values are actually the expected constants.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right sorry done |
||
| if x14 <> 0o52 then | ||
| failwith "Wrong parsing" | ||
|
|
||
| exit 0 | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spacing is odd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's by design to test more interesting cases.