mirror of
https://github.com/nim-lang/Nim.git
synced 2026-07-17 14:31:15 +00:00
fixes #14522 fixes #22085 fixes #12700 fixes #23132 closes https://github.com/nim-lang/Nim/pull/22343 (succeeded by this PR) completes https://github.com/nim-lang/RFCs/issues/175 follow up https://github.com/nim-lang/Nim/pull/12688
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
discard """
|
||||
targets: "c cpp"
|
||||
"""
|
||||
|
||||
doAssert typeOf(1.int64 + 1.int) is int64
|
||||
doAssert typeOf(1.uint64 + 1.uint) is uint64
|
||||
doAssert int64 is SomeNumber
|
||||
@@ -12,3 +16,24 @@ doAssert typeOf(myInt16 + myInt) is int # of type `int`
|
||||
doAssert typeOf(myInt16 + 2i32) is int32 # of type `int32`
|
||||
doAssert int32 isnot int64
|
||||
doAssert int32 isnot int
|
||||
|
||||
block:
|
||||
# bug #22085
|
||||
const
|
||||
x = uint32(uint64.high) # vm error
|
||||
u = uint64.high
|
||||
v = uint32(u) # vm error
|
||||
|
||||
let
|
||||
z = uint64.high
|
||||
y = uint32(z) # runtime ok
|
||||
|
||||
let
|
||||
w = uint32(uint64.high) # semfold error
|
||||
|
||||
doAssert x == w
|
||||
doAssert v == y
|
||||
|
||||
# bug #14522
|
||||
doAssert 0xFF000000_00000000.uint64 == 18374686479671623680'u64
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
discard """
|
||||
cmd: "nim check --hint:Processing:off --hint:Conf:off $file"
|
||||
errormsg: "18446744073709551615 can't be converted to int8"
|
||||
nimout: '''tcompiletime_range_checks.nim(36, 21) Error: 2147483648 can't be converted to int32
|
||||
tcompiletime_range_checks.nim(37, 23) Error: -1 can't be converted to uint64
|
||||
nimout: '''
|
||||
tcompiletime_range_checks.nim(36, 21) Error: 2147483648 can't be converted to int32
|
||||
tcompiletime_range_checks.nim(38, 34) Error: 255 can't be converted to FullNegativeRange
|
||||
tcompiletime_range_checks.nim(39, 34) Error: 18446744073709551615 can't be converted to HalfNegativeRange
|
||||
tcompiletime_range_checks.nim(40, 34) Error: 300 can't be converted to FullPositiveRange
|
||||
|
||||
Reference in New Issue
Block a user