cddl-codegen icon indicating copy to clipboard operation
cddl-codegen copied to clipboard

@name with explicit basic group in group choice generates non-compiling code

Open rooooooooob opened this issue 1 year ago • 0 comments

basic = (text, uint)

choice = [
  ; @name foo
  basic //
  ; @name bar
  uint, basic
]

will generate Self::Foo(Foo::new(...)) instead of Self::Foo(Basic::new(...)) which won't compile as there is no struct Foo, only the enum variant.

The second case Bar works as intended as would Foo if it were defined inline or if @name was not used.

rooooooooob avatar Apr 11 '24 20:04 rooooooooob