I have this code snippet:
mainLoop = \x ->
_ <- Stdout.line "hello \(Num.toStr x)" |> Task.await
if x == 3 then
Task.ok {}
else
mainLoop (x + 1)
main =
mainLoop 0
roc check
passes without issues. But when I build, roc gives me this error I can't understand:
thread 'main' panicked at 'Error in alias analysis: error in module ModName("UserApp"), function definition FuncName("\x13\x00\x00\x00\x02\x00\x00\x00\x94B\xe9\x05\x0em\x9a\x1e"), definition of value binding ValueId(3): could not find func in module ModName("UserApp") with name FuncName("\'\x00\x00\x00\x04\x00\x00\x00\x94B\xe9\x05\x0em\x9a\x1e")', crates/compiler/gen_llvm/src/llvm/build.rs:5744:19
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
turning on backtrace also doesn't give me any useful info. Did I miss anything here?
Not sure if it will be a fix at all, but try using Task.loop
Currently there are definitely some bugs with recursive tasks and I think Task.loop
tends to work around them.
yeah Task.loop
works. Surprised with the manual loop though. Seems like a known issue. Is this tracked already?
Yes, in #5701, it's hard to debug unfortunately.
Thanks!
Steven Chen has marked this topic as resolved.
Last updated: Jul 06 2025 at 12:14 UTC