Skip to content

Panic: instantiation record field access encountered a recursive named backing #10195

Description

@jwoudenberg

A reasonable failure when working with nominal records, but a type error would be nicer :).

Minimal example:

# Wrap.roc
expect Wrap.{ a: 1, b: 0 }.inc_a() == Wrap.{ a: 2, b: 0 }

Wrap :: { a : U8, b : U8 }.{
	inc_a : Wrap -> Wrap

	inc_a = |wrap| Wrap.{ ..wrap, a: wrap.a + 1 }
}

Running roc test Wrap.roc yields:

thread 962727 panic: postcheck invariant violated: instantiation record field access encountered a recursive named backing

Easily fixed by either of these implementations of inc_a, so definitely not blocking me:

inc_a = |Wrap.(wrap)| Wrap.{ ..wrap, a: wrap.a + 1 }
inc_a = |wrap| { ..wrap, a: wrap.a + 1 }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions