aboutsummaryrefslogtreecommitdiff
path: root/tests/pos
diff options
context:
space:
mode:
authorodersky <odersky@gmail.com>2015-01-31 19:19:07 +0100
committerodersky <odersky@gmail.com>2015-01-31 19:19:07 +0100
commita822fc15235d9cc91302bd82d180830eff357ae2 (patch)
tree3bd15eecb77b1fca0b944ba5f203ba6f5c41a582 /tests/pos
parent537c53b2eba195317f0e7f0ede0cf3fdbd80e790 (diff)
parent70e55d26100199b99502705233786bbdc15c4c6b (diff)
downloaddotty-a822fc15235d9cc91302bd82d180830eff357ae2.tar.gz
dotty-a822fc15235d9cc91302bd82d180830eff357ae2.tar.bz2
dotty-a822fc15235d9cc91302bd82d180830eff357ae2.zip
Merge pull request #331 from dotty-staging/fix/refined-subtyping
Fix/refined subtyping
Diffstat (limited to 'tests/pos')
-rw-r--r--tests/pos/Patterns.scala2
-rw-r--r--tests/pos/bounds.scala11
-rw-r--r--tests/pos/caseClassInMethod.scala5
-rw-r--r--tests/pos/class-dependent-extension-method.scala3
-rw-r--r--tests/pos/compound.scala14
-rw-r--r--tests/pos/refinedSubtyping.scala10
-rw-r--r--tests/pos/subtyping.scala13
-rw-r--r--tests/pos/t0674.scala10
-rw-r--r--tests/pos/t1208.scala7
9 files changed, 69 insertions, 6 deletions
diff --git a/tests/pos/Patterns.scala b/tests/pos/Patterns.scala
index 54c4d8ab2..e443c2ab5 100644
--- a/tests/pos/Patterns.scala
+++ b/tests/pos/Patterns.scala
@@ -6,7 +6,7 @@ object Patterns {
private def rebase(tp: NamedType): Type = {
def rebaseFrom(prefix: Type): Type = ???
tp.prefix match {
- case RefinedThis(rt) => rebaseFrom(rt)
+ case SkolemType(rt) => rebaseFrom(rt)
case pre: ThisType => rebaseFrom(pre)
case _ => tp
}
diff --git a/tests/pos/bounds.scala b/tests/pos/bounds.scala
new file mode 100644
index 000000000..26bc84a1b
--- /dev/null
+++ b/tests/pos/bounds.scala
@@ -0,0 +1,11 @@
+trait Map[A, +C] {
+ def ++ [B1 >: C] (kvs: Iterable[Tuple2[A, B1]]): Map[A, B1] = this
+ def ++ [B1 >: C] (kvs: Iterator[Tuple2[A, B1]]): Map[A, B1] = this
+}
+
+class ListMap[A, +B] extends Map[A, B] {}
+
+object ListMap {
+ def empty[X, Y] = new ListMap[X, Y]
+ def apply[A1, B2](elems: Tuple2[A1, B2]*): Map[A1, B2] = empty[A1,B2].++(elems.iterator)
+}
diff --git a/tests/pos/caseClassInMethod.scala b/tests/pos/caseClassInMethod.scala
new file mode 100644
index 000000000..2e6484792
--- /dev/null
+++ b/tests/pos/caseClassInMethod.scala
@@ -0,0 +1,5 @@
+object t {
+ def f = { object C; case class C(); 1 }
+ def g = { case class D(x: Int); object D; 2 }
+ def h = { case class E(y: Int = 10); 3 }
+}
diff --git a/tests/pos/class-dependent-extension-method.scala b/tests/pos/class-dependent-extension-method.scala
new file mode 100644
index 000000000..b557dfa8f
--- /dev/null
+++ b/tests/pos/class-dependent-extension-method.scala
@@ -0,0 +1,3 @@
+class C(val a: String) extends AnyVal {
+ def foo[U <: a.type]: Unit = foo[U]
+}
diff --git a/tests/pos/compound.scala b/tests/pos/compound.scala
new file mode 100644
index 000000000..24a936f13
--- /dev/null
+++ b/tests/pos/compound.scala
@@ -0,0 +1,14 @@
+abstract class A { type T }
+
+abstract class B { val xz: Any }
+
+abstract class Test {
+ var yy: A with B { type T; val xz: T } = null;
+ var xx: A with B { type T; val xz: T } = null;
+ xx = yy;
+}
+
+abstract class Test2 {
+ var yy: A with B { type T; val xz: T } = null;
+ val xx: A with B { type T; val xz: T } = yy
+}
diff --git a/tests/pos/refinedSubtyping.scala b/tests/pos/refinedSubtyping.scala
index a01be181d..e6a972e1c 100644
--- a/tests/pos/refinedSubtyping.scala
+++ b/tests/pos/refinedSubtyping.scala
@@ -60,3 +60,13 @@ class Test3 {
y = x
}
+class Test4 {
+
+ abstract class A { type T; val xz: Any }
+
+ val yy: A { val xz: T } = null;
+// val xx: A { val xz: T } = null;
+ val zz: A { val xz: T } = yy;
+
+}
+
diff --git a/tests/pos/subtyping.scala b/tests/pos/subtyping.scala
index 95e813bdd..29d830dd2 100644
--- a/tests/pos/subtyping.scala
+++ b/tests/pos/subtyping.scala
@@ -16,4 +16,17 @@ object test {
}
+object test2 {
+
+ class A
+ class B
+
+ val x: A | B = ???
+ val y: B | A = x
+
+ val a: A & B = ???
+ val b: B & A = a
+
+}
+
diff --git a/tests/pos/t0674.scala b/tests/pos/t0674.scala
index 589eeec9f..a734091da 100644
--- a/tests/pos/t0674.scala
+++ b/tests/pos/t0674.scala
@@ -39,10 +39,10 @@ for(a <- Some(1);
l <- Some(12);
m <- Some(13);
n <- Some(14);
- o <- Some(15)
-// p <- Some(16);
-// q <- Some(17)
-// r <- Some(18);
-// s <- Some(19)
+ o <- Some(15);
+ p <- Some(16);
+ q <- Some(17);
+ r <- Some(18);
+ s <- Some(19)
) yield a)
}
diff --git a/tests/pos/t1208.scala b/tests/pos/t1208.scala
new file mode 100644
index 000000000..7b14aadca
--- /dev/null
+++ b/tests/pos/t1208.scala
@@ -0,0 +1,7 @@
+object Test {
+ object Foo
+ val f: Option[Foo.type] = Some(Foo)
+}
+
+// unsupported with current typing rules.
+// on the other hand, we need a way to refer to a module class.