cl: preserve zero values for blank struct fields - #2231
Conversation
There was a problem hiding this comment.
Review: preserve zero values for blank struct fields
The change is well-constructed. The isBlankFieldStore walk-up correctly handles the intended cases: a store into a descendant of an aggregate blank field is recognized (the inner non-blank FieldAddr continues up to the blank ancestor and returns true), while a store to a non-blank sibling terminates at default and returns false. Side effects are preserved via _ = p.compileValue(b, v.Val) at the call site, and the static-init path forces blank struct fields to zero. Coverage (littest + internal tests) exercises scalar, nested struct, and array blank fields, plus side-effect evaluation. Removing the fixedbugs/issue31546.go darwin/arm64 xfail is consistent with the fix.
Two non-blocking findings are left inline. No blocking issues.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
9a17f36 to
263a408
Compare
263a408 to
2c4cc7b
Compare
Summary
Review counterexamples
The tests directly cover blank fields, nested blank structs, array descendants reached through IndexAddr, adjacent non-blank fields, and side-effecting function-local initializers. IndexAddr traversal is limited to pointer-to-array storage and has a defensive slice/backing-array boundary counterexample that failed before the review fix. The runtime fixture uses unsafe layout checks instead of reflect so it also builds for embedded targets.
Validation