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














                                                 
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()