-
-
Notifications
You must be signed in to change notification settings - Fork 115
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
feat(compiler): Allow arrays to do binary operation assignment #1928
feat(compiler): Allow arrays to do binary operation assignment #1928
Conversation
Hey @renatoalencar! Apologies for the late response. This mostly looks good—would you mind adding a couple of tests for this? |
Sure, no problem. I'll add another tests, I'm not sure what would be nice to cover. |
I realized that we don't really have any tests that currently directly test regular binary assignments in the suite. Maybe some simple tests that just make sure we don't break it in the future; maybe one for each operator in https://github.com/grain-lang/grain/blob/d747d541dab3e2437c33fe224a92843f1027a226/compiler/test/suites/arrays.re. |
e8496ca
to
12b93bc
Compare
@ospencer can you help @renatoalencar with the parser exhaustiveness errors here? |
Done. This will also need support in the formatter, but I would wait for #1976 to land before attempting that. |
@ospencer does that mean you want to hold this PR or just open a follow up issue? |
We can open an issue. |
I was about to get into Discord to ask for help on this |
Feel free to join us there! 😄 |
Closes #1915
Following the same semantics as record set, array accesses should allow to make use of shorthand binary operation assignments like
+=
.arr[0] += 1
currently throws a syntax error, this should fix it.