diff options
author | Araq <rumpf_a@web.de> | 2018-10-11 19:52:48 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2018-10-11 19:52:48 +0200 |
commit | d48e964950d92a57c24770d40ef0f05ddfe51b7e (patch) | |
tree | d10d0036ca1ccca319da0cf0bd6028af2b2a6e49 /tests | |
parent | 8ab6fa1be255e91f4a455f5e4a97aff07c12d84c (diff) | |
download | Nim-d48e964950d92a57c24770d40ef0f05ddfe51b7e.tar.gz |
fixes #9281
Diffstat (limited to 'tests')
-rw-r--r-- | tests/system/tsystem_misc.nim | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/system/tsystem_misc.nim b/tests/system/tsystem_misc.nim index ce36bc9ef..c8189b3b1 100644 --- a/tests/system/tsystem_misc.nim +++ b/tests/system/tsystem_misc.nim @@ -25,6 +25,7 @@ discard """ 55 56 57 +2 ''' """ @@ -102,3 +103,17 @@ proc foo(a: openArray[byte]) = let str = "0123456789" foo(toOpenArrayByte(str, 0, str.high)) + + +template boundedOpenArray[T](x: seq[T], first, last: int): openarray[T] = + toOpenarray(x, max(0, first), min(x.high, last)) + +# bug #9281 + +proc foo[T](x: openarray[T]) = + echo x.len + +let a = @[1, 2, 3] + +# a.boundedOpenArray(1, 2).foo() # Works +echo a.boundedOpenArray(1, 2).len # Internal compiler error |