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

Reconsidering the priority of bitwise operator and comparative operator #1383

Open
KCN-judu opened this issue Dec 29, 2024 · 2 comments
Open

Comments

@KCN-judu
Copy link
Contributor

operator & does not have a higher priority than operator ==
e.g.

fn is_odd(n: Int){
  n & 1 == 1
}

this will raise a "expr type mismatch".

but it works like this
e.g.

fn is_odd(n: Int){
  (n & 1) == 1
}
@Lampese
Copy link
Collaborator

Lampese commented Dec 30, 2024

But isn't it right?
image

@KCN-judu KCN-judu closed this as not planned Won't fix, can't repro, duplicate, stale Dec 30, 2024
@peter-jerry-ye
Copy link
Collaborator

We may not want to follow the priority of other languages, especially C which doesn't have native boolean cc @Yoorkin

@KCN-judu KCN-judu changed the title Bug: operator & does not have a higher priority than operator == operator & does not have a higher priority than operator == Jan 2, 2025
@KCN-judu KCN-judu reopened this Jan 2, 2025
@KCN-judu KCN-judu changed the title operator & does not have a higher priority than operator == Reconsidering the priority of bitwise operator and comparative operator Jan 3, 2025
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

3 participants