diff --git a/Gemfile.lock b/Gemfile.lock index 67ccf5c3..f0a8db6a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -10,7 +10,7 @@ GIT PATH remote: . specs: - typeprof (0.31.0) + typeprof (0.31.1) prism (>= 1.4.0) rbs (>= 3.6.0) diff --git a/lib/typeprof/core/ast/control.rb b/lib/typeprof/core/ast/control.rb index ec521c8c..57027c6c 100644 --- a/lib/typeprof/core/ast/control.rb +++ b/lib/typeprof/core/ast/control.rb @@ -203,7 +203,7 @@ def subnodes = { arg: } def install0(genv) arg = @arg.install(genv) - @changes.add_edge(genv, arg, @lenv.get_break_vtx) + @changes.add_edge(genv, arg.new_vertex(genv, self), @lenv.get_break_vtx) Source.new() end end diff --git a/scenario/control/break2.rb b/scenario/control/break2.rb new file mode 100644 index 00000000..6daa4592 --- /dev/null +++ b/scenario/control/break2.rb @@ -0,0 +1,67 @@ +## update +def foo + count = 0 + loop do + count += 1 + break count if count == 3 + end +end + +## assert +class Object + def foo: -> Integer +end + +## update +def foo + count = 0 + loop do + count += 1 + begin + break count if count == 3 + rescue + break count + end + end +end + +## assert +class Object + def foo: -> Integer +end + +## update +def foo + count = 0 + loop do + count += 1 + begin + break count if count == 3 + rescue + break 'str' + end + end +end + +## assert +class Object + def foo: -> (Integer | String) +end + +## update +def foo + count = 0 + loop do + count += 1 + begin + # break count if count == 3 + rescue + break 'str' + end + end +end + +## assert +class Object + def foo: -> String +end