Fix unsound transform pass (#8633)

When a `var openArray[T]` function parameter goes trough the
`transformAddrDeref` pass we may lose the `var` specifier, leading to
nasty crashes at runtime.
This commit is contained in:
LemonBoy 2018-08-14 20:38:04 +02:00 • committed by Andreas Rumpf
commit c04404635b
4 changed files with 22 additions and 0 deletions

View file

@ -0,0 +1,8 @@
proc foo[T](s: var openArray[T]): T =
for x in s: result += x
proc bar(xyz: var seq[int]) =
doAssert 6 == (seq[int](xyz)).foo()
var t = @[1,2,3]
bar(t)