dcSpark/cddl-codegen

@name not applied with single-field group choices

rooooooooob opened this issue · 1 comments

Works (first variant named These, 4th Nameable):

group_choice = [
  ; @name these
  2, foo //
  ; @name nameable
  3, basic
]

First variant does not get named These, 4th not Nameable:

group_choice = [
  ; @name these
  foo //
  ; @name nameable
  basic
]

foo is an array group and basic a basic group so that shouldn't be relevant.

Extra context:

fields with fixed values have it properly applied even if there's only 1 non-fixed variant e.g.:

group_choice = [
  ; @name these
  foo //
  ; if there is only one non-constant field in the inlined group then that will be inlined in the enum
  ; @name are
  0, x: uint //
  ; but if there are multiple then a new struct will be generated from this variant
  ; @name also
  1, x: uint, y: text //
  ; basic groups can be embedded into group choices, taking on the format of the outer group
  ; @name nameable
  basic
]

has the Are variant properly have its named applied despite it inlining the uint field.