From 36e34d9aedd5d6f39dcc78a2239752c94227c542 Mon Sep 17 00:00:00 2001 From: Vindaar Date: Wed, 23 Jan 2019 08:44:19 +0100 Subject: [PATCH] close #3899 by adding test case (#10424) --- tests/array/tarray.nim | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/array/tarray.nim b/tests/array/tarray.nim index f7c1dbf7f0..b40c8757c5 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]