t15836.nim 323 B

123456789101112
  1. discard """
  2. errormsg: "type mismatch: got <string> but expected 'int'"
  3. line: 11
  4. """
  5. proc takesProc[T](x: T, f: proc(x: T): int) =
  6. echo f(x) + 2
  7. takesProc(1, proc (a: int): int = 2) # ok, prints 4
  8. takesProc(1, proc (a: auto): auto = 2) # ok, prints 4
  9. takesProc(1, proc (a: auto): auto = "uh uh") # prints garbage