Repository navigation
String: advance MRI 4.0.6 conformance (non-encoding method residuals) - #562
Merged
Merged
Conversation
…limit) Committed to protect against scratchpad purge; to be finished, verified and squashed before the PR is opened. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…$~; tests
- getbyte: raise ArgumentError unless given exactly one argument.
- upto: iterate a single-ASCII-char run by codepoint ("9".upto("A")); coerce
the end argument via #to_str; the no-block Enumerator reports nil size.
- start_with?: coerce a non-Regexp prefix via #to_str (keeping the encoding
compatibility check), and set/clear $~ for a Regexp argument.
- Add internal/vm/string_method_wave11_test.go covering every new branch.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Advances MRI 4.0.6 conformance for non-encoding
Stringmethod behaviour (encoding negotiation is owned separately). Measured againstcore/string/*_spec.rb.Changes
next/next!/intern/to_strnow share the exactMethodrecord ofsucc/succ!/to_sym/to_s(viaaliasBuiltin), soinstance_method(:next) == instance_method(:succ)etc.String#<=>— accepts a String subclass by value, converts a#to_stroperand (rb_check_string_type), and invertsother <=> self(rb_invcmp) with a recursion guard for the mutually-inverting operand case.String#==— dedicated method withrb_str_equalsemantics (subclass by value; defers toother == selfwhen the operand answers#to_str); the==/!=operator fast path defers likewise.String#to_f— allows a single inter-digit underscore in the integer/fraction/exponent runs; treats NUL and other non-printable bytes as terminals rather than leading whitespace.String#to_i— base0with a leading0selects octal; the base argument is coerced via#to_int.String#getbyte— raisesArgumentErrorunless given exactly one argument.String#upto— iterates a single-ASCII-character run by codepoint ("9".upto("A")); coerces the end argument via#to_str; the no-block Enumerator reportsnilsize.String#start_with?— coerces a non-Regexp prefix via#to_str(keeping the encoding-compatibility check) and sets/clears$~for a Regexp argument.Spec deltas (core/string, non-encoding)
Net +21 passing examples; remaining residuals in these files are encoding-negotiation cases (out of scope).
Verification
go test ./internal/vm/andgo test ./...green;GOOS=wasip1 GOARCH=wasmbuild OK;gofmt -lclean.internal/vm/string_method_wave11_test.gocovers every new branch; each changed standalone function (binaryOp,stringOrSubclassBytes,spaceshipInvert,stringToInt,parseLeadingFloat,stringUpto) is 100% in the merged-coverpkgprofile. No shadowed dead code.🤖 Generated with Claude Code