Skip to content

Commit

Permalink
Fix double-edge issue when passes the same rest args twice
Browse files Browse the repository at this point in the history
  • Loading branch information
mame committed Aug 8, 2024
1 parent d2eceef commit 1aeb02a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/typeprof/core/env/method.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def get_rest_args(genv, start_rest, end_rest)
a_arg.each_type do |ty|
ty = ty.base_type(genv)
if ty.is_a?(Type::Instance) && ty.mod == genv.mod_ary && ty.args[0]
vtxs << ty.args[0]
vtxs << ty.args[0].new_vertex(genv, self)
else
"???"
end
Expand Down
1 change: 1 addition & 0 deletions lib/typeprof/core/graph/vertex.rb
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ def initialize(origin)
when AST::Node
when RBS::AST::Declarations::Base
when ValueEntity
when ActualArguments
else
raise "unknown class: #{ origin.class }"
end
Expand Down
18 changes: 18 additions & 0 deletions scenario/args/splat-twice.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## update
class Foo
def gen
[1]
end

def check
ary = []
ary.append(*gen)
ary.append(*gen)
end
end

## assert
class Foo
def gen: -> [Integer]
def check: -> Array[Integer]
end

0 comments on commit 1aeb02a

Please sign in to comment.