diff options
author | Jason Beetham <beefers331@gmail.com> | 2023-12-12 01:06:13 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-12 09:06:13 +0100 |
commit | 8cc3c774c8925c3d21626d09b41ad352bd898e4a (patch) | |
tree | 7d9d4576e4c00cb3dc22fff8504f48a94a26d6e2 /compiler | |
parent | cf4cef498489f1dbbb3dea287e88a9a0d820e8b7 (diff) | |
download | Nim-8cc3c774c8925c3d21626d09b41ad352bd898e4a.tar.gz |
Look up generic parameters when found inside semOverloadedCall, fixin… (#23054)
…g static procs --------- Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/semcall.nim | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/compiler/semcall.nim b/compiler/semcall.nim index 2c1939c3c..26a40b4dc 100644 --- a/compiler/semcall.nim +++ b/compiler/semcall.nim @@ -49,6 +49,19 @@ proc initCandidateSymbols(c: PContext, headSymbol: PNode, while symx != nil: if symx.kind in filter: result.add((symx, o.lastOverloadScope)) + elif symx.kind == skGenericParam: + #[ + This code handles looking up a generic parameter when it's a static callable. + For instance: + proc name[T: static proc()]() = T() + name[proc() = echo"hello"]() + ]# + for paramSym in searchInScopesAllCandidatesFilterBy(c, symx.name, {skConst}): + let paramTyp = paramSym.typ + if paramTyp.n.sym.kind in filter: + result.add((paramTyp.n.sym, o.lastOverloadScope)) + + symx = nextOverloadIter(o, c, headSymbol) if result.len > 0: best = initCandidate(c, result[0].s, initialBinding, |