@@ -7,13 +7,13 @@ import reflect.ClassTag
7
7
* But this means `IArray[Int]`, which erases to `Int[]`, cannot be a subtype of
8
8
* `IArray[Any]`.
9
9
*/
10
- opaque type IArray [T ] = Array [T ]
10
+ opaque type IArray [+ T ] = Array [_ <: T ]
11
11
12
12
object IArray {
13
13
14
14
implied arrayOps {
15
- inline def (arr : IArray [T ]) apply[T ] (n : Int ): T = ( arr : Array [T ]) .apply(n)
16
- inline def (arr : IArray [T ]) length[T ] : Int = ( arr : Array [T ]) .length
15
+ inline def (arr : IArray [T ]) apply[T ] (n : Int ): T = arr. asInstanceOf [ Array [T ]] .apply(n)
16
+ inline def (arr : IArray [T ]) length[T ] : Int = arr. asInstanceOf [ Array [T ]] .length
17
17
}
18
18
def apply [T : ClassTag ](xs : T * ): IArray [T ] = Array (xs : _* )
19
19
@@ -27,7 +27,7 @@ object IArray {
27
27
def apply (x : Double , xs : Double * ): IArray [Double ] = Array (x, xs : _* )
28
28
def apply (x : Unit , xs : Unit * ): IArray [Unit ] = Array (x, xs : _* )
29
29
30
- def concat [T : ClassTag ](xss : IArray [T ]* ): IArray [T ] = Array .concat(xss : _* )
30
+ def concat [T : ClassTag ](xss : IArray [T ]* ): IArray [T ] = Array .concat[ T ] (xss. asInstanceOf [ Seq [ Array [ T ]]] : _* )
31
31
32
32
def fill [T : ClassTag ](n : Int )(elem : => T ): IArray [T ] =
33
33
Array .fill(n)(elem)
@@ -56,5 +56,5 @@ object IArray {
56
56
57
57
def iterate [T : ClassTag ](start : T , len : Int )(f : T => T ): IArray [T ] = Array .iterate(start, len)(f)
58
58
59
- def unapplySeq [T ](x : IArray [T ]): Option [IndexedSeq [T ]] = Array .unapplySeq(x )
59
+ def unapplySeq [T ](x : IArray [T ]): Option [IndexedSeq [T ]] = Array .unapplySeq[ T ](x. asInstanceOf [ Array [ T ]] )
60
60
}
0 commit comments