mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-07 21:43:33 +00:00
don't mark captured field sym in template as fully used (#24660)
fixes #24657
(cherry picked from commit 647c6687f1)
This commit is contained in:
@@ -67,7 +67,12 @@ proc symChoice(c: PContext, n: PNode, s: PSym, r: TSymChoiceRule;
|
||||
# for instance 'nextTry' is both in tables.nim and astalgo.nim ...
|
||||
if not isField or sfGenSym notin s.flags:
|
||||
result = newSymNode(s, info)
|
||||
markUsed(c, info, s)
|
||||
if isField:
|
||||
# possibly not final field sym
|
||||
incl(s.flags, sfUsed)
|
||||
markOwnerModuleAsUsed(c, s)
|
||||
else:
|
||||
markUsed(c, info, s)
|
||||
onUse(info, s)
|
||||
else:
|
||||
result = n
|
||||
|
||||
9
tests/template/tfielduse.nim
Normal file
9
tests/template/tfielduse.nim
Normal file
@@ -0,0 +1,9 @@
|
||||
# issue #24657
|
||||
|
||||
proc g() {.error.} = discard
|
||||
|
||||
type T = object
|
||||
g: int
|
||||
|
||||
template B(): untyped = typeof(T.g)
|
||||
type _ = B()
|
||||
Reference in New Issue
Block a user