-
Notifications
You must be signed in to change notification settings - Fork 216
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
Update Method #1939
Conversation
be45340
to
4577dfb
Compare
@@ -161,7 +168,7 @@ class Method < Object | |||
# m.call # => "bar" | |||
# n = m.clone.call # => "bar" | |||
# | |||
def clone: () -> Method | |||
def clone: () -> instance |
There was a problem hiding this comment.
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 instance
s, but there's no actual way to test this (you can't create subclasses of Method
to call #clone
on)
lib/rbs/test/type_check.rb
Outdated
@@ -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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This ensures that UntypedFunction
s in tests can take blocks
Foo.new.method(:foo_with_args).call(1) | ||
end | ||
def test_dup | ||
omit_if RUBY_VERSION < '3.4' |
There was a problem hiding this comment.
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.
92321e7
to
436fd5a
Compare
436fd5a
to
adac328
Compare
It’d done at line 62.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
This PR updates
Method
.Nothing too crazy going on here.