Stream: bugs

Topic: ✔ Nominal unit type constructor fails


view this post on Zulip Jasper Woudenberg (Jun 23 2026 at 08:44):

Something I ran into making a minimal example for another potential bug. The following compiles:

Foo := { attr : U8 }.{
    bar : Foo
    bar = { attr: 12 }
}

But if I take out the attribute the simpler version no longer compiles:

Foo := {}.{
    bar : Foo
    bar = {}
}

I get the following error:

-- TYPE MISMATCH ---------------------------------

This expression is used in an unexpected way:
  ┌─ /home/jasper/dev/jay/Foo.roc:3:8
  │
3 │     bar = {}
  │          ^^

It has the type:

    {}

But the annotation says it should be:

    Foo

view this post on Zulip Anton (Jun 23 2026 at 11:59):

Can you make a github issue for that @Jasper Woudenberg?

view this post on Zulip Jasper Woudenberg (Jun 23 2026 at 12:12):

Sure thing!
https://github.com/roc-lang/roc/issues/9772

I'll mark it as resolved here.

view this post on Zulip Notification Bot (Jun 23 2026 at 12:12):

Jasper Woudenberg has marked this topic as resolved.


Last updated: Jul 23 2026 at 13:15 UTC