Skip to content

Commit

Permalink
Add known-issues about splat args
Browse files Browse the repository at this point in the history
  • Loading branch information
mame committed Aug 8, 2024
1 parent 7a6455d commit 4d39783
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/typeprof/core/ast/misc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ def initialize(raw_node, lenv)

def subnodes = { expr: }

def mid_code_range = nil

def install0(genv)
vtx = @expr.install(genv)

Expand Down
16 changes: 16 additions & 0 deletions scenario/known-issues/splat-arg.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
## update
class Foo
def check(*args)
args # This should be an Array[Integer], but currently it's an Integer
end

def foo
check(1)
end
end

## assert
class Foo
def check: (*Integer) -> Array[Integer]
def foo: -> Integer
end
6 changes: 6 additions & 0 deletions scenario/known-issues/splat-on-non-array.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## update
def check
a = *123 # this calls `to_a` on 123, but the error should be suppressed
end

## diagnostics

0 comments on commit 4d39783

Please sign in to comment.