Skip to content

Commit a3ffcd4

Browse files
committed
Add scenario for splat operator in rescue clauses
1 parent 75082bb commit a3ffcd4

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

scenario/control/rescue-assign.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,20 @@ def foo(n)
66
e.message
77
end
88

9+
def bar(n)
10+
raise if n != 0
11+
n.to_s
12+
rescue *[StandardError] => e
13+
e.message
14+
end
15+
916
foo(1)
17+
bar(1)
1018

1119
## diagnostics
1220

1321
## assert
1422
class Object
1523
def foo: (Integer) -> String
24+
def bar: (Integer) -> String
1625
end

scenario/control/rescue-splat.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## update
2+
def foo
3+
begin
4+
:a
5+
rescue *[StandardError]
6+
:b
7+
end
8+
end
9+
10+
foo
11+
12+
## assert
13+
class Object
14+
def foo: -> (:a | :b)
15+
end

0 commit comments

Comments
 (0)