-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: var a{.foo.} = expr
inside templates (refs #15920) (except when foo
is overloaded)
#13869
Conversation
n.kind == nkConstSection and w in constPragmas: | ||
return nil | ||
sym = searchInScopes(c, ident) | ||
# CHECKME: should that test also apply to `nkSym` case? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left for future work, I want to get this fix in first (keeping this comment as unresolved)
Don't forget the |
var a{.foo.} = expr
inside templatesvar a{.foo.} = expr
inside templates
@Araq please don't merge this yet, there's 1 more important thing missing that I fixed but I haven't pushed yet; if urgent, i'll do that tmrw |
Well it's not "urgent" but regression fixes should have some priority. :-) |
522bbad
to
9ba702c
Compare
@Araq PTAL, I've improved test coverage, and added disabled tests for cases that don't work yet (see "future work" in top post, plus tests in this PR)
but it's not a regression, this never worked before |
var a{.foo.} = expr
inside templatesvar a{.foo.} = expr
inside templates (refs #15920) (except when foo
is overloaded)
I've reduced the single failure in important_packages (docopt) down to this: when true:
import macros # defines `proc genSym` symbol
template fn() =
var ret {.gensym.}: int
discard ret
fn() => needs fixing before this can be merged EDIT: now fixed |
934850b
to
757402e
Compare
adfd352
to
b490ce1
Compare
@Araq PTAL, I've revisited this PR and fixed the blocker |
var found = false | ||
if ni.kind == nkIdent: | ||
for a in templatePragmas: | ||
if ni.ident == getIdent(c.c.cache, $a): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a hack IMO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see test case labeled D20210801T100514
…cept when `foo` is overloaded) (nim-lang#13869) * fix: `var a{.foo.} = expr` inside templates * add test * improve tdecls test * improve tests * add failing test * PRTEMP * fixup
fixes partially #15920
(WAS: timotheecour#89)
future work
byaddr
unless that symbol is overloaded)var b {.byaddr.} = expr
#13508 (comment)we should handle
nkOpenSymChoice