Skip to content
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

results.Opt as object fields could generate codegen issues #142

Closed
cheatfate opened this issue Sep 21, 2022 · 3 comments
Closed

results.Opt as object fields could generate codegen issues #142

cheatfate opened this issue Sep 21, 2022 · 3 comments

Comments

@cheatfate
Copy link
Contributor

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
Copy link

deech commented Oct 29, 2022

Seems like a bug in Nim itself

@deech
Copy link

deech commented Nov 9, 2022

nim-lang/Nim#20790 should fix it.

@arnetheduck
Copy link
Member

This is fixed both by #150 and upstream fixes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants