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

Fix issue with overlapping inlined basic embedded enums #228

Merged
merged 4 commits into from
May 18, 2024

Conversation

rooooooooob
Copy link
Collaborator

@rooooooooob rooooooooob commented Apr 9, 2024

Caused when the inlining would made cddl-codegen think that the types were not overlapping since it was looking at the stored type not the actual starting cbor type (e.g. when it was a fixed value).

This would cause a problem as the type matching introduced in #199 but only in very specific cases with basic groups starting with fixed values.

Various other fixes + more test cases:

Fixes #229
Fixes #230
Fixes #231
Fixes #232

Caused when the inlining would made cddl-codegen think that the types
were not overlapping since it was looking at the stored type not the
actual starting cbor type (e.g. when it was a fixed value).

This would cause a problem as the type matching introduced in #199
but only in very specific cases with basic groups starting with fixed
values.
@rooooooooob rooooooooob marked this pull request as draft April 9, 2024 16:59
Possibly needs more tests covering combinations with non-basic groups
mixed with basic, tagged basic groups and optional fields (should work
though)
@rooooooooob rooooooooob marked this pull request as ready for review April 23, 2024 01:56
@rooooooooob
Copy link
Collaborator Author

This one isn't related to the plutus datum tool but it's been open for a while. One of the issues fixes an issue with CML re-generation for the Nonce type which was that block that wasn't parsing last month.

}
_ => RustStructCBORLen::Fixed(1),
};
// this will never be 1 line to don't bother with the below cases
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure I understand what this comment means. Maybe to was meant to be so?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Fixed.

@@ -1310,6 +1310,7 @@ impl RustType {
}],
ConceptualRustType::Primitive(p) => p.cbor_types(),
ConceptualRustType::Rust(ident) => {
eprintln!("{ident:?}");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to leave in these two eprintln?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

@rooooooooob rooooooooob merged commit d7c8e19 into master May 18, 2024
1 check passed
@SebastienGllmt SebastienGllmt deleted the overlap-embed-fix branch May 18, 2024 01:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment