Skip to content

Dispatch a user-defined #!= instead of inverting #== in the != opcode - #572

Merged
tannevaled merged 1 commit into
mainfrom
fix/neq-dispatch
Sep 6, 2026
Merged

tannevaled merged 1 commit into
mainfrom
fix/neq-dispatch

Conversation

@tannevaled

Copy link
Copy Markdown
Contributor

a != b compiled to OpNeq and was evaluated as !(a == b), ignoring a user-defined #!= (which MRI dispatches). C.new != x returned !(C#==) instead of C#!=. This was flagged by three separate conformance efforts (array/range/bsearch specs + the mspec ShouldProxy harness). OpNeq now dispatches the receiver's #!= when its class overrides it below BasicObject; the default !(self == other) inline path is kept for everything else (built-in value types never override #!=). Every changed function is 100% covered; go test ./..., wasip1 wasm and gofmt all green; FLOOR untouched.

🤖 Generated with Claude Code

rbgo compiled `a != b` to OpNeq, which binaryOp evaluated as !(a == b) — so a
class that overrides #!= (as MRI's BasicObject#!= documents callers may) was
ignored: `C.new != x` returned !(C#==) rather than C#!=. This surfaced across
core/array, core/range and core/bsearch specs and the mspec ShouldProxy harness.
OpNeq now dispatches the receiver's #!= when its class overrides it anywhere
below BasicObject (whose default #!= is still the inline !(self == other) fast
path); built-in value types, which never override #!=, are unaffected.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@tannevaled
tannevaled merged commit 5779ef0 into main Sep 6, 2026
7 checks passed
@tannevaled
tannevaled deleted the fix/neq-dispatch branch September 6, 2026 10:12
tannevaled added a commit that referenced this pull request Sep 6, 2026
Locks in #569 (Hash), #570 (Encoding subsystem), #571 (Range) and #572 (the
!= opcode dispatching a user-defined #!=). Measured 18790 passing on the pinned
corpus, up from 18767.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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