Skip to content

Add Object.yaml_tag from psych - #3226

Draft
apiology wants to merge 1 commit into
ruby:masterfrom
apiology:psych-object-yaml-tag
Draft

apiology wants to merge 1 commit into
ruby:masterfrom
apiology:psych-object-yaml-tag

Conversation

@apiology

Copy link
Copy Markdown
Contributor

Claude: This PR was written by Claude Code on behalf of @apiology.

Problem: psych adds Object.yaml_tag in lib/psych/core_ext.rb, but the psych signatures do not declare it, so Steep rejects calls to it on any class and Solargraph can't infer their type.

$ rbs -r psych method --singleton Object yaml_tag
Cannot find method: yaml_tag

Solution: Declare Object.yaml_tag as (String url) -> String. It calls Psych.add_tag(url, self), whose last expression, dump_tags[klass] = tag, returns the tag. This is the same from psych 5.0 (Ruby 3.2) through 5.2 (Ruby 3.4).

🤖 Generated with Claude Code

psych's core_ext.rb defines `Object.yaml_tag(url)`, which calls
`Psych.add_tag(url, self)` and so returns `url`. Without a signature,
calls such as `Foo.yaml_tag "!foo"` cannot be resolved.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EhUSLUimEYJyCZv8NdQGKb
apiology added a commit to iftheshoefritz/solargraph-rails that referenced this pull request Oct 13, 2026
Psych's core_ext defines Object.yaml_tag, which returns the tag from
Psych.add_tag; ruby/rbs lacks it until ruby/rbs#3226 ships.

Not yet effective for subclasses: Solargraph's class-scope lookup
never reaches Object's singleton methods, so Rails::Application
.yaml_tag stays undefined until that is fixed.


Claude-Session: https://claude.ai/code/session_01EhUSLUimEYJyCZv8NdQGKb

Co-authored-by: Claude Opus 5.5 (1M context) <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