summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--lib/system.nim3
-rw-r--r--tests/system/tsystem_misc.nim16
2 files changed, 18 insertions, 1 deletions
diff --git a/lib/system.nim b/lib/system.nim
index 32a88de64..d59551d54 100644
--- a/lib/system.nim
+++ b/lib/system.nim
@@ -4164,7 +4164,8 @@ when not defined(js):
     magic: "Slice".}
   proc toOpenArray*(x: string; first, last: int): openarray[char] {.
     magic: "Slice".}
-
+  proc toOpenArrayByte*(x: string; first, last: int): openarray[byte] {.
+    magic: "Slice".}
 
 type
   ForLoopStmt* {.compilerProc.} = object ## special type that marks a macro
diff --git a/tests/system/tsystem_misc.nim b/tests/system/tsystem_misc.nim
index 6d14aa68f..ce36bc9ef 100644
--- a/tests/system/tsystem_misc.nim
+++ b/tests/system/tsystem_misc.nim
@@ -15,6 +15,16 @@ discard """
 1
 2
 3
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
 '''
 """
 
@@ -86,3 +96,9 @@ doAssertRaises(IndexError):
   foo(toOpenArray(arrNeg, -1, 0))
 doAssertRaises(IndexError):
   foo(toOpenArray(arrNeg, -1, -3))
+
+proc foo(a: openArray[byte]) =
+  for x in a: echo x
+
+let str = "0123456789"
+foo(toOpenArrayByte(str, 0, str.high))