diff --git a/test/test_typecheck.rb b/test/test_typecheck.rb index 55a7e7d7..b3b875bb 100644 --- a/test/test_typecheck.rb +++ b/test/test_typecheck.rb @@ -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', :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