aboutsummaryrefslogtreecommitdiff
path: root/tests/pending/pos
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-03-13 17:44:04 +0100
committerMartin Odersky <odersky@gmail.com>2015-03-13 17:45:03 +0100
commita56bc34fb850a6dca40c4f8562f3cb2d5b69dcc7 (patch)
treee9804c9402e33c35fb297bb6b03f456e7a472730 /tests/pending/pos
parent0ee93122b9e367c08ed1d81c9cfc5919fc3a32af (diff)
downloaddotty-a56bc34fb850a6dca40c4f8562f3cb2d5b69dcc7.tar.gz
dotty-a56bc34fb850a6dca40c4f8562f3cb2d5b69dcc7.tar.bz2
dotty-a56bc34fb850a6dca40c4f8562f3cb2d5b69dcc7.zip
add/strict
Add -strict option to do some type checks that are encessary to ensure type soundness, but are stricter than what Scala 2.x enforces. The first such test is the "pattern cannot be uniquely instantiated" problem where we reject a non-variant case subclass of a covariant superclass in a pattern match. The error is now only issued in -struct mode, otherwise it will be a warning. We might move more tests into the same category. This should help the transition.
Diffstat (limited to 'tests/pending/pos')
-rw-r--r--tests/pending/pos/variances-local.scala7
-rw-r--r--tests/pending/pos/viewtest1.scala42
2 files changed, 0 insertions, 49 deletions
diff --git a/tests/pending/pos/variances-local.scala b/tests/pending/pos/variances-local.scala
deleted file mode 100644
index 35e395095..000000000
--- a/tests/pending/pos/variances-local.scala
+++ /dev/null
@@ -1,7 +0,0 @@
-class Foo1[+T] {
- private[this] type MyType = T
-}
-
-class Foo2[+T] {
- protected[this] type MyType = T
-}
diff --git a/tests/pending/pos/viewtest1.scala b/tests/pending/pos/viewtest1.scala
deleted file mode 100644
index 38945ad2f..000000000
--- a/tests/pending/pos/viewtest1.scala
+++ /dev/null
@@ -1,42 +0,0 @@
-package test
-
-trait Ordered[a] {
- def < (x: a): Boolean
-}
-
-object O {
- implicit def view (x: String): Ordered[String] = new Ordered[String] {
- def < (y: String) = x.compareTo(y) < 0
- }
-}
-
-object Empty extends Tree[Nothing]
-case class Node[c <% Ordered[c]](elem: c, l: Tree[c], r: Tree[c]) extends Tree[c]
-
-abstract class Tree[+a <% Ordered[a]] {
- def insert[b >: a <% Ordered[b]](x: b): Tree[b] = this match {
- case Empty =>
- new Node(x, Empty, Empty)
- case Node(elem, l, r) =>
- if (x == elem) this
- else if (x < elem) Node(elem, l insert x, r)
- else Node(elem, l, r insert x)
- }
- def elements: List[a] = this match {
- case Empty => List()
- case Node(elem, l, r) =>
- l.elements ::: List(elem) ::: r.elements
- }
-}
-
-object Test {
- import O.view
-
- def main(args: Array[String]): Unit = {
- var t: Tree[String] = Empty
- for (s <- args) {
- t = t insert s
- }
- println(t.elements)
- }
-}