Types & data

Field access needs a single variant

Dot into a record and you get its field — the easy case, because a record has exactly one shape:

A union is different: which fields exist depends on which variant you’re holding. So Ascent won’t let you dot straight in — you open it with match first:

Try r.width instead and Ascent explains why it can’t: Shape has more than one variant, so there’s no single set of fields to read directly. match is how you ask “which one is it?” and get that variant’s fields safely.