test/goroot: #2102 diagnostic normalization regresses five Go 1.26 errorcheck cases

Open
#2,285 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
74/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Domain
compilers, testing

Research direction

Start in the test/goroot errorcheck runner and reproduce the five fixedbugs cases with the provided Go 1.26 GOROOT command. Compare the current behavior with issue31053 and PR #2102; done means the original diagnostics match first, the normalized spelling remains a fallback, and all six cases pass.

Written by the indexing model from the issue text.

Description

Summary

PR #2102 added GOROOT-only go/types diagnostic normalization for its intended loader frontend cases. The normalization runs before ERROR matching and replaces the original diagnostic text unconditionally.

This regresses five unrelated Go 1.26 errorcheck cases whose raw LLGo diagnostics already match their upstream ERROR expressions:

  • fixedbugs/issue17631.go
  • fixedbugs/issue19482.go
  • fixedbugs/issue22794.go
  • fixedbugs/issue24339.go
  • fixedbugs/issue25727.go

Evidence

A first-parent bisect using Go 1.26.5 identifies merge commit e6156d3c (PR #2102) as the first bad mainline commit. All five cases pass at its parent 4230b922 and fail at e6156d3c.

Running the current LLGo compiler directly, before the GOROOT runner normalizes output, produces diagnostics such as:

unknown field updates in struct literal of type ...
unknown field _ in struct literal of type T
i1.floats undefined (... but does have field Floats)
unknown field foo in struct literal of type struct{}
unknown field DoneChan in struct literal of type http.Server

These forms match the corresponding upstream ERROR expressions. The #2102 normalization changes them before matching, for example:

unknown field foo
-> unknown field 'foo'

but does have field Floats
-> but does have Floats

The runner then reports no match even though the original compiler diagnostic was acceptable.

The normalization remains necessary for the original #2102 cross-package case fixedbugs/issue31053.dir/main.go, whose ERROR expressions require the alternate quoted wording. Removing the normalization entirely would regress that case.

Reproduction

With a Go 1.26 GOROOT that includes GOROOT/test:

GOMAXPROCS=2 go test -p=1 ./test/goroot -count=1 -timeout=30m -args \
  -goroot "$(go env GOROOT)" \
  -directive-mode coverage \
  -directives errorcheck \
  -case '^fixedbugs/(issue17631|issue19482|issue22794|issue24339|issue25727)\.go$'

Expected behavior

Try the original diagnostic against the upstream ERROR expression first. Only use the #2102 normalized spelling as a fallback when the original text does not match.

This preserves issue31053 while restoring the five cases above.

Test gap

At the time #2102 merged, the GOROOT workflow used directive-mode ci, which covered run, runoutput, and buildrun but not errorcheck. The focused #2102 validation covered its five intended cases and did not include these five incidental regressions.

Dominant language
LLVM
Stars
758
Forks
49
Avg merge
1d 6h
Merged PRs (30d)
138

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from xgo-dev/llgo

All issues in xgo-dev/llgo

Similar issues

More Compilers issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.