Skip to content

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

Description

@MeteorsLiu

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 e6156d3 (PR #2102) as the first bad mainline commit. All five cases pass at its parent 4230b92 and fail at e6156d3.

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions