Skip to content

review: cmp.Or for zero-value fallbacks - #17

Merged
CMGS merged 2 commits into
masterfrom
review/cmpor-fallbacks
Sep 7, 2026
Merged

CMGS merged 2 commits into
masterfrom
review/cmpor-fallbacks

Conversation

@CMGS

@CMGS CMGS commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Why

First gate run of the new asl analyzers: cmpor rewrites if x != zero { return x }; return y and if x == zero { x = y } into cmp.Or(x, y) where the fallback is call-free (cmp.Or evaluates every argument).

What

16 cmp.Or rewrites, applied by asl -fix and goimports; no behaviour change.

Evidence

make fmt-check clean; make lint 0 issues on linux and darwin; asl clean on both GOOS; go test -race -count=1 ./... with no FAIL lines (log kept locally).

CMGS added 2 commits September 7, 2026 23:39
The asl cmpor analyzer rewrites the if/return and if/assign zero-value
fallbacks into cmp.Or where the fallback is call-free.
cmp.Or cannot be spelled where cmp is go-cmp; the analyzer now skips such
files (asl 4th fix), and these two test sites stay as they were.
@CMGS
CMGS merged commit 75de148 into master Sep 7, 2026
2 checks passed
@CMGS
CMGS deleted the review/cmpor-fallbacks branch September 7, 2026 15:08
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