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

Unintuitive precedence for unary * and in operators #1905

Open
evantypanski opened this issue Oct 22, 2024 · 0 comments
Open

Unintuitive precedence for unary * and in operators #1905

evantypanski opened this issue Oct 22, 2024 · 0 comments

Comments

@evantypanski
Copy link
Contributor

Given this program:

module Test;

# This works fine
print *begin(b"hi") == 'h';

# This has a `spicyc` compiler error:
# [error] [..] cannot coerce expression 'begin(b"hi")' of type 'iterator<bytes>' to type 'uint<8>'
print *begin(b"hi") in set<uint8>('h', 'i');

# This works again
print (*begin(b"hi")) in set<uint8>('h', 'i');

I get an error on that second print - but I don't see a good case for * to not go first.

It might also get the right precedence but not get validated right, but I haven't looked very deeply yet.

Is this expected? It feels like a bug to me. Should also check other similar cases

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

No branches or pull requests

1 participant