cue/ast/astutil: add test coverage for redeclared alias errors
TestResolve previously walked the AST and printed identifier
resolutions but discarded any errors emitted by astutil.Resolve. Add
an "errors" output section so each txtar can assert the diagnostics
produced for the files it covers, using errors.Print with the test's
Cwd so paths stay repo-relative.
Add a new redeclared.txtar that pins down the scenarios in which an
alias clashes with another alias or with a regular field of the same
name: old-style label aliases, postfix single-form, postfix dual-form
field reference (V), let clauses, and alias/field name clashes. The
suite also includes the postfix dual-form label-name capture (K) case
from the issue, which silently swallows the redeclaration today; the
file carries an inline TODO so the missing diagnostic is visible and
will surface as a golden diff once fixed.
import.txtar records the long-standing "no cue.mod/module.cue" error
that the harness previously hid, and postfix.txtar gains an
@experiment(aliasv2) attribute on each file so its experiment-gate
errors no longer leak into the new errors output.
Updates #4342.
Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
Change-Id: I99b5956342b9d2a5b005f7caf56befc881912ddf
Reviewed-on: https://cue.gerrithub.io/c/cue-lang/cue/+/1236312
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
Reviewed-by: Marcel van Lohuizen <mpvl@gmail.com>