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

Collection expression not supported #1062

Closed
adrian-fjellberg opened this issue Jun 25, 2024 · 2 comments · Fixed by #1063
Closed

Collection expression not supported #1062

adrian-fjellberg opened this issue Jun 25, 2024 · 2 comments · Fixed by #1063
Assignees

Comments

@adrian-fjellberg
Copy link

I tried using a collection expression when setting the storage prefixes, but the Neo compiler does not support that properly, thus throwing a "Specified cast invalid" at runtime.

// Does NOT work:
private static readonly byte[] TreeByteLengthPrefix = [0x01, 0x03];

// Works:
private static readonly byte[] TreeByteLengthPrefix = new byte[] {0x01, 0x03};

I think it should either be supported or give a warning/error at compile time, as it was frustrating to debug.

PS: While looking in the C# Language Specification Support issue #819 , I could not find the collection expression support listed. I think collection expressions were introduced in C# 12.

@Jim8y Jim8y self-assigned this Jun 25, 2024
@Jim8y
Copy link
Contributor

Jim8y commented Jun 25, 2024

This should have being supported, I will check the problem.

@adrian-fjellberg
Copy link
Author

Ok. Thanks :)

Jim8y added a commit to Jim8y/neo-devpack-dotnet that referenced this issue Jun 25, 2024
Jim8y added a commit that referenced this issue Jun 27, 2024
* fix #1062

* fix convert

* update artifact

* Apply suggestions from code review

---------

Co-authored-by: Shargon <[email protected]>
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 a pull request may close this issue.

2 participants