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

Update Method #1939

Merged
merged 2 commits into from
Aug 5, 2024
Merged

Update Method #1939

merged 2 commits into from
Aug 5, 2024

Conversation

sampersand
Copy link
Contributor

@sampersand sampersand commented Jul 26, 2024

This PR updates Method.

Nothing too crazy going on here.

@sampersand sampersand marked this pull request as draft July 26, 2024 02:51
@sampersand sampersand force-pushed the swesterman/24-07-21/Method branch 2 times, most recently from be45340 to 4577dfb Compare July 26, 2024 02:54
@@ -161,7 +168,7 @@ class Method < Object
# m.call # => "bar"
# n = m.clone.call # => "bar"
#
def clone: () -> Method
def clone: () -> instance
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clone, like dup, technically return instances, but there's no actual way to test this (you can't create subclasses of Method to call #clone on)

@@ -80,7 +80,7 @@ def method_call(method_name, method_type, call, errors:)
# Block is given, but not yielded
end
else
if call.block_given
if call.block_given && !method_type.type.is_a?(Types::UntypedFunction)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ensures that UntypedFunctions in tests can take blocks

Foo.new.method(:foo_with_args).call(1)
end
def test_dup
omit_if RUBY_VERSION < '3.4'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Method#dup was only added in ruby 3.4; should we do an %a{rbs:since:3.4} to the definition? probably not.

@sampersand sampersand force-pushed the swesterman/24-07-21/Method branch 2 times, most recently from 92321e7 to 436fd5a Compare July 26, 2024 03:01
@sampersand sampersand marked this pull request as ready for review July 26, 2024 03:01
Copy link
Member

@soutaro soutaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@soutaro soutaro enabled auto-merge August 5, 2024 02:34
@soutaro soutaro added this to the RBS 3.6 milestone Aug 5, 2024
@soutaro soutaro added this pull request to the merge queue Aug 5, 2024
Merged via the queue into ruby:master with commit 256107b Aug 5, 2024
19 checks passed
@soutaro soutaro added the Released PRs already included in the released version label Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Released PRs already included in the released version
Development

Successfully merging this pull request may close these issues.

2 participants