Skip to content

Commit

Permalink
Avoid double edge on self assignment of type var
Browse files Browse the repository at this point in the history
  • Loading branch information
mame committed Aug 28, 2024
1 parent 86ca835 commit e335445
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/typeprof/core/graph/vertex.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def each_type(&blk)
def check_match(genv, changes, vtx)
vtx.each_type do |ty|
if ty.is_a?(Type::Var)
changes.add_edge(genv, self, ty.vtx)
changes.add_edge(genv, self, ty.vtx) if self != ty.vtx
return true
end
end
Expand Down
6 changes: 6 additions & 0 deletions scenario/regressions/self-type-var.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## update: test.rb
def check2
@ary = [].to_a
@ary = @ary.concat(@ary)
@ary = @ary.concat(@ary)
end

0 comments on commit e335445

Please sign in to comment.