Skip to content

fix nil switch lowering#1883

Draft
cpunion wants to merge 1 commit into
xgo-dev:mainfrom
cpunion:codex/goroot-control-coverage
Draft

fix nil switch lowering#1883
cpunion wants to merge 1 commit into
xgo-dev:mainfrom
cpunion:codex/goroot-control-coverage

Conversation

@cpunion
Copy link
Copy Markdown
Collaborator

@cpunion cpunion commented May 22, 2026

Summary

  • lower untyped nil SSA constants with comparison/conversion context so switch case nil codegen no longer tries to materialize untyped nil directly
  • add stable test/go coverage for nil switch cases across funcs, maps, slices, channels, and typed nil pointers
  • remove the fixed darwin/arm64 switch.go GOROOT xfail entry

Notes

GOROOT CI is slow/disabled for broad runs, so this PR adds focused test/go coverage for the fixed behavior and only runs the targeted GOROOT case locally.

Targeted validation

  • go test ./test/go -run TestSwitchNilCases -count=1
  • go test ./cl -run 'Test.*Nil|Test.*Builtin|Test.*Cgo|Test.*Compile' -count=1
  • go run -tags=dev ./cmd/llgo test -a -run TestSwitchNilCases ./test/go
  • LLGO_BUILD_CACHE=off go test ./test/goroot -run TestGoRootRunCases/switch.go -count=1 -timeout 10m -args -goroot "$(go env GOROOT)" -dirs . -case '^switch\.go$' -xfail /tmp/llgo-empty-xfail.yaml -run-timeout 3m -build-timeout 5m -progress 15s
  • LLGO_BUILD_CACHE=off go test ./test/goroot -run TestGoRootRunCases/switch.go -count=1 -timeout 10m -args -goroot "$(go env GOROOT)" -dirs . -case '^switch\.go$' -run-timeout 3m -build-timeout 5m -progress 15s

@codecov-commenter
Copy link
Copy Markdown

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

Codecov Report

❌ Patch coverage is 62.16216% with 14 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cl/compile.go 62.16% 13 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

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