Skip to content

refactor: no dead nil checks for pointer values of a map - #12

Merged
darxnet merged 1 commit into
mainfrom
refactor/fresh-map-values
Nov 16, 2026
Merged

darxnet merged 1 commit into
mainfrom
refactor/fresh-map-values

Conversation

@darxnet

@darxnet darxnet commented Nov 16, 2026

Copy link
Copy Markdown
Owner

A map value is copied into a fresh zero variable, so for a pointer to a
struct with CopyFrom the generated w = nil and if w == nil could never
matter. copyCode takes fresh and emits only if v != nil { w = new(T); w.CopyFrom(v) } there; arrays pass it down, slice elements do not.

Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com

@codecov

codecov Bot commented Nov 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@darxnet
darxnet force-pushed the refactor/fresh-map-values branch from 9cecba6 to c6685a5 Compare November 16, 2026 11:04
Base automatically changed from test/nil-elements to main November 16, 2026 11:07
A map value is copied into a fresh zero variable, so for a pointer to a
struct with CopyFrom the generated `w = nil` and `if w == nil` could never
matter. copyCode takes fresh and emits only `if v != nil { w = new(T);
w.CopyFrom(v) }` there; arrays pass it down, slice elements do not.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@darxnet
darxnet force-pushed the refactor/fresh-map-values branch from c6685a5 to 255b651 Compare November 16, 2026 11:10
@darxnet
darxnet merged commit f079bcf into main Nov 16, 2026
9 checks passed
@darxnet
darxnet deleted the refactor/fresh-map-values branch November 16, 2026 11:12
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.

1 participant