summary refs log tree commit diff stats
path: root/tests/array
diff options
context:
space:
mode:
authorVindaar <basti90@gmail.com>2019-01-23 08:44:19 +0100
committerAndreas Rumpf <rumpf_a@web.de>2019-01-23 08:44:19 +0100
commit36e34d9aedd5d6f39dcc78a2239752c94227c542 (patch)
tree59e4d1ff2c653ac2f34c8728ca3c6c188946e814 /tests/array
parenteee9729f536fecd94565e879f28edcb73bcf3861 (diff)
downloadNim-36e34d9aedd5d6f39dcc78a2239752c94227c542.tar.gz
close #3899 by adding test case (#10424)
Diffstat (limited to 'tests/array')
-rw-r--r--tests/array/tarray.nim10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/array/tarray.nim b/tests/array/tarray.nim
index f7c1dbf7f..b40c8757c 100644
--- a/tests/array/tarray.nim
+++ b/tests/array/tarray.nim
@@ -27,6 +27,7 @@ dflfdjkl__abcdefgasfsgdfgsgdfggsdfasdfsafewfkljdsfajs
 dflfdjkl__abcdefgasfsgdfgsgdfggsdfasdfsafewfkljdsfajsdf
 kgdchlfniambejop
 fjpmholcibdgeakn
+2.0
 '''
 joinable: false
 """
@@ -538,3 +539,12 @@ block trelaxedindextyp:
   proc foo(x: seq[int]; idx: uint64) = echo x[idx]
   proc foo(x: string|cstring; idx: uint64) = echo x[idx]
   proc foo(x: openArray[int]; idx: uint64) = echo x[idx]
+
+block t3899:
+  # https://github.com/nim-lang/Nim/issues/3899
+  type O = object
+    a: array[1..2,float]
+  template `[]`(x: O, i: int): float =
+    x.a[i]
+  const c = O(a: [1.0,2.0])
+  echo c[2]