fixes #9281
This commit is contained in:
parent
8ab6fa1be2
commit
d48e964950
3 changed files with 32 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue