t15836.nim 342 B

123456789101112
  1. discard """
  2. errormsg: "type mismatch: got <int literal(1), proc (a: GenericParam): auto>"
  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