Skip to content
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

Fix and update Module#alias_method signature #645

Merged
merged 1 commit into from
Mar 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/module.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class Module < Object
#
# Exiting with code 99
#
def alias_method: (Symbol new_name, Symbol old_name) -> self
def alias_method: (::Symbol | ::String new_name, ::Symbol | ::String old_name) -> ::Symbol

# Returns a list of modules included/prepended in *mod* (including *mod*
# itself).
Expand Down
13 changes: 13 additions & 0 deletions test/stdlib/Module_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,17 @@ def test_class_eval
assert_send_type "() { (Module) -> nil } -> nil",
Foo, :class_eval do nil end
end

def test_alias_method
mod = Module.new do
def foo
end
end

omit_if(mod.alias_method(:bar, :foo).equal?(mod))
assert_send_type '(::Symbol new_name, ::Symbol old_name) -> ::Symbol',
mod, :alias_method, :bar2, :foo
assert_send_type '(::String new_name, ::String old_name) -> ::Symbol',
mod, :alias_method, 'bar3', 'foo'
end
end