diff options
author | ringabout <43030857+ringabout@users.noreply.github.com> | 2024-01-11 18:23:42 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-11 11:23:42 +0100 |
commit | 29ac3c9986de5731a32beaf015e81a18dd6bd498 (patch) | |
tree | 4bf31ac81104097e269658b3d5b132d157a93aa9 /tests/arc | |
parent | 62c5b8b2873caac3e56d15738f503e953840e6ca (diff) | |
download | Nim-29ac3c9986de5731a32beaf015e81a18dd6bd498.tar.gz |
fixes #22923; fixes `=dup` issues (#23182)
fixes #22923
Diffstat (limited to 'tests/arc')
-rw-r--r-- | tests/arc/tarcmisc.nim | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/arc/tarcmisc.nim b/tests/arc/tarcmisc.nim index 3b60fcd02..d02db545a 100644 --- a/tests/arc/tarcmisc.nim +++ b/tests/arc/tarcmisc.nim @@ -688,3 +688,29 @@ block: # bug #22259 f(wrapper) main() + +block: + block: # bug #22923 + block: + let + a: int = 100 + b: int32 = 200'i32 + + let + x = arrayWith(a, 8) # compiles + y = arrayWith(b, 8) # internal error + z = arrayWith(14, 8) # integer literal also results in a crash + + doAssert x == [100, 100, 100, 100, 100, 100, 100, 100] + doAssert $y == "[200, 200, 200, 200, 200, 200, 200, 200]" + doAssert z == [14, 14, 14, 14, 14, 14, 14, 14] + + block: + let a: string = "nim" + doAssert arrayWith(a, 3) == ["nim", "nim", "nim"] + + let b: char = 'c' + doAssert arrayWith(b, 3) == ['c', 'c', 'c'] + + let c: uint = 300'u + doAssert $arrayWith(c, 3) == "[300, 300, 300]" |