Revert "fix #15836 proc arg return type auto unexpectly match proc with concr…" (#21057)

Revert "fix #15836 proc arg return type auto unexpectly match proc with concr… (#21044)"

This reverts commit 0cd9bdcf9f.
This commit is contained in:
ringabout
2022-12-10 04:38:55 +08:00
committed by GitHub
parent da3274d1b3
commit db56fc3bcb
9 changed files with 12 additions and 23 deletions

View File

@@ -1,5 +1,5 @@
discard """
cmd: "nim check --hints:off $file"
cmd: "nim check $file"
errormsg: ""
nimout: '''
tillegalreturntype.nim(11, 11) Error: return type 'typed' is only valid for macros and templates

View File

@@ -1,11 +0,0 @@
discard """
errormsg: "type mismatch: got <string> but expected 'int'"
line: 11
"""
proc takesProc[T](x: T, f: proc(x: T): int) =
echo f(x) + 2
takesProc(1, proc (a: int): int = 2) # ok, prints 4
takesProc(1, proc (a: auto): auto = 2) # ok, prints 4
takesProc(1, proc (a: auto): auto = "uh uh") # prints garbage