Skip to content

Commit 177baff

Browse files
committed
Test case closes SI-4063.
1 parent 5aebaac commit 177baff

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

test/files/pos/t4063.scala

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
trait Parallel
2+
trait Parallelizable[+ParRepr <: Parallel]
3+
4+
trait PIterableLike[+T, +Repr <: Parallel] extends Parallel with Parallelizable[PIterableLike[T, Repr]]
5+
6+
trait PMap[K, V] extends PIterableLike[(K, V), PMap[K, V]]
7+
trait PSet[T] extends PIterableLike[T, PSet[T]]
8+
9+
trait CIterableLike[+T, +Repr]
10+
11+
trait CSet[T] extends CIterableLike[T, CSet[T]] with Parallelizable[PSet[T]]
12+
13+
trait CMap[K, V] extends CIterableLike[(K, V), CMap[K, V]] with Parallelizable[PMap[K, V]]
14+
15+
object Test {
16+
var x = 0
17+
18+
def main() {
19+
val map: CMap[Int, CSet[Int]] = new CMap[Int, CSet[Int]] {}
20+
val set: CSet[Int] = new CSet[Int] {}
21+
22+
// should infer type argument
23+
//map.synchronized[CIterableLike[Any, Any] with Parallelizable[PIterableLike[Any, Parallel with Parallelizable[Parallel]]]] {
24+
// or:
25+
//map.synchronized[CIterableLike[Any, Any] with Parallelizable[PIterableLike[Any, Parallel]]] {
26+
// or, maybe it could also infer existential types:
27+
//map.synchronized[CIterableLike[Any, _] with Parallelizable[PIterableLike[Any, _]]] {
28+
29+
map.synchronized {
30+
if (x == 0) {
31+
map
32+
} else {
33+
set
34+
}
35+
}
36+
37+
}
38+
}
39+

0 commit comments

Comments
 (0)