Skip to content

Commit

Permalink
[GR-18163] Ruby 2.7: Proc#<< and Proc#>> raises TypeError if passed n…
Browse files Browse the repository at this point in the history
…ot callable object (#2164)

PullRequest: truffleruby/2186
  • Loading branch information
eregon committed Nov 19, 2020
2 parents 0ca88ea + 1d9409d commit 7919f63
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Compatibility:
* Implement `Complex#<=>` (#2004, @ssnickolay).
* Add warning for `proc` without block (#2004, @ssnickolay).
* Implemented `FrozenError#receiver`.
* `Proc#<<` and `Proc#>>` raises TypeError if passed not callable object (#2004, @ssnickolay).

Performance:

Expand Down
4 changes: 0 additions & 4 deletions spec/tags/core/proc/compose_tags.txt

This file was deleted.

4 changes: 4 additions & 0 deletions src/main/ruby/truffleruby/core/proc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ def to_proc
end

def >>(other)
raise(TypeError, 'callable object is expected') unless other.respond_to?(:call)

if lambda?
-> (*args, &block) do
other.call(call(*args, &block))
Expand All @@ -117,6 +119,8 @@ def >>(other)
end

def <<(other)
raise(TypeError, 'callable object is expected') unless other.respond_to?(:call)

if lambda?
-> (*args, &block) do
call(other.call(*args, &block))
Expand Down
1 change: 0 additions & 1 deletion test/mri/excludes/TestProc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
exclude :test_proc_args_rest_post, "needs investigation"
exclude :test_proc_args_rest_post_block, "needs investigation"
exclude :test_safe, "needs investigation"
exclude :test_compose_with_noncallable, "needs investigation"
exclude :test_orphan_return, "needs investigation"
exclude :test_proc_lambda, "needs investigation"
exclude :test_proc_autosplat, "needs investigation"

0 comments on commit 7919f63

Please sign in to comment.