summaryrefslogtreecommitdiff
path: root/test/files/pos/t4063.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-12-12 23:21:24 -0800
committerPaul Phillips <paulp@improving.org>2011-12-12 23:21:24 -0800
commit177baffa6133a5f3e1308f6e3f1306cfa4804ce0 (patch)
treea01c122eba8d4f27b49899ff3be14e60b8df0ce8 /test/files/pos/t4063.scala
parent5aebaac08a0debfdc366330937e3a8ecf6892f78 (diff)
downloadscala-177baffa6133a5f3e1308f6e3f1306cfa4804ce0.tar.gz
scala-177baffa6133a5f3e1308f6e3f1306cfa4804ce0.tar.bz2
scala-177baffa6133a5f3e1308f6e3f1306cfa4804ce0.zip
Test case closes SI-4063.
Diffstat (limited to 'test/files/pos/t4063.scala')
-rw-r--r--test/files/pos/t4063.scala39
1 files changed, 39 insertions, 0 deletions
diff --git a/test/files/pos/t4063.scala b/test/files/pos/t4063.scala
new file mode 100644
index 0000000000..5e19c42edc
--- /dev/null
+++ b/test/files/pos/t4063.scala
@@ -0,0 +1,39 @@
+trait Parallel
+trait Parallelizable[+ParRepr <: Parallel]
+
+trait PIterableLike[+T, +Repr <: Parallel] extends Parallel with Parallelizable[PIterableLike[T, Repr]]
+
+trait PMap[K, V] extends PIterableLike[(K, V), PMap[K, V]]
+trait PSet[T] extends PIterableLike[T, PSet[T]]
+
+trait CIterableLike[+T, +Repr]
+
+trait CSet[T] extends CIterableLike[T, CSet[T]] with Parallelizable[PSet[T]]
+
+trait CMap[K, V] extends CIterableLike[(K, V), CMap[K, V]] with Parallelizable[PMap[K, V]]
+
+object Test {
+ var x = 0
+
+ def main() {
+ val map: CMap[Int, CSet[Int]] = new CMap[Int, CSet[Int]] {}
+ val set: CSet[Int] = new CSet[Int] {}
+
+ // should infer type argument
+ //map.synchronized[CIterableLike[Any, Any] with Parallelizable[PIterableLike[Any, Parallel with Parallelizable[Parallel]]]] {
+ // or:
+ //map.synchronized[CIterableLike[Any, Any] with Parallelizable[PIterableLike[Any, Parallel]]] {
+ // or, maybe it could also infer existential types:
+ //map.synchronized[CIterableLike[Any, _] with Parallelizable[PIterableLike[Any, _]]] {
+
+ map.synchronized {
+ if (x == 0) {
+ map
+ } else {
+ set
+ }
+ }
+
+ }
+}
+