File tree 1 file changed +24
-0
lines changed 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments