summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/generics/treentranttypes.nim30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/generics/treentranttypes.nim b/tests/generics/treentranttypes.nim
index e79451314..9b4774e9b 100644
--- a/tests/generics/treentranttypes.nim
+++ b/tests/generics/treentranttypes.nim
@@ -16,6 +16,11 @@ output: '''
 2x3 VectorVector [[0.0, 0.0, 0.0], [0.0, 0.0, 0.0]]
 
 2x3 VectorArray [[0.0, 0.0, 0.0], [0.0, 0.0, 0.0]]
+
+@[1, 2]
+@[1, 2]
+@[1, 2]@[3, 4]
+@[1, 2]@[3, 4]
 '''
 """
 
@@ -79,3 +84,28 @@ proc arrayTest =
 
 arrayTest()
 
+# https://github.com/nim-lang/Nim/issues/5756
+
+type
+  Vec*[N : static[int]] = object
+    arr*: array[N, int32]
+
+  Mat*[M,N: static[int]] = object
+    arr*: array[M, Vec[N]]
+
+proc vec2*(x,y:int32) : Vec[2] =
+  result.arr = [x,y]
+
+proc mat2*(a,b: Vec[2]): Mat[2,2] =
+  result.arr = [a,b]
+
+const a = vec2(1,2)
+echo @(a.arr)
+let x = a
+echo @(x.arr)
+
+const b = mat2(vec2(1, 2), vec2(3, 4))
+echo @(b.arr[0].arr), @(b.arr[1].arr)
+let y = b
+echo @(y.arr[0].arr), @(y.arr[1].arr)
+