diff --git a/lib/typeprof/core/ast/control.rb b/lib/typeprof/core/ast/control.rb index a301a959..676f8ffc 100644 --- a/lib/typeprof/core/ast/control.rb +++ b/lib/typeprof/core/ast/control.rb @@ -313,8 +313,8 @@ def subnodes = { arg: } def install0(genv) @arg.install(genv) - e_ret = @lenv.get_var(:"*expected_method_ret") - @lenv.add_return_box(@changes.add_escape_box(genv, @arg.ret, e_ret)) + e_ret = @lenv.locals[:"*expected_method_ret"] + @lenv.add_return_box(@changes.add_escape_box(genv, @arg.ret, e_ret)) if e_ret Source.new(Type::Bot.new(genv)) end end diff --git a/scenario/misc/define_method_return.rb b/scenario/misc/define_method_return.rb new file mode 100644 index 00000000..8ddf9866 --- /dev/null +++ b/scenario/misc/define_method_return.rb @@ -0,0 +1,8 @@ +## update +class Foo + define_method(:foo) { return } +end + +## assert +class Foo +end