If we assign to a variable using an if expression, and use this in another if expression (condition), the type system fails to check.
Same holds for if expression used as a for loop collection.
How to Reproduce
When running the following
def d := if a then b else c
def e := if d then b else c
Gives the following
Error: Cannot infer type. Expected a Bool, was `if`.__bool__(`if`)
--> ...
1 | def d := if a then b else c
2 | def e := if d then b else c
^
Description of Bug
If we assign to a variable using an if expression, and use this in another if expression (condition), the type system fails to check. Same holds for if expression used as a for loop collection.
How to Reproduce
When running the following
Gives the following
Expected behavior
It should pass since this is well typed.