Skip to content

Commit df014b9

Browse files
committed
Add a scenario for anonymous block forwarding
I noticed that TestProf does not work with code that uses anonymous block forwarding, so I added a scenario.
1 parent 8d1f1ef commit df014b9

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

lib/typeprof/core/ast/call.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ def initialize(raw_node, recv, mid, mid_code_range, raw_args, last_arg, raw_bloc
4545

4646
if raw_block
4747
if raw_block.type == :block_argument_node
48-
@block_pass = AST.create_node(raw_block.expression, lenv)
48+
# TODO: Support anonymous block forwarding
49+
@block_pass = AST.create_node(raw_block.expression, lenv) if raw_block.expression
4950
else
5051
@block_pass = nil
5152
@block_tbl = raw_block.locals
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
## update
2+
def foo(&)
3+
bar(&)
4+
end
5+
6+
def bar(&b)
7+
b.call(1.0)
8+
end
9+
10+
foo do |n|
11+
"str"
12+
end
13+
14+
## assert
15+
class Object
16+
def foo: -> untyped
17+
def bar: { (Float) -> untyped } -> untyped
18+
end

0 commit comments

Comments
 (0)