Fixed distinct composite type class proc borrowing (#18904)

* Fixed composite type class proc borrowing

* Moved borrow search into transf

* added borrow check to symbol flag
This commit is contained in:
Jason Beetham 2021-10-26 03:29:07 -06:00 • committed by GitHub
commit 8d5a275189
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 56 additions and 3 deletions

View file

@ -145,7 +145,11 @@ proc instantiateBody(c: PContext, n, params: PNode, result, orig: PSym) =
if sfGenSym in param.flags:
idTablePut(symMap, params[i].sym, result.typ.n[param.position+1].sym)
freshGenSyms(c, b, result, orig, symMap)
b = semProcBody(c, b)
if sfBorrow notin orig.flags:
# We do not want to generate a body for generic borrowed procs.
# As body is a sym to the borrowed proc.
b = semProcBody(c, b)
result.ast[bodyPos] = hloBody(c, b)
excl(result.flags, sfForward)
trackProc(c, result, result.ast[bodyPos])