Closed quantimnot closed 1 year ago
It's a compiler bug:
proc hgjhgjhgjhg(a: Option[seq[string]], b: seq[string]): bool = discard
type
StrSeq = seq[string]
B = object
c: Option[StrSeq]
D = Option[StrSeq]
macro a(t: typedesc) =
doAssert t.getType.getTypeInst[1].kind == nnkSym
macro b(t: typedesc) =
doAssert t.getType[1].getType[2].children.toSeq[0].getTypeInst[1].kind == nnkSym
a D
b B
Even if this is a compiler bug, it affects NimYAML and therefore the issue should be kept open – there could exist a workaround that can be implemented in NimYAML.
Can you link an issue of the Nim compiler describing this bug?
Nim issue: https://github.com/nim-lang/Nim/issues/19042
Suddenly getting this error, even though all code worked before with the version I had used. Now, no version of NimYAML works anymore, because I always encounter this issue. Tried several commits from the past 3 months, I always end up at this error. A few commits cause additional issues, but these come before this one, so in the end, this is the biggest culprit.
How can I avoid this, without forking this project or tampering with the source code in the Nimble folder?
Ideally, I just want to nimble install
this & have it work, just as before.
Error started happening, after I added another {.sparse.}
object, but this does not make sense, because I already had another sparse object & it worked fine!
@flyx
You ARE truly amazing! ❤️ 😍
THANK YOU
Thanks @theAkito, your comment on the Nim issue made me realize this can be fixed in NimYAML.
The type alias problem was simply a symptom of the real problem, which was that NimYAML wasn't able to process generic type instances in Option[…]
. I pushed a fix and did some testing, the code shown in this issue now works. Can you confirm this fixes your problem as well (via pulling yaml@#head
)? If so I will release a bugfix version.
Can you confirm this fixes your problem as well (via pulling
yaml@#head
)? If so I will release a bugfix version.
Of course, will do, still today, but unfortunately not right now. Will return here ASAP!!
@flyx
Works beautifully!
Thank you very much! ❤️
I ran into this bug. I think it may be a bug in the compiler, but I wanted to check with you first. Have you seen this before? Any clue?
It exist in many compiler versions back to 0.14.0.
fType[1].kind == nnkSym
returnsnnkBracketExpr
in:Simplified Example:
Current Output: