aboutsummaryrefslogtreecommitdiff
path: root/tests/pos
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-03-16 21:42:10 +0100
committerTobias Schlatter <tobias@meisch.ch>2014-03-21 11:28:30 +0100
commit90f430bfb9178e49dc112bacf5b250d0780dcd1e (patch)
tree49fef9cac0869ae34f33c964c38089ddbb9d1689 /tests/pos
parent7bf837c79315e5db7e049f3ffeb6c6842d18880c (diff)
downloaddotty-90f430bfb9178e49dc112bacf5b250d0780dcd1e.tar.gz
dotty-90f430bfb9178e49dc112bacf5b250d0780dcd1e.tar.bz2
dotty-90f430bfb9178e49dc112bacf5b250d0780dcd1e.zip
More tests
which all pass.
Diffstat (limited to 'tests/pos')
-rw-r--r--tests/pos/t0710.scala10
-rw-r--r--tests/pos/t0770.scala13
-rw-r--r--tests/pos/t0851.scala14
-rw-r--r--tests/pos/t0872.scala8
-rw-r--r--tests/pos/t0904.scala17
-rw-r--r--tests/pos/t0905.scala6
6 files changed, 68 insertions, 0 deletions
diff --git a/tests/pos/t0710.scala b/tests/pos/t0710.scala
new file mode 100644
index 000000000..d550d63f9
--- /dev/null
+++ b/tests/pos/t0710.scala
@@ -0,0 +1,10 @@
+object t0710 {
+ def method: Unit = {
+ sealed class Parent
+ case object Child extends Parent
+ val x: Parent = Child
+ x match {
+ case Child => ()
+ }
+ }
+}
diff --git a/tests/pos/t0770.scala b/tests/pos/t0770.scala
new file mode 100644
index 000000000..7a0a2bf9b
--- /dev/null
+++ b/tests/pos/t0770.scala
@@ -0,0 +1,13 @@
+trait A
+{
+ private[this] val p = 5
+
+ def f = (b: Byte) => p
+}
+
+trait B
+{
+ def failure: Boolean
+ def success = !failure
+}
+
diff --git a/tests/pos/t0851.scala b/tests/pos/t0851.scala
new file mode 100644
index 000000000..fdc504af7
--- /dev/null
+++ b/tests/pos/t0851.scala
@@ -0,0 +1,14 @@
+package test
+
+object test1 {
+ case class Foo[T,T2](f : (T,T2) => String) extends (((T,T2)) => String){
+ def apply(t : T) = (s:T2) => f(t,s)
+ def apply(p : (T,T2)) = f(p._1,p._2)
+ }
+ implicit def g[T](f : (T,String) => String): Foo[T, String] = Foo(f)
+ def main(args : Array[String]) : Unit = {
+ val f = (x:Int,s:String) => s + x
+ println(f(1))
+ ()
+ }
+}
diff --git a/tests/pos/t0872.scala b/tests/pos/t0872.scala
new file mode 100644
index 000000000..ccaee8052
--- /dev/null
+++ b/tests/pos/t0872.scala
@@ -0,0 +1,8 @@
+object Main {
+ def main(args : Array[String]): Unit = {
+ val fn = (a : Int, str : String) => "a: " + a + ", str: " + str
+ implicit def fx[T](f : (T,String) => String): T => String = (x:T) => f(x,null)
+ println(fn(1))
+ ()
+ }
+}
diff --git a/tests/pos/t0904.scala b/tests/pos/t0904.scala
new file mode 100644
index 000000000..28ad30fc2
--- /dev/null
+++ b/tests/pos/t0904.scala
@@ -0,0 +1,17 @@
+trait A {
+ def apply(x: Int): Int
+ def update(x: Int, y: Int): Unit
+}
+
+trait B extends A
+
+abstract class Foo {
+ val a: A = null
+ val b: B = null
+
+ a(0) = 1
+ b(0) = 1
+
+ a(0) += 1
+ b(0) += 1 // this one does not type check.
+}
diff --git a/tests/pos/t0905.scala b/tests/pos/t0905.scala
new file mode 100644
index 000000000..3800c6e0b
--- /dev/null
+++ b/tests/pos/t0905.scala
@@ -0,0 +1,6 @@
+object Test {
+ trait A[T]
+ def f(implicit p: A[_]) = null
+ implicit val x: A[_] = null
+ println(f)
+}