tbasic_lent_check.nim 260 B

1234567891011121314151617
  1. discard """
  2. output: "1"
  3. """
  4. proc viewInto(a: array[4, string]): lent string =
  5. result = a[0]
  6. proc passToVar(x: var string) =
  7. discard
  8. proc main =
  9. let x = ["1", "2", "3", "4"]
  10. echo viewInto(x)
  11. doAssert(not compiles(passToVar(viewInto(x))))
  12. main()