nemerle icon indicating copy to clipboard operation
nemerle copied to clipboard

-0x8000000000000000l is too large for given type

Open DirtYiCE opened this issue 10 years ago • 1 comments

Trying to compile

System.Console.WriteLine(-0x8000000000000000l);

yields

foo.n:1:46:1:46: error: number literal 08000000000000000 is too large for given type

which is wrong, since -0x8000000000000000l == Int64.MinValue, and doing someting like this in C# also works. It looks like the compiler is trying to convert the input number from ulong to long, then negate it, which fails since 0x8000000000000000l is indeed invalid.

The same problem appears with -0x80sb, -0x8000s. Doing -0x80000000 works correctly.

DirtYiCE avatar Sep 12 '13 17:09 DirtYiCE

As you can see in Lexer.n: https://github.com/rsdn/nemerle/blob/master/ncc/parsing/Lexer.n#L1261 You are totally correct. You can help us fixing this code to parse correctly using Int64 and not UInt64 in that case. Don't forget to write test :)

NN--- avatar Sep 12 '13 19:09 NN---