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

lang: Handle const array size casting and add const array size support for events #1485

Merged
merged 16 commits into from
Mar 11, 2022

Conversation

tomlinton
Copy link
Contributor

Closes #1476
Closes #1357

@tomlinton tomlinton changed the title lang: Handle const array size casting and add const array size support for events WIP lang: Handle const array size casting and add const array size support for events Feb 21, 2022
@tomlinton tomlinton marked this pull request as ready for review February 21, 2022 21:58
@tomlinton tomlinton changed the title WIP lang: Handle const array size casting and add const array size support for events lang: Handle const array size casting and add const array size support for events Feb 21, 2022
_ => false,
}) {
let size_string = format!("{}]", &constant.ident.to_string());
let cast_size_string = format!("{} as usize]", &constant.ident.to_string());
Copy link
Contributor

Choose a reason for hiding this comment

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

wdyt about removing the whitespace here and in tts_string and then comparing those instead? would really suck to debug an error that's caused by an additional whitespace between as and usize

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No sympathy for people who don't use code formatters. 😈

I think it's an unlikely case but I'll add it if you like. Regex would probably have fewer edge cases but adding that seems a bit over the top.

Copy link
Contributor

Choose a reason for hiding this comment

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

some people run their formatters before they commit and not during coding. still unlikely that it even happens but doesnt hurt to add it

agree that regex seems over the top

@paul-schaaf paul-schaaf merged commit 2529b06 into coral-xyz:master Mar 11, 2022
@paul-schaaf
Copy link
Contributor

tyvm!

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.

lang: Arrays with variable as length and casting fail IDL parsing Constants aren't supported in event IDL
2 participants