Unchained
Unchained copied to clipboard
Compiler runs out of memory with range type in object
With the recently added range types I tried something similar to this:
import unchained
type
Test = object
r: range[0.0..1.0]
let t = Test(r: 0.8)
proc test(x: Test, distance: Meter) =
distance * x.r
test(100.m)
When the compiler tries to compile this it starts hogging CPU and runs until memory is depleted. Passing a range directly via the function works as expected. I'm guessing it's not able to properly find the type of x.r and instead ends up in an infinite recursion.