summary refs log blame commit diff stats
path: root/tests/lent/tbasic_lent_check.nim
blob: 1d954725b6b489c38254d96e6e23c2f2c46b6cbf (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
















                                                 
discard """
  cmd: "nim c --newRuntime $file"
  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()