Issue #1001: Grammar: a group of alternatives whose branches yield different types reaches rustc

Open and answer this issue on GitHub.

ready · opened 2026-10-30 · updated 2026-10-30 · 0 comments

Found by the yaml lane (y1-tree-core, #928).

rule Fs = (" " | "#" until("\n"))* -> { }

rustc: expected Result<(&str, &str)>, found Result<&str>. Same with a unit rule in place of the sequence. The checker should either unify the branches (their values are unused) or refuse with an NK error; it must not reach rustc.

To build

  1. The lowering discards branch values of a group whose value is unused (or the checker refuses mixed branch types where the value is used).
  2. A test in tests/compiler/tests/grammar_*.nika.

Back to Open Issues