Skip to content

fix generic local runtime type names#1879

Draft
cpunion wants to merge 2 commits into
xgo-dev:mainfrom
cpunion:codex/goroot-typeparam-coverage
Draft

fix generic local runtime type names#1879
cpunion wants to merge 2 commits into
xgo-dev:mainfrom
cpunion:codex/goroot-typeparam-coverage

Conversation

@cpunion
Copy link
Copy Markdown
Collaborator

@cpunion cpunion commented May 22, 2026

Summary

  • Fix reflected runtime names for nested generic local types by formatting type arguments with reflect-style package paths (command-line-arguments becomes main).
  • Stop adding the local ordinal suffix to the primary instantiated local generic type name while preserving suffixes for local types used as type arguments.
  • Add stable test/go coverage for package and command-line main cases, and remove the now-fixed typeparam/nested.go GOROOT xfails.

GOROOT CI

Full GOROOT CI is disabled for normal PRs (workflow_dispatch only) and is too slow for routine validation. This PR adds test/go coverage so the regression remains covered when GOROOT CI is not running.

A manual GOROOT workflow was dispatched on an upstream branch with the same head SHA because GitHub rejected dispatching refs/pull/1879/head directly: https://github.com/xgo-dev/llgo/actions/runs/26263992315

Targeted GOROOT commands run locally with $(go env GOROOT) = /opt/homebrew/Cellar/go@1.24/1.24.11/libexec:

go test ./test/goroot -run TestGoRoot -count=1 -timeout=10m -args -goroot "$(go env GOROOT)" -dirs typeparam -case '^typeparam/nested\.go$' -xfail /tmp/llgo-no-xfail.yaml -directive-mode legacy
go test ./test/goroot -run TestGoRoot -count=1 -timeout=10m -args -goroot "$(go env GOROOT)" -dirs typeparam -case '^typeparam/nested\.go$' -directive-mode legacy

Tests

go test ./test/go -run 'TestGeneric(LocalRuntimeTypesIncludeOuterArgs|NestedLocalRuntimeTypeNames)' -count=1
go run ./cmd/llgo test -run 'TestGeneric(LocalRuntimeTypesIncludeOuterArgs|NestedLocalRuntimeTypeNames)' ./test/go
go test ./cl -run 'TestGenericLocalTypePatch|TestGenericLocalTypePatchHelperBranches' -count=1
go test ./ssa/abi -count=1
go test ./test/goroot -run TestGoRoot -count=1 -timeout=10m -args -goroot "$(go env GOROOT)" -dirs typeparam -case '^typeparam/nested\.go$' -xfail /tmp/llgo-no-xfail.yaml -directive-mode legacy
go test ./test/goroot -run TestGoRoot -count=1 -timeout=10m -args -goroot "$(go env GOROOT)" -dirs typeparam -case '^typeparam/nested\.go$' -directive-mode legacy
go test ./cl -count=1

@cpunion
Copy link
Copy Markdown
Collaborator Author

cpunion commented May 22, 2026

CI update: branch codex/goroot-typeparam-coverage is present in xgo-dev/llgo; dispatched another manual GOROOT workflow for this head SHA. Run: https://github.com/xgo-dev/llgo/actions/runs/26264734516. Existing earlier run: https://github.com/xgo-dev/llgo/actions/runs/26263992315

@cpunion
Copy link
Copy Markdown
Collaborator Author

cpunion commented May 22, 2026

Correction: per branch policy, the temporary xgo-dev/llgo:codex/goroot-typeparam-coverage ref used for manual workflow dispatch has been deleted. The PR head remains cpunion/llgo:codex/goroot-typeparam-coverage. Normal PR CI remains attached to this draft PR; manual GOROOT workflow_dispatch cannot be run without an upstream ref.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 22, 2026

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@cpunion
Copy link
Copy Markdown
Collaborator Author

cpunion commented May 22, 2026

CI follow-up for #1879:

  • Investigated the two failing jobs. Both failures happened before the branch-specific tests ran:
    • test (macos-latest, 19, 1.24.2, 3) failed while downloading Go: curl: (6) Could not resolve host: go.dev.
    • llgo (ubuntu-latest, 19, 1.24.2) failed while pip was downloading the torch wheel from files.pythonhosted.org: read timeout.
  • No code/test change was needed for these failures; branch head remains 861710e41945854130dfc4b11dbcf14d971684bc.
  • Local validation passed:
    • go test ./cl -run 'TestGenericLocalTypePatch|TestFuncName'
    • go test ./test/go -run 'TestGeneric(LocalRuntimeTypesIncludeOuterArgs|NestedLocalRuntimeTypeNames|NestedLocalRuntimeTypeNamesForCommandLineMain)'
  • Reran the failed CI jobs:

PR remains draft and CI is enabled.

@cpunion
Copy link
Copy Markdown
Collaborator Author

cpunion commented May 24, 2026

Typeparam follow-up update at 8bd8bfe.

What changed:

  • Clarified the remaining typeparam goroot xfail reasons in test/goroot/xfail.yaml.
  • No compiler/runtime code change in this follow-up because the remaining failures reproduced as non-typeparam roots.

Case classification:

  • Covered by the existing PR fix: typeparam/nested.go passes locally with xfail disabled on Go 1.24.11 and Go 1.25.7.
  • Left xfailed, not mixed into this PR: typeparam/chans.go and typeparam/orderedmap.go reproduce as a non-generic select/unbuffered-channel issue.
  • Left xfailed, not mixed into this PR: typeparam/issue51521.go and typeparam/mdempsky/16.go reproduce as a non-generic nil-deref panic value not implementing error/runtime.Error.
  • Left xfailed, not mixed into this PR: typeparam/mdempsky/15.go reproduces as //go:nointerface methods still satisfying interfaces, including a non-generic reduced case.
  • Left xfailed, not mixed into this PR: typeparam/typeswitch5.go has the expected type-switch behavior, but differs only in println float exponent formatting (+9.000000e+00 vs +9.000000e+000).

Validation run locally:

  • go test ./test/goroot -run 'Test.*XFail|Test.*Runner|TestGoRootRunCases' -count=1
  • go test ./test/go -count=1
  • go test ./cl -run 'TestGenericLocalTypePatchHelpers|TestGenericLocalTypePatchHelperBranches|TestFuncName_NestedClosureInMethodIncludesRecv|TestFuncName_TopLevelAndPlainClosureNoRecv|TestFuncName_ThunkAndBoundStillCarryRecv' -count=1
  • go test ./ssa ./ssa/abi -run 'TestHasTypeParam|TestTypeName_DetachedLocalScopeUsesPosition|TestTypeName_GenericLocal|TestTypeName_Local|TestTypeName' -count=1
  • Go 1.24.11 goroot sanity with default xfail for top-level listed typeparam cases: pass
  • Go 1.24.11 goroot sanity with default xfail for typeparam/mdempsky/{15,16}.go in runlike mode: pass
  • Go 1.25.7 goroot sanity with default xfail for top-level listed typeparam cases: pass
  • Go 1.25.7 goroot sanity with default xfail for typeparam/mdempsky/{15,16}.go in runlike mode: pass

PR remains draft and CI is enabled/running.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants