microsoft / qsharp-compiler

Q# compiler, command line tool, and Q# language server
https://docs.microsoft.com/quantum
MIT License
682 stars 171 forks source link

Cannot parse smallest possible int64 value #86

Closed msoeken closed 5 years ago

msoeken commented 5 years ago

Describe the bug

The smallest possible int64 value -9223372036854775808 cannot be parsed into a Q# Int type.

To Reproduce

A test case to trigger the bug is described in this branch:

https://github.com/msoeken/qsharp-compiler/blob/msoeken/minint-bug/src/QsCompiler/Tests.Compiler/SyntaxTests.fs#L171

Expected behavior

The parser returns an Int value with the smallest integer value.

System information

Reproduced on master, other system information seems to be irrelevant for this bug.

Additional context

Maybe the sign is parsed separate from the int value, since the largest int64 value is 9223372036854775807.

bettinaheim commented 5 years ago

Hehe, yes, indeed, I parse the sign separately... That's one edge case to overlook. Thanks for pointing it out!