Semantic Diff

#8952 Document the rules of untagged variants, with tests pinning them

3 commits

5de48e6e3a48290f1d583a0314a13c057b02bd38..pr-8952

04e89625f · Cristiano Calcagno with Claude Opus 5.5 · Oct 22, 2026

Document the rules of untagged variants, with tests pinning them

Why

The rules of untagged variants (payload kinds, run-time recognition, well-formedness, option and @notUndefined, @as and @tag) are stated once, each with the code that implements it and a test that pins it, so a change to them reads as a diff to this statement.

compiler/ml/UntaggedVariants.md states 14 rules, the known bugs observed on this tree, and the open questions for recognizing payloads by declared class or typeof kind. untagged_variants_spec_test.res asserts which case each value lands in; two super_errors fixtures cover the string-case limit and duplicate literals in a tagged variant.

eb22c7d68 · Christoph Knittel with Claude Opus 5.5 · Oct 22, 2026

Keep the non-integral number assertion from folding

The Codex review on #8952 found that intOrStringName(raw(1.5)) was constant-folded to "int", so the test passed without dispatching at run time; the value now goes through the non-inlined id first.

ccbdf61e9 · Christoph Knittel with Claude Opus 5.5 · Oct 22, 2026

Distinguish record payloads in the option table

The Codex review on #8952 found that the rule 12 table said no record holds undefined, while an @unboxed record and a one-field inline record take the answer from their field; the table and rule 12's tests now cover each record shape.