Skip to content

Conversation

@soutaro
Copy link
Member

@soutaro soutaro commented Sep 8, 2025

Both ::_ArefFromStringToString and String::encode_fallback are marked as deprecated, and referencing the interface from encode_fallback results in RBS::DeprecatedTypeName error in RBS file reported by Steep.

$ bundle exec steep check --no-type-check --validate=library
# Type checking files:

....................................................................................................................................................................................................F..............

core/string.rbs:3583:70: [warning] Type `::String::_ArefFromStringToString` is deprecated
│ Diagnostic ID: RBS::DeprecatedTypeName
│
└ type String::encode_fallback = Hash[String, String] | Proc | Method | String::_ArefFromStringToString
                                                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Detected 1 problem from 1 file

This warning doesn't make sense:

  1. String::encode_fallback itself is a deprecated, so using the type in user's code are already reported as a type error
  2. Users cannot silence the warning by changing Steep configuration

This PR changes the type definition to remove the warning.

@soutaro soutaro added this to the RBS 4.0 milestone Sep 8, 2025
@soutaro soutaro enabled auto-merge September 8, 2025 08:14
@soutaro soutaro added this pull request to the merge queue Sep 8, 2025
Merged via the queue into master with commit e6031f1 Sep 8, 2025
21 checks passed
@soutaro soutaro deleted the silence-string-deprecation branch September 8, 2025 08:37
soutaro added a commit that referenced this pull request Sep 8, 2025
Update `string.rbs` to avoid deprecation warning in Steep
soutaro added a commit that referenced this pull request Sep 8, 2025
Merge pull request #2655 from ruby/silence-string-deprecation
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.

2 participants