aboutsummaryrefslogtreecommitdiff
path: root/tests/pos
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-07-20 14:48:34 +0200
committerMartin Odersky <odersky@gmail.com>2014-08-03 17:28:34 +0200
commite33a7385268084138e3d51faffdff33b540ad942 (patch)
treeae547106f6a363c5487535393bc1f971441bc55f /tests/pos
parent38761d9d11a42635e64d6df54ecaf1968797e7e8 (diff)
downloaddotty-e33a7385268084138e3d51faffdff33b540ad942.tar.gz
dotty-e33a7385268084138e3d51faffdff33b540ad942.tar.bz2
dotty-e33a7385268084138e3d51faffdff33b540ad942.zip
Enabled variance checking
Variance checking is now run as part of type-checking. Fixed tests that exhibited variance errors. Added tests where some classes of variance errors should be detected.
Diffstat (limited to 'tests/pos')
-rw-r--r--tests/pos/t1843.scala2
-rw-r--r--tests/pos/typers.scala2
-rw-r--r--tests/pos/variances.scala3
3 files changed, 5 insertions, 2 deletions
diff --git a/tests/pos/t1843.scala b/tests/pos/t1843.scala
index e9b5c5d2d..5e8554a93 100644
--- a/tests/pos/t1843.scala
+++ b/tests/pos/t1843.scala
@@ -5,7 +5,7 @@
*/
object Crash {
- trait UpdateType[A]
+ trait UpdateType[+A]
case class StateUpdate[+A](updateType : UpdateType[A], value : A)
case object IntegerUpdateType extends UpdateType[Integer]
diff --git a/tests/pos/typers.scala b/tests/pos/typers.scala
index a95af558e..b2d786c1c 100644
--- a/tests/pos/typers.scala
+++ b/tests/pos/typers.scala
@@ -32,7 +32,7 @@ object typers {
}
class List[+T] {
- def :: (x: T) = new :: (x, this)
+ def :: [U >: T](x: U): List[U] = new :: (x, this)
def len: Int = this match {
case x :: xs1 => 1 + xs1.len
diff --git a/tests/pos/variances.scala b/tests/pos/variances.scala
new file mode 100644
index 000000000..db858fd5d
--- /dev/null
+++ b/tests/pos/variances.scala
@@ -0,0 +1,3 @@
+trait C[+T <: C[T, U], -U <: C[T, U]] {
+
+}