From c2b0d7ea1c9becee5e4af5147398127d5fef9a29 Mon Sep 17 00:00:00 2001 From: Yusuke Endoh Date: Fri, 9 Aug 2024 17:12:52 +0900 Subject: [PATCH] Tentatively accept anything as a proc type --- lib/typeprof/core/ast/sig_type.rb | 2 +- scenario/misc/proc.rb | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 scenario/misc/proc.rb diff --git a/lib/typeprof/core/ast/sig_type.rb b/lib/typeprof/core/ast/sig_type.rb index bd4cbaa5..72bcde86 100644 --- a/lib/typeprof/core/ast/sig_type.rb +++ b/lib/typeprof/core/ast/sig_type.rb @@ -590,7 +590,7 @@ def covariant_vertex0(genv, changes, vtx, subst) end def contravariant_vertex0(genv, changes, vtx, subst) - raise NotImplementedError + Source.new() end def show diff --git a/scenario/misc/proc.rb b/scenario/misc/proc.rb new file mode 100644 index 00000000..85172351 --- /dev/null +++ b/scenario/misc/proc.rb @@ -0,0 +1,15 @@ +## update: test.rbs +class Object + def foo: (^(Integer) -> void) -> void +end + +## update: test.rb +def check(x) +end +f = ->(x) { check(x) } # TODO: this should pass an Integer to the method "check"? Is it possible? +foo(f) + +## assert +class Object + def check: (untyped) -> nil +end