aboutsummaryrefslogtreecommitdiff
path: root/tests/pending
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-03-17 18:44:39 +0100
committerTobias Schlatter <tobias@meisch.ch>2014-03-21 11:28:30 +0100
commitc854cc7fcc9d0f889c6235c1534133cff7360e7f (patch)
treea17c01b5a46e34e8640d543ae12eb06fde598892 /tests/pending
parent474b35ff0160c1174674757895e93818dc4f2f19 (diff)
downloaddotty-c854cc7fcc9d0f889c6235c1534133cff7360e7f.tar.gz
dotty-c854cc7fcc9d0f889c6235c1534133cff7360e7f.tar.bz2
dotty-c854cc7fcc9d0f889c6235c1534133cff7360e7f.zip
More tests
Diffstat (limited to 'tests/pending')
-rw-r--r--tests/pending/pos/t1071.scala19
-rw-r--r--tests/pending/pos/t1208.scala7
-rw-r--r--tests/pending/pos/t1236.scala14
-rw-r--r--tests/pending/pos/t1272.scala9
-rw-r--r--tests/pending/pos/t1279a.scala39
-rw-r--r--tests/pending/pos/t1280.scala1
-rw-r--r--tests/pending/pos/t1292.scala33
7 files changed, 122 insertions, 0 deletions
diff --git a/tests/pending/pos/t1071.scala b/tests/pending/pos/t1071.scala
new file mode 100644
index 000000000..b241cd648
--- /dev/null
+++ b/tests/pending/pos/t1071.scala
@@ -0,0 +1,19 @@
+class C {
+ private val a = 0
+ def getA = a
+}
+
+class D(c: C) {
+ def a = c.getA
+}
+
+object Test {
+ implicit def c2d(c: C): D = new D(c)
+
+ val c = new C
+ (c: D).a // works
+ c.a // error
+}
+
+// to fix this we'd need to check accessibility in the isMatchedBy of a SelectionProto,
+// so that we can insert an implicit if this does not work. Need to check performance impact of this.
diff --git a/tests/pending/pos/t1208.scala b/tests/pending/pos/t1208.scala
new file mode 100644
index 000000000..7b14aadca
--- /dev/null
+++ b/tests/pending/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.
diff --git a/tests/pending/pos/t1236.scala b/tests/pending/pos/t1236.scala
new file mode 100644
index 000000000..eee1cbf02
--- /dev/null
+++ b/tests/pending/pos/t1236.scala
@@ -0,0 +1,14 @@
+trait Empty[E[_]] {
+ def e[A]: E[A]
+}
+
+object T {
+ val ListEmpty = new Empty[List] {
+ def e[A]/*: List*/ = Nil // uncomment to get crash
+ }
+
+ def foo[F[_]](q:(String,String)) = "hello"
+ def foo[F[_]](e: Empty[F]) = "world"
+
+ val x = foo[List](ListEmpty)
+}
diff --git a/tests/pending/pos/t1272.scala b/tests/pending/pos/t1272.scala
new file mode 100644
index 000000000..916b783bb
--- /dev/null
+++ b/tests/pending/pos/t1272.scala
@@ -0,0 +1,9 @@
+object ImplicitTest {
+ implicit val i : Int = 10
+ implicit def a(implicit i : Int) : Array[Byte] = null
+ implicit def b[T](implicit i : Int) : Array[T] = null
+
+ def fn[T](implicit x : T) = 0
+
+ val x = fn[Array[Byte]]
+}
diff --git a/tests/pending/pos/t1279a.scala b/tests/pending/pos/t1279a.scala
new file mode 100644
index 000000000..18b1e53f4
--- /dev/null
+++ b/tests/pending/pos/t1279a.scala
@@ -0,0 +1,39 @@
+// covariant linked list
+abstract class M {
+ self =>
+
+ type T
+ final type selfType = M {type T <: self.T}
+ type actualSelfType >: self.type <: selfType
+
+ def next: selfType
+
+ // I don't understand why this doesn't compile, but that's a separate matter
+ // error: method all2 cannot be accessed in M.this.selfType
+ // because its instance type => Stream[M{type T <: M.this.selfType#T}]
+ // contains a malformed type: M.this.selfType#T
+ def all2: Stream[M {type T <: self.T}] = Stream.cons(self: actualSelfType, next.all2)
+
+ // compiles successfully
+ def all3: Stream[M {type T <: self.T}] = all3Impl(self: actualSelfType)
+ private def all3Impl(first: M {type T <: self.T}): Stream[M {type T <: self.T}] = Stream.cons(first, all3Impl(first.next))
+
+ def all4: Stream[M {type T <: self.T}] = Unrelated.all4Impl[T](self: actualSelfType)
+}
+
+// TODO!!! fix this bug for real, it compiles successfully, but weird types are inferred
+object Unrelated {
+ // compiles successfully
+ def all4Impl[U](first: M {type T <: U}): Stream[M {type T <: U}] = Stream.cons(first, all4Impl[U](first.next))
+
+ // should compile successfully without the [U], but:
+ // def all4ImplFail[U](first: M {type T <: U}): Stream[M {type T <: U}] = Stream.cons(first, all4ImplFail(first.next))
+ //
+ // test/files/pos/t1279a.scala:31: error: type mismatch;
+ // found : first.selfType
+ // (which expands to) M{type T <: first.T}
+ // required: M{type T <: Nothing}
+ // def all4ImplFail[U](first: M {type T <: U}): Stream[M {type T <: U}] = Stream.cons(first, all4ImplFail(first.next))
+ // ^
+ // one error found
+}
diff --git a/tests/pending/pos/t1280.scala b/tests/pending/pos/t1280.scala
new file mode 100644
index 000000000..39406b2e3
--- /dev/null
+++ b/tests/pending/pos/t1280.scala
@@ -0,0 +1 @@
+trait X { x => type T >: Null; new X { type T = Any with x.T } }
diff --git a/tests/pending/pos/t1292.scala b/tests/pending/pos/t1292.scala
new file mode 100644
index 000000000..83a996d53
--- /dev/null
+++ b/tests/pending/pos/t1292.scala
@@ -0,0 +1,33 @@
+trait Foo[T <: Foo[T, Enum], Enum <: Enumeration] {
+ type StV = Enum#Value
+ type Meta = MegaFoo[T, Enum]
+
+ type Slog <: Enumeration
+
+ def getSingleton: Meta
+}
+
+trait MegaFoo[T <: Foo[T, Enum], Enum <: Enumeration] extends Foo[T, Enum] {
+ def doSomething(what: T, misc: StV, dog: Meta#Event) = None
+ abstract class Event
+ object Event
+
+ def stateEnumeration: Slog
+ def se2: Enum
+}
+
+object E extends Enumeration {
+ val A = Value
+ val B = Value
+}
+
+class RFoo extends Foo[RFoo, E.type] {
+ def getSingleton = MegaRFoo
+
+ type Slog = E.type
+}
+
+object MegaRFoo extends RFoo with MegaFoo[RFoo, E.type] {
+ def stateEnumeration = E
+ def se2 = E
+}