Skip to content

Commit c13a7ce

Browse files
committed
Test that scala#1442 is fixed.
1 parent 594e8dd commit c13a7ce

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/pos/i1442.scala

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
object Test1442 {
2+
final def sumMinimized[B](num: Numeric[B]): Int = {
3+
var cse: scala.math.Numeric.type = null.asInstanceOf[scala.math.Numeric.type]
4+
({cse = scala.math.Numeric; num eq cse.IntIsIntegral} ||
5+
(num eq cse.DoubleAsIfIntegral))
6+
2
7+
}
8+
9+
final def sum[B](implicit num: Numeric[B]): B = {
10+
// arithmetic series formula can be used for regular addition
11+
var cse: scala.math.Numeric.type = null.asInstanceOf[scala.math.Numeric.type]
12+
if ({cse = scala.math.Numeric; num eq cse.IntIsIntegral}||
13+
(num eq cse.BigIntIsIntegral)||
14+
(num eq cse.ShortIsIntegral)||
15+
(num eq cse.ByteIsIntegral)||
16+
(num eq cse.CharIsIntegral)||
17+
(num eq cse.LongIsIntegral)||
18+
(num eq cse.FloatAsIfIntegral)||
19+
(num eq cse.BigDecimalIsFractional)||
20+
(num eq cse.DoubleAsIfIntegral)) {
21+
null.asInstanceOf[B]
22+
} else null.asInstanceOf[B]
23+
}
24+
}

0 commit comments

Comments
 (0)