summary refs log tree commit diff stats
path: root/tests/system/tsystem_misc.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/system/tsystem_misc.nim')
-rw-r--r--tests/system/tsystem_misc.nim15
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