Skip to content

kernel: Integer/Float coercion + default inspect conformance (core/kernel +16) - #589

Merged
tannevaled merged 5 commits into
mainfrom
wave18/kernel
Sep 7, 2026
Merged

tannevaled merged 5 commits into
mainfrom
wave18/kernel

Conversation

@tannevaled

Copy link
Copy Markdown
Contributor

Wave-18 core/kernel: conversion and introspection edges on top of the caller/raise work from a prior wave.

core/kernel: 1796 → 1812 (+16), verified byte-for-byte vs MRI 4.0.5. Files: builtins.go, kernel_introspect.go.

Fixes (each read against ruby/ruby v3_4_0 object.c/eval.c/numeric.c): Float()/Integer() argument-error messages carrying the actual arity/value, the default Kernel#inspect (defaultObjectInspect: #<Class:0x… @ivar=…> with instance variables) as a real override, and related coercion edges. A pre-existing test that pinned at_exit-without-a-block to LocalJumpError was updated to the MRI-verified ArgumentError "called without a block" (ruby -e 'at_exit' confirms) — part of the fix.

Gates: go build ./..., go test ./... (internal/vm passes in isolation; only pre-existing 127.0.0.1:1 network tests fail locally), 100% coverage on the changed functions, gofmt clean, wasip1 build. Rebased onto current main. FLOOR untouched (bumped in the consolidated wave-18 floor PR).

🤖 Generated with Claude Code

tannevaled and others added 5 commits September 7, 2026 17:47
…tion)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… test

The wave-18 kernel work made at_exit without a block raise ArgumentError
"called without a block" — MRI 4.0.5 behaviour (ruby -e 'at_exit' confirms),
not the LocalJumpError the pinned TestPBKernelIntrospectionEdges expected.
Update the assertion to the MRI-verified value.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…verflow)

The new Object#<=> dispatches #==; a class that includes Comparable (whose #==
is (self <=> other) == 0) without defining its own #<=> — e.g. a Numeric
subclass — looped <=> -> == -> <=> to a fatal stack overflow (caught on every CI
lane; TestObjectSpaceshipIdentity's 'class S < Numeric' case). Add a per-VM
objcmpPath pair guard so the re-entry treats the objects as incomparable (nil),
matching MRI's rb_exec_recursive_paired guard in cmp_equal. Verified vs MRI 4.0.5:
(S.new <=> S.new) => nil, (S.new == S.new) => false, (a <=> a) => 0. -race clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
defaultObjectInspect renders a plain object as #<Class:0x...> as MRI does
(ruby -e 'class E;end; p E.new' => "#<E:0x...>"); the stale TestValueReprAndTruthy
pinned the old address-less "#<E>". This failure was masked by the pre-fix stack
overflow. Assert the inspect shape (prefix/suffix) since the address is not fixed;
puts/ToS still renders "#<E>" (unchanged) and library classes with their own
#inspect are unaffected.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
defaultObjectInspect was 61.1% — the tests only inspected objects with no
instance variables, leaving its first-ivar and subsequent-ivar branches
uncovered, dropping the merged total below the 100% gate (macOS lane).
Inspect an object with two ivars (#<E:0x... @A=1, @b="x">, verified vs MRI
4.0.5) to cover both branches. bootstrap (99.7%) and cloneSingleton (79.2%)
remain — identical to main, structurally below 100%.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@tannevaled
tannevaled merged commit 3af2ed1 into main Sep 7, 2026
7 checks passed
@tannevaled
tannevaled deleted the wave18/kernel branch September 7, 2026 19:13
tannevaled added a commit that referenced this pull request Sep 7, 2026
…590)

Wave-18 merged three bibliography-first conformance PRs:
- #587 core/regexp: consume the n/u/e/s encoding modifiers now recorded by
  go-ruby-parser v0.1.8 (cross-repo #23) — core/regexp +12, language/regexp +6.
- #588 core/io: read/write/positioning/iteration surface (gets/each/seek symbol
  whence/closed-stream guards/putc/sync/binread) — core/io +48.
- #589 core/kernel: Integer/Float coercion messages, default Object#inspect with
  the object address + ivars, Object#<=> via #== with a Comparable#== recursion
  guard (fixing a stack overflow), at_exit no-block ArgumentError — core/kernel +16.

Measured total on merged main: 19651 passing. Local measure at TIMEOUT=25;
CI runs TIMEOUT=60 so its total is >= this floor.

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