Files
Nim/tests/lent/tbasic_lent_check.nim
Andreas Rumpf 71fd4acaeb make test green
2019-03-05 05:53:28 +01:00

17 lines
260 B
Nim

discard """
output: "1"
"""
proc viewInto(a: array[4, string]): lent string =
result = a[0]
proc passToVar(x: var string) =
discard
proc main =
let x = ["1", "2", "3", "4"]
echo viewInto(x)
doAssert(not compiles(passToVar(viewInto(x))))
main()