tproc.nim 464 B

1234567891011121314151617181920212223242526272829303132
  1. discard """
  2. output: '''
  3. Hello
  4. 1
  5. '''
  6. """
  7. block t8357:
  8. type T = ref int
  9. let r = new(string)
  10. r[] = "Hello"
  11. echo r[]
  12. block t8683:
  13. proc foo[T](bar: proc (x, y: T): int = system.cmp, baz: int) =
  14. echo "1"
  15. proc foo[T](bar: proc (x, y: T): int = system.cmp) =
  16. echo "2"
  17. foo[int](baz = 5)
  18. block tnestprc:
  19. proc Add3(x: int): int =
  20. proc add(x, y: int): int {.noconv.} =
  21. result = x + y
  22. result = add(x, 3)
  23. doAssert Add3(7) == 10