Skip to content

Commit c6296c0

Browse files
committed
Fix double-splat
1 parent 4601d66 commit c6296c0

8 files changed

Lines changed: 26 additions & 11 deletions

File tree

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ GEM
7171
psych (4.0.6)
7272
stringio
7373
public_suffix (6.0.0)
74-
raap (0.8.0)
74+
raap (0.10.0)
7575
rbs (~> 3.0)
7676
timeout (~> 0.4)
7777
racc (1.8.0)

Rakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ task :typecheck_test => :compile do
106106
end
107107

108108
task :raap => :compile do
109-
sh %q[cat test/raap.txt | egrep -v '^#|^$' | xargs bundle exec raap]
109+
sh %q[cat test/raap.txt | egrep -v '^#|^$' | xargs bundle exec raap --require bigdecimal/util --library bigdecimal]
110110
end
111111

112112
task :rubocop do

core/complex.rbs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,10 @@ class Complex < Numeric
134134
# Complex('i') ** 2 # => (-1+0i)
135135
# Complex(-8) ** Rational(1, 3) # => (1.0000000000000002+1.7320508075688772i)
136136
#
137-
def **: (Numeric) -> Complex
137+
def **: (Integer) -> Complex
138+
| (Float) -> Complex
139+
| (Rational) -> Complex
140+
| (Complex) -> Complex
138141

139142
# <!--
140143
# rdoc-file=complex.c

core/float.rbs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,10 @@ class Float < Numeric
142142
# f ** Rational(2, 1) # => 9.8596
143143
# f ** Complex(2, 0) # => (9.8596+0i)
144144
#
145-
def **: (Complex) -> Complex
146-
| (Numeric) -> Float
145+
def **: (Integer) -> Float
146+
| (Float) -> (Float | Complex)
147+
| (Rational) -> (Float | Complex)
148+
| (Complex) -> Complex
147149

148150
# <!--
149151
# rdoc-file=numeric.c

core/integer.rbs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,9 @@ class Integer < Numeric
230230
# 2 ** Rational(3, 1) # => (8/1)
231231
# 2 ** Complex(3, 0) # => (8+0i)
232232
#
233-
def **: (Integer) -> Numeric
234-
| (Float) -> Numeric
235-
| (Rational) -> Numeric
233+
def **: (Integer) -> (Integer | Rational)
234+
| (Float) -> (Float | Complex)
235+
| (Rational) -> (Rational | Float | Complex)
236236
| (Complex) -> Complex
237237

238238
# <!--

core/rational.rbs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,10 @@ class Rational < Numeric
8484
# Rational(1, 2) ** 0 #=> (1/1)
8585
# Rational(1, 2) ** 0.0 #=> 1.0
8686
#
87-
def **: (Complex) -> Complex
88-
| (Numeric) -> Numeric
87+
def **: (Integer) -> Rational
88+
| (Float) -> (Float | Complex)
89+
| (Rational) -> (Float | Rational | Complex)
90+
| (Complex) -> (Rational | Complex)
8991

9092
# <!--
9193
# rdoc-file=rational.c

stdlib/bigdecimal/0/big_decimal.rbs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,10 @@ class BigDecimal < Numeric
441441
#
442442
# Related: BigDecimal#power.
443443
#
444-
def **: (Numeric) -> BigDecimal
444+
def **: (Integer) -> BigDecimal
445+
| (Float) -> (Integer | BigDecimal)
446+
| (Rational) -> (Integer | BigDecimal)
447+
| (BigDecimal) -> BigDecimal
445448

446449
# <!--
447450
# rdoc-file=ext/bigdecimal/bigdecimal.c

test/raap.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,8 @@
44

55
Set[Integer]
66
Enumerable[Integer]#to_set
7+
Integer#**
8+
Float#**
9+
Rational#**
10+
Complex#**
11+
BigDecimal#**

0 commit comments

Comments
 (0)