Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve numeric literal error - fixes #1129
Browse files Browse the repository at this point in the history
forki committed May 3, 2016

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent ce687a4 commit 81c1a4b
Showing 4 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/fsharp/FSComp.txt
Original file line number Diff line number Diff line change
@@ -977,7 +977,7 @@ lexUnexpectedChar,"Unexpected character '%s'"
1153,lexInvalidFloat,"Invalid floating point number"
1154,lexOusideDecimal,"This number is outside the allowable range for decimal literals"
1155,lexOusideThirtyTwoBitFloat,"This number is outside the allowable range for 32-bit floats"
1156,lexInvalidNumericLiteral,"This is not a valid numeric literal. Sample formats include 4, 0x4, 0b0100, 4L, 4UL, 4u, 4s, 4us, 4y, 4uy, 4.0, 4.0f, 4I."
1156,lexInvalidNumericLiteral,"This is not a valid numeric literal. Valid numeric literals include 1, 0x1, 0b0001 (int), 1u (uint32), 1L (int64), 1UL (uint64), 1s (int16), 1y (sbyte), 1ui (byte), 1.0 (float), 1.0f (float32), 1.0m (decimal), 1I (BigInteger)."
1157,lexInvalidByteLiteral,"This is not a valid byte literal"
1158,lexInvalidCharLiteral,"This is not a valid character literal"
1159,lexThisUnicodeOnlyInStringLiterals,"This Unicode encoding is only valid in string literals"
6 changes: 6 additions & 0 deletions tests/fsharpqa/Source/Warnings/WrongNumericLiteral.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// #Warnings
//<Expects status="Error" span="(4,11)" id="FS1156">This is not a valid numeric literal. Valid numeric literals include 1, 0x1, 0b0001 (int), 1u (uint32), 1L (int64), 1UL (uint64), 1s (int16), 1y (sbyte), 1ui (byte), 1.0 (float), 1.0f (float32), 1.0m (decimal), 1I (BigInteger).</Expects>

let foo = 1up

exit 0
1 change: 1 addition & 0 deletions tests/fsharpqa/Source/Warnings/env.lst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SOURCE=WrongNumericLiteral.fs # WrongNumericLiteral.fs
1 change: 1 addition & 0 deletions tests/fsharpqa/Source/test.lst
Original file line number Diff line number Diff line change
@@ -280,6 +280,7 @@ Misc01 Libraries\Core\NativeInterop\stackalloc
Misc01 Libraries\Core\Operators
Misc01 Libraries\Core\Reflection
Misc01 Libraries\Core\Unchecked
Misc01 Warnings

Misc02 Libraries\Portable
Misc02 Misc

0 comments on commit 81c1a4b

Please sign in to comment.