Getting unexpected results from:
app [main!] { pf: platform "../roc/test/fx/platform/main.roc" }
import pf.Stdout
main! = || {
result = sum_lambda(2400)
dbg result
Stdout.line!("Stdout: ${result.to_str()}")
}
sum_lambda : U64 -> U64
sum_lambda = |num| sum(num)
# sum : U64 -> U64
sum = |num| {
0 + num
}
Output:
ROC DBG: 2400
Stdout: 1923270417758289920
Works correctly when I comment out the sum_lambda type:
ROC DBG: 2400
Stdout: 2400.0
and also when I uncomment the type of sum:
ROC DBG: 2400
Stdout: 2400
I can see the same problem for all number types - except Dec.
Using current "Roc compiler version debug-9a5eb3c9"
I think it's a double decref bug -- is my guess
Hopefully my current patches will resolve this class of bugs more generally
Or maybe there is something going funny with the type annotation
I can look into it after Luke's stuff lands
Last updated: Dec 21 2025 at 12:15 UTC