diff options
Diffstat (limited to 'tests/neg')
-rw-r--r-- | tests/neg/classOf.scala | 11 | ||||
-rw-r--r-- | tests/neg/tate.scala | 11 |
2 files changed, 22 insertions, 0 deletions
diff --git a/tests/neg/classOf.scala b/tests/neg/classOf.scala new file mode 100644 index 000000000..e13cf71c4 --- /dev/null +++ b/tests/neg/classOf.scala @@ -0,0 +1,11 @@ +object Test { + + class C { type I } + type A = C + + def f1[T] = classOf[T] // error + def f2[T <: String] = classOf[T] // error + val x = classOf[Test.type] // error + val y = classOf[C { type I = String }] // error + val z = classOf[A] // ok +} diff --git a/tests/neg/tate.scala b/tests/neg/tate.scala new file mode 100644 index 000000000..acf7ee7e3 --- /dev/null +++ b/tests/neg/tate.scala @@ -0,0 +1,11 @@ + object unsound { + trait Bound[A, B <: A] + trait Bind[A] { + def bad[B <: A](bound: Bound[A, B], b: B) = b + } + def coerce[T, U](t: T): U = { + lazy val bound: Bound[U, _ >: T] = ??? // error: >: T does not conform to upper bound + def bind = new Bind[U] {} + bind.bad(bound, t) + } + } |