8000 Fix special methods accessibility. by ksss · Pull Request #2546 · ruby/rbs · GitHub
[go: up one dir, main page]

Skip to content

Fix special methods accessibility. #2546

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ksss
Copy link
Collaborator
@ksss ksss commented Jun 9, 2025

I have fixed the problem regarding visibility of special methods.

Background

Special methods are default private instance methods in ruby.

  • #initialize
  • #initialize_copy
  • #initialize_dup
  • #initialize_clone
  • #respond_to_missing?

Problem

String#initialize_copy is public method in RBS

$ bundle exec rbs method String initialize_copy
::String#initialize_copy
  defined_in: ::String
  implementation: ::String
  accessibility: public

String#initialize_copy expected to be private method.

public def initialize_copy is private method in RBS

class Foo
  public def initialize_copy: (self) -> self
end
$ bundle exec rbs method Foo initialize_copy
::Foo#initialize_copy
  defined_in: ::Foo
  implementation: ::Foo
  accessibility: private

If it has a public modifier, it expected to be a public method.

@ksss ksss added this to the RBS 4.0 milestone Jun 16, 2025
@ksss ksss requested a review from soutaro June 19, 2025 14:07
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
0