Skip to content

Conversation

@giacomocavalieri
Copy link
Contributor

@giacomocavalieri giacomocavalieri commented Apr 6, 2024

The decoder for custom types on the Erlang side didn't take into account variants with no fields: variants with fields are encoded as a tuple {variant_name, field_1, ..., field_n}; however, variants with no fields are encoded as a single atom: variant_name.

In my previous implementation I only checked is_tuple and didn't take into account that even a single atom could be a valid variant.
I've added the missing case and a regression test!

This PR closes #2

@MystPi
Copy link
Owner

MystPi commented Apr 6, 2024

You rock! 😍

@MystPi MystPi merged commit 8f7b16e into MystPi:master Apr 6, 2024
@giacomocavalieri giacomocavalieri deleted the fix-2 branch April 6, 2024 12:49
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

Successfully merging this pull request may close these issues.

Decoder decodes custom types with no fields as foreign types on the Erlang target

2 participants