results.Opt as object fields could generate codegen issues
Closed this issue · 3 comments
cheatfate commented
All Nim versions are affected
#141
import stew/results
type
ValidatorSig = object
blob: array[96, byte]
SyncDutyAndProof = object
slotSig: Opt[ValidatorSig]
const
DefaultSyncDutyAndProof =
SyncDutyAndProof(slotSig: Opt.none(ValidatorSig))
echo DefaultSyncDutyAndProof
/home/runner/.cache/nim/all_tests_d/@mtest_results.nim.c:974:143: error: ‘union <anonymous>’ has no member named ‘_o_1’; did you mean ‘_o_2’?
N_LIB_PRIVATE NIM_CONST tyObject_SyncDutyAndProof__9atwCZvu9aDnhulGNwFXJ9cFg DefaultSyncDutyAndProof__qmlenLhfD5mHF063hF585Q = {{NIM_FALSE, {._o_1 = {}}}
^~~~
_o_2
deech commented
Seems like a bug in Nim itself
deech commented
nim-lang/Nim#20790 should fix it.
arnetheduck commented
This is fixed both by #150 and upstream fixes