Skip to content

Use normal call type error for missing dynamic string to_s#9230

Merged
headius merged 2 commits intojruby:masterfrom
headius:normal_to_s_call_for_dstr
Feb 11, 2026
Merged

Use normal call type error for missing dynamic string to_s#9230
headius merged 2 commits intojruby:masterfrom
headius:normal_to_s_call_for_dstr

Conversation

@headius
Copy link
Copy Markdown
Member

@headius headius commented Feb 10, 2026

This fixes #9222 by providing a way to specify the call type to use when choosing a method_missing error type. In this case, to_s called by dynamic string building should behavior like a functional call (not check visibility, no caller passed in) but raise missing method errors like a normal call.

This is a bit hacky, due to the original logic assuming the sole provided call type would indicate both the structure of the call site and the visibility-checking behavior. I split that definition here but it is not clean and should be improved as part of the general refactoring of invokedynamic site binding. See #9229.

When calling to_s for a dynamic string, it should dispatch without
regards to visibility (like functional or variable call type) but
produce a NoMethodError when missing (like normal call type). This
hack allows specifying a different "effective call type" to be used
for site setup when using SelfInvokeSite to skip visibility checks.

The original logic used CallType to indicate both the structure of
arguments passed in from the invokedynamic call site and to
indicate whether to perform visibility checks. This does not
fully disentangle the logic from this dual-meaning but it is
sufficient to fix the related issue.

Fixes jruby#9222
@headius headius added this to the JRuby 10.0.4.0 milestone Feb 10, 2026
@headius headius enabled auto-merge February 10, 2026 23:08
@headius headius disabled auto-merge February 10, 2026 23:08
@headius headius merged commit de4ee7e into jruby:master Feb 11, 2026
79 checks passed
@headius headius deleted the normal_to_s_call_for_dstr branch February 11, 2026 00:00
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.

String interpolation of BasicObject object raises NameError instead of NoMethodError

1 participant