basic 'lent T' test works
This commit is contained in:
parent
7adf3bf476
commit
c99f952dfb
4 changed files with 36 additions and 16 deletions
17
tests/lent/tbasic_lent_check.nim
Normal file
17
tests/lent/tbasic_lent_check.nim
Normal file
|
|
@ -0,0 +1,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()
|
||||
Loading…
Add table
Add a link
Reference in a new issue