Skip to content

Compiler runs out of memory with range type in object #56

@PMunch

Description

@PMunch

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions