-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Static arrays. #424
Static arrays. #424
Conversation
Could you not increase the gas used in tests? This is outside of consensus, so there's no real downside to putting an insane gas limit. |
Yeah, though not on a per test basis, I think. But we could... I'm just saying that right now very large (MBs) arrays are very expensive, even just to instantiate. Rather than initialise every element individually for |
Yeah that MCP optimization makes sense. But either way we can basically use infinite gas for tests right now if we'd like. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, will re-approve after the latest version of master is merged in
Also add a new test using arrays and type parameters.
`unify()` takes a and b types, where b is the expected type (as per the error message) and this was reversed for annotated expressions.
Here's an initial implementation of static arrays. This has taken me a while and it's arguably not yet finished but I want to get this going sooner rather than later.
The basics work -- declaring both
[1, 2, 3]
or[false; 3]
style initialisers, indexing with au64
index, type checking everywhere, arrays of arrays, arrays of structs, etc.But there's still some work:
a[0][1]
to be(a[0])[1]
.Index
trait (or at leastmy_type.index(arg)
formy_type[arg]
) is invoked but not at all implemented yet.MCP
could do it all at once.RVRT
on failure) whether it needs it or not.The first one could be fixed fairly easily, I just wanted to get on with it, working with Pest sucks.
The next two are non-trivial, we can tackle them when they're needed, which maybe now, IDK.
The code generation can be fixed with The Magic Of IR 🪄 -- as I was writing all the code gen code I was thinking, 'dammit, we're going to have to write all this again, except better'. But that's OK. The point of IR is to make that sort of thing relatively easy.