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

Should we allow bit-select on/with Bool() type? #2946

Open
mwachs5 opened this issue Jan 22, 2023 · 2 comments
Open

Should we allow bit-select on/with Bool() type? #2946

mwachs5 opened this issue Jan 22, 2023 · 2 comments

Comments

@mwachs5
Copy link
Contributor

mwachs5 commented Jan 22, 2023

Type of issue: Feature Request

Is your feature request related to a problem? Please describe.

It is nonintuitive what it is supposed to mean if you have a Bool type and do a bit-select on it (which is apparently allowed even if the thing you are bit-selecting with is a boolean!). IN fact it is strange that we allow a Bool to be the selector too.

Describe the solution you'd like

It would make more sense if it were a compile or runtime error to do a bitselect on a Bool type or a bitSelect where the selector is a Bool type.

Describe alternatives you've considered

Leave things as they are

Additional context

https://scastie.scala-lang.org/HU5nisSDQR6g35rO66Nzhg

What is the use case for implementing this feature?

What is the use case for allowing this?

@ingallsj
Copy link
Contributor

What is the use case for implementing this feature?

Catching bugs at compile time instead of silently allowing them.

@mwachs5
Copy link
Contributor Author

mwachs5 commented Feb 17, 2023

I think that making this a compile time error will be a heavy lift, but I think we can focus on a shorter-term runtime error/warning solution

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

2 participants