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

type of numeric literal is not inferred with ternary operator #3969

Open
simonvonhackewitz opened this issue Oct 18, 2024 · 0 comments
Open

Comments

@simonvonhackewitz
Copy link
Contributor

> FUZION_DISABLE_ANSI_ESCAPES=true fz -e 'x i64 := true ? 1 : 0; say x'

command line:1:1: error 1: Incompatible types in assignment
x i64 := true ? 1 : 0; say x
^
assignment to field : 'x'
expected formal type: 'i64'
actual type found   : 'i32'
assignable to       : 'i32'
for value assigned  : ''
To solve this, you could convert the value using + '.as_i64'.

one error.

For if this works

> FUZION_DISABLE_ANSI_ESCAPES=true fz -e 'x i64 := {if true then 1 else 0}; say x'
1
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