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

Support explicit type on bitdata #315

Open
jtdaugherty opened this issue Mar 21, 2023 · 0 comments
Open

Support explicit type on bitdata #315

jtdaugherty opened this issue Mar 21, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@jtdaugherty
Copy link
Member

bitdata declarations with alternatives currently need to annotate at least one alternative with a type to indicate the width of all of the possible alternatives, e.g.,

bitdata Foo where
  X = 0x01: uint 8
  Y = 0x02: uint 8

This is repetitive and leads to redundant type annotations that Daedalus checks anyway, so if one alternative has a different width, you get an error like

  Mismatched constructor widths
    • constructor X has width 2
    • constructor Y has width 8

This ticket proposes that we instead allow the bitdata head itself to be annotated with a type that is then assigned to all of the alternatives, which then no longer need to be annotated explicitly. @yav and I discussed two possible syntax options:

bitdata Foo as uint 8 where
  ...

bitdata Foo: uint 8 where
  ...
@jtdaugherty jtdaugherty added the enhancement New feature or request label Mar 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant