Skip to content

Commit 1783f42

Browse files
committed
Add test for uncheckedVariance in hk types
1 parent af2a0e6 commit 1783f42

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

library/src-bootstrapped/scala/IArray.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import reflect.ClassTag
44
/** It would be nice it IArray could be covariant, but unfortunately that's not
55
* possible. The problem is the preculiar behavior of `Array[Any]`.
66
* `Array[Any]` erases to `Object[]`. So, `IArray[Any]` also erases to `Object[]`.
7-
* Bit this means `IArray[Int]`, which erases to `Int[]`, cannot be a subtype of
7+
* But this means `IArray[Int]`, which erases to `Int[]`, cannot be a subtype of
88
* `IArray[Any]`.
99
*/
1010
opaque type IArray[T] = Array[T]

tests/pos/covaraint-opqaue.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import annotation.unchecked.uncheckedVariance
2+
3+
opaque type O[+T] = Array[T @uncheckedVariance]

0 commit comments

Comments
 (0)