followup custom literals (#17500)
This commit is contained in:
parent
d3705b253c
commit
bbe4cf4703
7 changed files with 94 additions and 33 deletions
|
|
@ -51,8 +51,17 @@ template main =
|
|||
doAssert x() == minusOne:
|
||||
"unable to handle negatives after semi-colon"
|
||||
|
||||
block:
|
||||
doAssert -0b111 == -7
|
||||
doAssert -0xff == -255
|
||||
doAssert -128'i8 == (-128).int8
|
||||
doAssert $(-128'i8) == "-128"
|
||||
doAssert -32768'i16 == int16.low
|
||||
doAssert -2147483648'i32 == int32.low
|
||||
when int.sizeof > 4:
|
||||
doAssert -9223372036854775808 == int.low
|
||||
when not defined(js):
|
||||
doAssert -9223372036854775808 == int64.low
|
||||
|
||||
block: # check when a minus (-) is an unary op
|
||||
doAssert -one == minusOne:
|
||||
|
|
@ -68,6 +77,5 @@ template main =
|
|||
doAssert 4 - one == 3:
|
||||
"unable to handle subtraction with surrounding spaces with an identifier"
|
||||
|
||||
|
||||
static: main()
|
||||
main()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue