From c79fb859f1a0b2ac4e970a8be8ac9130ee7084a9 Mon Sep 17 00:00:00 2001 From: ringabout <43030857+ringabout@users.noreply.github.com> Date: Fri, 15 Nov 2024 19:31:12 +0800 Subject: [PATCH] adds some test cases (#24436) closes #24043 closes #24045 (cherry picked from commit cc696f18c01c471d9a9eca8f67c7739b5d82cf8c) --- tests/generics/t23854.nim | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/generics/t23854.nim b/tests/generics/t23854.nim index f1175c8b21..7c777c299e 100644 --- a/tests/generics/t23854.nim +++ b/tests/generics/t23854.nim @@ -69,3 +69,25 @@ proc main() = doAssert ctx.rootsOfUnity2[0].limbs.len == wordsRequired(255) main() + +block: # bug #24045 + type ArrayBuf[N: static int, T] = object + buf: array[N, T] + + func maxLen(T: type): int = + sizeof(T) * 2 + + type MyBuf[I: type] = ArrayBuf[maxLen(I), byte] + + var v: MyBuf[int] + +block: # bug #24043 + type ArrayBuf[N: static int, T = byte] = object + buf: array[N, T] + + func maxLen(T: type): int = + sizeof(T) * 2 + + type MyBuf[I] = ArrayBuf[maxLen(I)] + + var v: MyBuf[int]