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

Cannot cast untyped bool to integer #3981

Open
GoldenbergDaniel opened this issue Jul 25, 2024 · 1 comment
Open

Cannot cast untyped bool to integer #3981

GoldenbergDaniel opened this issue Jul 25, 2024 · 1 comment

Comments

@GoldenbergDaniel
Copy link

Context

Odin: dev-2024-07:b4ca044ae
OS: macOS Sonoma 14 (build: 23A344, kernel: 23.0.0)
CPU: Intel(R) Core(TM) i5-8257U CPU @ 1.40GHz
RAM: 8192 MiB
Backend: LLVM 18.1.7

Expected Behavior

Should be able to cast an untyped boolean expression to an integer.

Current Behavior

  1. int(2 < 1) == 0 // Error: Cannot cast '2 < 1' as 'int' from 'untyped bool'
  2. int(true) == 0 // Error: Cannot cast 'true' as 'int' from 'untyped bool'
  3. int(my_bool) == 0 // Success
@GoldenbergDaniel GoldenbergDaniel changed the title Cannot cast to untyped bool to integer Cannot cast untyped bool to integer Jul 25, 2024
@laytan
Copy link
Sponsor Collaborator

laytan commented Aug 11, 2024

@gingerBill seems to have explicitly disabled this in 3fc6093 , assigning to him for clarity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants