Open Feliix42 opened 5 years ago
Funky. Would it surprise you to hear, that the lambda is actually not the problem?
It seems y
gets inlined, but only into the first if
branch, not the second one.
This is the code it actually produces
let x_0 = calculations/generate_value ()
in let z_0 = calculations/check_if_to_run ()
in let b =
ohua.lang/if z_0
(λ __1 ->
let d_0 = calculations/generate_data () in let a = calculations/calculate d_0 x_0 in a)
(λ __2 -> let c = ohua.lang/id y_0 in c)
in b
This is because inlining an expression also removes its original binding site. I will have to do some investigating into how that can be changed to actually work correctly. I had a similar issue recently actually so I think this is a bit bigger than just this bug
BTW: if you insert the line let y2 = y
and then return y2
from the else
branch it also compiles correctly :joy:
When trying to compile the following snippet
ohuac
(v0.2.0) yields the following error:When writing
y
instead off(y)
, the algorithm compiles.I guess this is a bug?