Skip to content

Commit

Permalink
Avoid multi edges for gvars
Browse files Browse the repository at this point in the history
  • Loading branch information
mame committed Aug 22, 2024
1 parent b386bd0 commit f44b88c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/typeprof/core/ast/variable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ def undefine0(genv)

def install0(genv)
val = @rhs.install(genv)
val = val.new_vertex(genv, self) # avoid multi-edge from val to static_ret.vtx
@changes.add_edge(genv, val, @static_ret.vtx)
val
end
Expand Down
16 changes: 16 additions & 0 deletions scenario/regressions/multi_edge_to_gvar.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
## update
def check
while true
opt = 1
if cond
$foo = opt
else
$foo = opt
end
end
end

## assert
class Object
def check: -> nil
end

0 comments on commit f44b88c

Please sign in to comment.