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
commit db56fc3bcb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 12 additions and 23 deletions

View file

@ -2179,7 +2179,8 @@ proc semProcAux(c: PContext, n: PNode, kind: TSymKind,
if hasProto: localError(c.config, n.info, errImplOfXexpected % proto.name.s)
if {sfImportc, sfBorrow, sfError} * s.flags == {} and s.magic == mNone:
# this is a forward declaration and we're building the prototype
if s.kind in {skProc, skFunc} and s.typ[0] != nil and s.typ[0].kind == tyAnything:
if s.kind in {skProc, skFunc} and s.typ[0] != nil and s.typ[0].kind == tyUntyped:
# `auto` is represented as `tyUntyped` at this point in compilation.
localError(c.config, n[paramsPos][0].info, "return type 'auto' cannot be used in forward declarations")
incl(s.flags, sfForward)