diff options
author | LemonBoy <LemonBoy@users.noreply.github.com> | 2018-10-18 11:08:05 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-10-18 11:08:05 +0200 |
commit | 6ef198e07b4cd7dbbc814eadfe0e2b95f2f18a00 (patch) | |
tree | 4d2494417b6fb368c1ec4a5351ac82ca4054c4a6 /tests/array | |
parent | 458aab0b10dcfbd93101cf0b683431c685283ec8 (diff) | |
download | Nim-6ef198e07b4cd7dbbc814eadfe0e2b95f2f18a00.tar.gz |
Relax the restrictions on the index types (#9412)
Diffstat (limited to 'tests/array')
-rw-r--r-- | tests/array/tarray.nim | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/array/tarray.nim b/tests/array/tarray.nim index e35a804ee..4a31a4d6d 100644 --- a/tests/array/tarray.nim +++ b/tests/array/tarray.nim @@ -533,6 +533,9 @@ block t7818: doAssert(testOpenArray(@[u.addr, v.addr, w.addr]) == "123") doAssert(testOpenArray(@[w.addr, u.addr, v.addr]) == "312") -# regression regarding unchecked array indexing: -proc foo(x: ptr UncheckedArray[int]; idx: uint64) = - echo x[idx] +block trelaxedindextyp: + # any integral type is allowed as index + proc foo(x: ptr UncheckedArray[int]; idx: uint64) = echo x[idx] + 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] |