Skip to content

Commit aa04a38

Browse files
committed
Add test cases for scala#3965
What happened was that a higher-kinded type was added repeatedly to a constraint. Because equality of higher-kinded types was broken, the compiler did not realize that the type had already been added.
1 parent d8ee7bf commit aa04a38

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

tests/pos/i3965.scala

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
trait Iterable[+A] extends IterableOps[A, Iterable, Iterable[A]]
2+
trait IterableOps[+A, +CCop[_], +C]
3+
4+
trait SortedSet[A] extends Iterable[A] with SortedSetOps[A, SortedSet, SortedSet[A]]
5+
6+
trait SortedSetOps[A, +CCss[X] <: SortedSet[X], +C <: SortedSetOps[A, CCss, C]]
7+
8+
class TreeSet[A]
9+
extends SortedSet[A]
10+
with SortedSetOps[A, TreeSet, TreeSet[A]]
11+
12+
class Test {
13+
def optionSequence1[CCos[X] <: IterableOps[X, CCos, _], A](xs: CCos[Option[A]]): Option[CCos[A]] = ???
14+
def optionSequence1[CC[X] <: SortedSet[X] with SortedSetOps[X, CC, CC[X]], A : Ordering](xs: CC[Option[A]]): Option[CC[A]] = ???
15+
16+
def test(xs2: TreeSet[Option[String]]) = {
17+
optionSequence1(xs2)
18+
}
19+
}

tests/pos/i3965a.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
trait SortedSet[A] extends SortedSetOps[A, SortedSet, SortedSet[A]]
2+
3+
trait SortedSetOps[A, +CC[X] <: SortedSet[X], +C <: SortedSetOps[A, CC, C]]
4+
5+
class TreeSet[A]
6+
extends SortedSet[A]
7+
with SortedSetOps[A, TreeSet, TreeSet[A]]
8+
9+
class Test {
10+
def optionSequence1[CC[X] <: SortedSet[X] with SortedSetOps[X, CC, CC[X]], A : Ordering](xs: CC[A]): Unit = ()
11+
12+
def test(xs2: TreeSet[String]) = {
13+
optionSequence1(xs2)
14+
}
15+
}

0 commit comments

Comments
 (0)