Open tersec opened 1 month ago
Simplified:
# a.nim
import "."/b
s[int]()
# b.nim
import "."/c
type K = object
lex: V
proc s*[T]() =
var r: K
x(r.lex)
# c.nim
type
U* = enum
errNone
V* = object
err: U
template x*(lex: V) {.dirty.} =
lex.err = errNone
Removing the lex: V
parameter from x
gives no error, but changing lex.err =
to let y =
or errNone
to a const
instead of an enum symbol gives the same error on 2.0. dirty
doesn't bind anything by default, so errNone
was never accessible as a symbol through lookup.
So this very likely fails now because of #23588, which again, means this only worked since errNone
is specifically an enum member in a context where its type can be inferred. I don't know if it's worth making this specific case work by adding back awkward behavior to the compiler. Is it too much of a problem to either bind errNone
or not use dirty
here?
We need the dirty
template because sometimes we pass in statement such as return
. But using bind
also works.
To the extent https://github.com/status-im/nim-json-serialization/pull/90 solves this, I'm fine with that. I reported this as a regression fairly mechanically, not so much prescriptively as descriptively. But I tend to agree it accidentally hit a weird edge case.
Description
a.nim
b.nim
c.nim
Nim Version
Compiles:
Does not compile:
Current Output
Expected Output
No response
Possible Solution
No response
Additional Information
No response