summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authormetagn <metagngn@gmail.com>2023-06-29 23:05:18 +0300
committerGitHub <noreply@github.com>2023-06-29 22:05:18 +0200
commit210b10dd0d47c8c79b686a69eb8646df869cf207 (patch)
tree70c70d876558c19a0df4ae5b7c1c06b981aca111 /tests
parent41ec894cb0aa0b0d233a0f62ff4929d64ddad3a7 (diff)
downloadNim-210b10dd0d47c8c79b686a69eb8646df869cf207.tar.gz
fix nested call regression in generic bodies (#22189)
fixes #22187
Diffstat (limited to 'tests')
-rw-r--r--tests/statictypes/tgenericcomputedrange.nim20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/statictypes/tgenericcomputedrange.nim b/tests/statictypes/tgenericcomputedrange.nim
index 01ec4767a..82abe2677 100644
--- a/tests/statictypes/tgenericcomputedrange.nim
+++ b/tests/statictypes/tgenericcomputedrange.nim
@@ -95,3 +95,23 @@ block:
     x[2] = 3
     doAssert x == [0: 1, 1: 2, 2: 3]
     doAssert x is array[0 .. 2, int]
+
+block:
+  type Foo[T; U: static T] = array[T(0) .. (U * 2) + 1, int]
+
+  block:
+    var x: Foo[int, 1]
+    x[0] = 1
+    x[1] = 2
+    x[2] = 3
+    x[3] = 4
+    doAssert x == [0: 1, 1: 2, 2: 3, 3: 4]
+    doAssert x is array[0 .. 3, int]
+
+block: # issue #22187
+  template m(T: type, s: int64): int64 = s
+  func p(n: int64): int = int(n)
+  type F[T; s: static int64] = object
+    k: array[p(m(T, s)), int64]
+  var x: F[int, 3]
+  doAssert x.k is array[3, int64]