Skip to content

Commit 2fadaed

Browse files
authored
Merge pull request #5428 from dotty-staging/i5418
Add test case for #5418
2 parents 23f1845 + 0ff2cd0 commit 2fadaed

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/neg/i5418.scala

+14
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)