Skip to content

ssa,runtime: gc-conformant type-assertion panics and go:nointerface support#2031

Merged
xushiwei merged 1 commit into
xgo-dev:mainfrom
cpunion:codex/stage5-typeassert
Jul 20, 2026
Merged

ssa,runtime: gc-conformant type-assertion panics and go:nointerface support#2031
xushiwei merged 1 commit into
xgo-dev:mainfrom
cpunion:codex/stage5-typeassert

Conversation

@cpunion

@cpunion cpunion commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Re-expresses the surviving value of #1892; its other ~10k lines were an earlier draft of the funcinfo/pclntab machinery, since superseded by the stage-5 chain.

What changes

  • //go:nointerface support: the pragma is recorded at import time (cl/import.go -> Program.SetNoInterfaceMethod) and such methods are filtered out of abi uncommon method tables, so they no longer satisfy interfaces (gc/fieldtrack semantics). GlobalDCE method metadata takes the filtered selection list.
  • Same-name scope disambiguation: a failed assertion between same-named types from different scopes appends (types from different scopes), matching gc wording.
  • MatchesClosure fix: unwraps closure types on both sides, so assertions between closure and plain function types compare the underlying func types.
  • reflect.(*rtype).Method: builds the method func value with a closure-layout allocation (fixes reflect method-value identity).

goroot conformance

  • Retired xfails, validated on darwin/arm64 (go1.24 + go1.26) and linux/arm64 (go1.24): typeparam/mdempsky/15.go (nointerface), fixedbugs/issue16130.go, fixedbugs/issue29735.go.
  • typeparam/mdempsky/16.go stays xfailed with an updated reason: the panic value now implements runtime.Error (the old failure), but the message still lacks the source interface type and prints the command-line-arguments package path instead of main — same naming class as the funcinfo main-name normalization, left for a follow-up.

Validation

  • macOS: full ssa and cl suites green; new test/go cases green under both go test and llgo test (expect_go/expect_llgo split asserts per-toolchain behavior).
  • linux/arm64 container: llgo test on the new cases green; the four goroot cases behave as recorded above.
  • gentests: no out.ll drift from the abi method-table change.

Supersedes #1892.

🤖 Generated with Claude Code

@codecov

codecov Bot commented Jul 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

…upport

Re-expresses the surviving value of xgo-dev#1892 on the xgo-dev#2023 base (its other
~10k lines were an earlier draft of the funcinfo/pclntab machinery,
since superseded by xgo-dev#2012/xgo-dev#2016/xgo-dev#2019):

- //go:nointerface methods no longer satisfy interfaces: the pragma is
  recorded at import (cl/import.go -> Program.SetNoInterfaceMethod) and
  filtered out of abi uncommon method tables; GlobalDCE metadata takes
  the filtered selection list. Retires the typeparam/mdempsky/15
  goroot xfails (validated go1.26 darwin, ci directive mode).
- Type-assertion failure between same-named types from different
  scopes appends '(types from different scopes)' (gc wording).
- MatchesClosure unwraps closure types on both sides, fixing assertions
  between closure and plain function types.
- reflect.(*rtype).Method builds the method func value with the closure
  layout allocation (fixes reflect method-value identity).
- xfail: retire fixedbugs/issue16130, fixedbugs/issue29735 (validated
  go1.24 + go1.26 darwin), and reword typeparam/mdempsky/16 - the
  panic value now implements runtime.Error; the message still lacks
  the source interface type and prints the command-line-arguments
  package path.
@cpunion
cpunion force-pushed the codex/stage5-typeassert branch from 2173cea to 6e952b2 Compare July 17, 2026 12:19
@xushiwei xushiwei removed the feature label Jul 19, 2026
@xushiwei
xushiwei merged commit 4230b92 into xgo-dev:main Jul 20, 2026
42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

go1.26 Go 1.26 compatibility and support go-test-compat Go standard-library and GOROOT test compatibility

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants