Skip to content

fix nil switch lowering#1883

Open
cpunion wants to merge 4 commits into
xgo-dev:mainfrom
cpunion:codex/goroot-control-coverage
Open

fix nil switch lowering#1883
cpunion wants to merge 4 commits 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

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

❌ Patch coverage is 30.30303% with 23 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cl/compile.go 30.30% 18 Missing and 5 partials ⚠️

📢 Thoughts on this report? Let us know!

@cpunion
Copy link
Copy Markdown
Collaborator Author

cpunion commented May 24, 2026

Update for commit 706507a:

Local validation:

  • go test ./test/goroot -run TestGoRootRunCases -count=1 -args -goroot /Users/lijie/sdk/go1.26.0 -dirs fixedbugs -case '^fixedbugs/issue53635.go$' -run-timeout 60s
  • go test ./test/go -count=1
  • go test ./cl ./ssa -count=1
  • go run ./cmd/llgo test -run TestGenericSwitchNilCases ./test/go -count=1

Runtime package tests were not run because no runtime files or runtime behavior were changed.

@cpunion cpunion marked this pull request as ready for review June 1, 2026 04:28
cpunion added 2 commits June 3, 2026 22:05
…-coverage

# Conflicts:
#	test/goroot/xfail.yaml
…-coverage

# Conflicts:
#	test/goroot/xfail.yaml
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