Skip to content

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

Merged
CMGS merged 1 commit into
mainfrom
review/cmpor-fallbacks
Sep 7, 2026
Merged

CMGS merged 1 commit into
mainfrom
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). and the two label-value comments go (labelenum: docs/metrics own the values)

What

0 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).

The asl cmpor analyzer rewrites the if/return and if/assign zero-value
fallbacks into cmp.Or where the fallback is call-free and the two label-value comments go (labelenum: docs/metrics own the values).
@CMGS
CMGS merged commit fcaf343 into main Sep 7, 2026
2 checks passed
@CMGS
CMGS deleted the review/cmpor-fallbacks branch September 7, 2026 15:07
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