Skip to content

Commit

Permalink
show to_proc bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ptarjan committed Sep 13, 2017
1 parent e509acb commit ed2675c
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/test_typecheck.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1655,4 +1655,22 @@ def foo(x)

assert_nil TestTypecheck::A5.new.foo(:a)
end

def test_to_proc
self.class.class_eval "class ToProc; end"
ToProc.class_eval do
extend RDL::Annotate
type '() -> Array<Integer>', :typecheck => :call
def self.foo
a = [self.new].map{|x| x.bar}
b = [self.new].map(&:bar)
end
type '() -> Integer', :typecheck => :call
def bar
5
end
end

assert_equal [5], ToProc.foo
end
end

0 comments on commit ed2675c

Please sign in to comment.