summaryrefslogtreecommitdiff
path: root/test/pending/pos/inference.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-02-23 10:59:55 -0800
committerPaul Phillips <paulp@improving.org>2012-02-23 11:06:14 -0800
commit622656dfc87100bc94a37f3b244955c96d526023 (patch)
tree1832c7de4759defc03266e32c33b887554a69647 /test/pending/pos/inference.scala
parent119c9554cf948163433ab12ce8cdd36814f63e4a (diff)
downloadscala-622656dfc87100bc94a37f3b244955c96d526023.tar.gz
scala-622656dfc87100bc94a37f3b244955c96d526023.tar.bz2
scala-622656dfc87100bc94a37f3b244955c96d526023.zip
Moved and edited tests.
Remove obsolete, move passing pending -> files, update those-kinds-are-high with some new info, added a couple new ones to pending.
Diffstat (limited to 'test/pending/pos/inference.scala')
-rw-r--r--test/pending/pos/inference.scala39
1 files changed, 39 insertions, 0 deletions
diff --git a/test/pending/pos/inference.scala b/test/pending/pos/inference.scala
new file mode 100644
index 0000000000..d28d003435
--- /dev/null
+++ b/test/pending/pos/inference.scala
@@ -0,0 +1,39 @@
+// inference illuminator
+object Test {
+ class D1[T1 : Manifest, T2 <: T1 : Manifest](x: T1) { println(manifest[(T1, T2)]) }
+ class D2[T1 : Manifest, T2 >: T1 : Manifest](x: T1) { println(manifest[(T1, T2)]) }
+ class D3[+T1 : Manifest, T2 <: T1 : Manifest](x: T1) { println(manifest[(T1, T2)]) }
+ class D4[-T1 : Manifest, T2 >: T1 : Manifest](x: T1) { println(manifest[(T1, T2)]) }
+
+ class E1[T1 : Manifest, T2 <: T1 : Manifest](x: D1[T1, T2]) { println(manifest[(T1, T2)]) }
+ class E2[T1 : Manifest, T2 >: T1 : Manifest](x: D2[T1, T2]) { println(manifest[(T1, T2)]) }
+ class E3[+T1 : Manifest, T2 <: T1 : Manifest](x: D3[T1, T2]) { println(manifest[(T1, T2)]) }
+ class E4[-T1 : Manifest, T2 >: T1 : Manifest](x: D4[T1, T2]) { println(manifest[(T1, T2)]) }
+
+ def main(args: Array[String]): Unit = {
+ // WHY YOU NO LIKE NOTHING SO MUCH SCALAC?
+ val d1 = new D1(5)
+ val d2 = new D2(5)
+ val d3 = new D3(5)
+ val d4 = new D4(5)
+
+ new E1(d1) // fails
+ new E2(d2)
+ new E3(d3) // fails
+ new E4(d4)
+ }
+ // found : Test.D1[Int,Nothing]
+ // required: Test.D1[Int,T2]
+ // Note: Nothing <: T2, but class D1 is invariant in type T2.
+ // You may wish to define T2 as +T2 instead. (SLS 4.5)
+ // new E1(d1)
+ // ^
+ // test/pending/pos/inference.scala:22: error: type mismatch;
+ // found : Test.D3[Int,Nothing]
+ // required: Test.D3[Int,T2]
+ // Note: Nothing <: T2, but class D3 is invariant in type T2.
+ // You may wish to define T2 as +T2 instead. (SLS 4.5)
+ // new E3(d3)
+ // ^
+ // two errors found
+}