mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 22:10:33 +00:00
Revert "Look up generic parameters when found inside semOverloadedCall, fixin… (#23054)"
This reverts commit 54bd380011.
This commit is contained in:
@@ -49,19 +49,6 @@ 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:
|
||||
initCandidate(c, best, result[0].s, initialBinding,
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
proc consumer[T: static proc(i: int): int{.nimcall.}](i: int): int = T(i)
|
||||
proc addIt(i: int): int = i + i
|
||||
proc squareIt(i: int): int = i * i
|
||||
|
||||
assert consumer[addIt](10) == 20
|
||||
assert consumer[squareIt](30) == 900
|
||||
assert consumer[proc(i: int): int{.nimcall.} = i * i + i](10) == 110
|
||||
|
||||
|
||||
Reference in New Issue
Block a user