minor bugfixes for 'func' and .borrow

This commit is contained in:
Araq 2020-06-23 10:58:55 +02:00
commit ebd1cc0265
2 changed files with 3 additions and 2 deletions

View file

@ -682,7 +682,8 @@ proc searchForBorrowProc(c: PContext, startScope: PScope, fn: PSym): PSym =
x = t.baseOfDistinct
call.add(newNodeIT(nkEmpty, fn.info, x))
if hasDistinct:
var resolved = semOverloadedCall(c, call, call, {fn.kind}, {})
let filter = if fn.kind in {skProc, skFunc}: {skProc, skFunc} else: {fn.kind}
var resolved = semOverloadedCall(c, call, call, filter, {})
if resolved != nil:
result = resolved[0].sym
if not compareTypes(result.typ[0], fn.typ[0], dcEqIgnoreDistinct):