diff options
author | Araq <rumpf_a@web.de> | 2020-06-23 10:58:55 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2020-06-23 10:58:55 +0200 |
commit | ebd1cc0265bd2b9fa071b0649183f14def0f307b (patch) | |
tree | 06dc5f2ce16d1bf1bdf4233bbe22e7158e80b9c1 /compiler | |
parent | da29222f86f7689227ffe12605842d18c9bf0fc1 (diff) | |
download | Nim-ebd1cc0265bd2b9fa071b0649183f14def0f307b.tar.gz |
minor bugfixes for 'func' and .borrow
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/ast.nim | 2 | ||||
-rw-r--r-- | compiler/semcall.nim | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/compiler/ast.nim b/compiler/ast.nim index 66a1a253b..40fd40209 100644 --- a/compiler/ast.nim +++ b/compiler/ast.nim @@ -1756,7 +1756,7 @@ proc isRoutine*(s: PSym): bool {.inline.} = proc isCompileTimeProc*(s: PSym): bool {.inline.} = result = s.kind == skMacro or - s.kind == skProc and sfCompileTime in s.flags + s.kind in {skProc, skFunc} and sfCompileTime in s.flags proc isRunnableExamples*(n: PNode): bool = # Templates and generics don't perform symbol lookups. diff --git a/compiler/semcall.nim b/compiler/semcall.nim index 405de52ee..0d8f0ae8b 100644 --- a/compiler/semcall.nim +++ b/compiler/semcall.nim @@ -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): |