Skip to content

Commit 0ff2cd0

Browse files
committed
Add test case for #5418
1 parent a9029dc commit 0ff2cd0

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/neg/i5418.scala

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
class Test {
2+
class Tree[A]
3+
4+
def fromOrderedKeys[A](xs: Iterator[A]): Tree[A] = ???
5+
6+
def from[E](it: Iterable[E]): Tree[E] =
7+
it match {
8+
case r: Range =>
9+
val it = r.iterator
10+
11+
// instantiation of covariant GADTs is unsound
12+
fromOrderedKeys(it) // error: type mismatch: found: Iterator[Int](it), required Iterator[E]
13+
}
14+
}

0 commit comments

Comments
 (0)