summary refs log tree commit diff stats
path: root/tests/ccgbugs
diff options
context:
space:
mode:
authorringabout <43030857+ringabout@users.noreply.github.com>2024-02-06 13:24:02 +0800
committerGitHub <noreply@github.com>2024-02-06 06:24:02 +0100
commit4b67cccf5097cc5d2a592bf78ae2746cc3ee8959 (patch)
treef3c2f1fb8c0ee725ffe411535c63d9ec1bf326e5 /tests/ccgbugs
parent3550c907decd206d74c8b5fc3008a8b731491bbe (diff)
downloadNim-4b67cccf5097cc5d2a592bf78ae2746cc3ee8959.tar.gz
fixes regression #23280; Operations on inline toOpenArray len return a wrong result (#23285)
fixes #23280
Diffstat (limited to 'tests/ccgbugs')
-rw-r--r--tests/ccgbugs/tcgbug.nim10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/ccgbugs/tcgbug.nim b/tests/ccgbugs/tcgbug.nim
index 14ed390d4..871d6b59c 100644
--- a/tests/ccgbugs/tcgbug.nim
+++ b/tests/ccgbugs/tcgbug.nim
@@ -123,3 +123,13 @@ proc bug19613 =
   doAssert x.bid.root.data[0] == 42
 
 bug19613()
+
+proc foo = # bug #23280
+  let foo = @[1,2,3,4,5,6]
+  doAssert toOpenArray(foo, 0, 5).len == 6
+  doAssert toOpenArray(foo, 0, 5).len mod 6 == 0 # this should output 0
+  doAssert toOpenArray(foo, 0, 5).max mod 6 == 0
+  let L = toOpenArray(foo, 0, 5).len
+  doAssert L mod 6 == 0 
+
+foo()