diff options
author | Martin Odersky <odersky@gmail.com> | 2015-12-20 22:00:29 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2015-12-20 22:00:45 +0100 |
commit | e51b8845fb20fe3a4e1c655d4b72e2833906bbc2 (patch) | |
tree | 91bc16867d7a709566d8be80902b3256294cf338 /tests/new | |
parent | 581fee04f808d6f7759f98358e7475e6a58138e3 (diff) | |
download | dotty-e51b8845fb20fe3a4e1c655d4b72e2833906bbc2.tar.gz dotty-e51b8845fb20fe3a4e1c655d4b72e2833906bbc2.tar.bz2 dotty-e51b8845fb20fe3a4e1c655d4b72e2833906bbc2.zip |
The big pending/pos test triage
Diffstat (limited to 'tests/new')
-rw-r--r-- | tests/new/conforms.scala | 3 | ||||
-rw-r--r-- | tests/new/implicits.scala | 9 | ||||
-rw-r--r-- | tests/new/imports-pos.scala | 16 | ||||
-rw-r--r-- | tests/new/infer2-pos.scala | 7 | ||||
-rw-r--r-- | tests/new/looping-jsig.scala | 18 | ||||
-rw-r--r-- | tests/new/matthias1.scala | 15 | ||||
-rw-r--r-- | tests/new/michel6.scala | 6 | ||||
-rw-r--r-- | tests/new/moduletrans.scala | 8 | ||||
-rw-r--r-- | tests/new/package-implicit/ActorRef.scala | 7 | ||||
-rw-r--r-- | tests/new/package-implicit/DataFlow.scala | 7 | ||||
-rw-r--r-- | tests/new/package-implicit/package.scala | 6 | ||||
-rw-r--r-- | tests/new/patterns.scala | 38 | ||||
-rw-r--r-- | tests/new/patterns1.scala | 15 | ||||
-rw-r--r-- | tests/new/pmbug.scala | 8 | ||||
-rw-r--r-- | tests/new/private-types-after-typer.scala | 9 | ||||
-rw-r--r-- | tests/new/selftails.scala | 23 | ||||
-rw-r--r-- | tests/new/seqtest2.scala | 13 |
17 files changed, 196 insertions, 12 deletions
diff --git a/tests/new/conforms.scala b/tests/new/conforms.scala deleted file mode 100644 index f07488d28..000000000 --- a/tests/new/conforms.scala +++ /dev/null @@ -1,3 +0,0 @@ -object Test { - def f[A, B](x: A)(implicit e: <:<[A, B]): B = x -} diff --git a/tests/new/implicits.scala b/tests/new/implicits.scala deleted file mode 100644 index 1a3e0b4da..000000000 --- a/tests/new/implicits.scala +++ /dev/null @@ -1,9 +0,0 @@ -object Test { - - class X(i: Int) - - implicit def int2x(i: Int): X = new X(i) - - val x: X = Byte.MinValue - -} diff --git a/tests/new/imports-pos.scala b/tests/new/imports-pos.scala new file mode 100644 index 000000000..f6a55e5e0 --- /dev/null +++ b/tests/new/imports-pos.scala @@ -0,0 +1,16 @@ +package test; + +import java.lang.{System => S} + +object test { + import S.out.{print => p, println => print} + + val foo = 1; + + p("hello"); print("world"); S.out.println("!"); + S.out.flush(); +} +object test1 { + import test._; + foo +} diff --git a/tests/new/infer2-pos.scala b/tests/new/infer2-pos.scala new file mode 100644 index 000000000..2ce88be54 --- /dev/null +++ b/tests/new/infer2-pos.scala @@ -0,0 +1,7 @@ +package test +class Lst[T] +case class cons[T](x: T, xs: Lst[T]) extends Lst[T] +case class nil[T]() extends Lst[T] +object test { + Console.println(cons(1, nil())) +} diff --git a/tests/new/looping-jsig.scala b/tests/new/looping-jsig.scala new file mode 100644 index 000000000..6e3313c46 --- /dev/null +++ b/tests/new/looping-jsig.scala @@ -0,0 +1,18 @@ +import scala.collection.mutable._ + +trait BugTrack { + trait B[+T] + val cache : HashMap[A[_], B[_]] = HashMap.empty + + def A[T](f: Int => B[T]): A[T] + = new A[T]{def apply(in: Int) = f(in)} + + abstract class A[+T] extends (Int => B[T]) { + def giveMeSame = this + } + + def amethod[T](p: =>A[T]): A[T] = A(in => cache.get(p) match { + case Some(res) => res + case None => p(in) + }).giveMeSame.asInstanceOf[A[T]] +} diff --git a/tests/new/matthias1.scala b/tests/new/matthias1.scala new file mode 100644 index 000000000..a923a529f --- /dev/null +++ b/tests/new/matthias1.scala @@ -0,0 +1,15 @@ +class A() { + class B() { + def foo(x: B) = 0 + } +} +object test { + def main = { + val a = new A(); + val b = new a.B(); + val c = new a.B(); + val d = b.foo(c); + () + } +} + diff --git a/tests/new/michel6.scala b/tests/new/michel6.scala new file mode 100644 index 000000000..b32e8bed7 --- /dev/null +++ b/tests/new/michel6.scala @@ -0,0 +1,6 @@ +object M { + def f(x: Int): Unit = {} + + def g(): Int => Unit = + if (0 == 0) f else g() + } diff --git a/tests/new/moduletrans.scala b/tests/new/moduletrans.scala new file mode 100644 index 000000000..51538417e --- /dev/null +++ b/tests/new/moduletrans.scala @@ -0,0 +1,8 @@ +object m1 { + + class m() { + def f() = 5 + } + final val m: m = new m() + +} diff --git a/tests/new/package-implicit/ActorRef.scala b/tests/new/package-implicit/ActorRef.scala new file mode 100644 index 000000000..de57e61ce --- /dev/null +++ b/tests/new/package-implicit/ActorRef.scala @@ -0,0 +1,7 @@ +package t1000647.foo + +trait ActorRef { + def stop(): Unit = {} +} + +trait ScalaActorRef { self: ActorRef => } diff --git a/tests/new/package-implicit/DataFlow.scala b/tests/new/package-implicit/DataFlow.scala new file mode 100644 index 000000000..d948280d0 --- /dev/null +++ b/tests/new/package-implicit/DataFlow.scala @@ -0,0 +1,7 @@ +package t1000647.bar + +import t1000647.foo.{ScalaActorRef} + +object DataFlow { + def foo(ref: ScalaActorRef) = ref.stop() +} diff --git a/tests/new/package-implicit/package.scala b/tests/new/package-implicit/package.scala new file mode 100644 index 000000000..d0f28b36b --- /dev/null +++ b/tests/new/package-implicit/package.scala @@ -0,0 +1,6 @@ +package t1000647 + +package object foo { + implicit def scala2ActorRef(ref: ScalaActorRef): ActorRef = + ref.asInstanceOf[ActorRef] +} diff --git a/tests/new/patterns.scala b/tests/new/patterns.scala new file mode 100644 index 000000000..547d692d8 --- /dev/null +++ b/tests/new/patterns.scala @@ -0,0 +1,38 @@ +trait Option[+a] {} + +case class Some[a](x: a) extends Option[a] { + override def toString(): String = "Some(" + x + ")" + override def equals(that: Any): Boolean = that match { + case Some(x) => this.x == x + case _ => false + } + override def hashCode(): Int = getClass().hashCode() * 41 + x.hashCode() +} + +case object None extends Option[Nothing] { + override def toString(): String = "None" + override def equals(that: Any) = that match { + case None => true + case _ => false + } + override def hashCode(): Int = getClass().hashCode() +} + +object test { + + def println(str: String): Unit = java.lang.System.out.println(str) + + def print(opt: Option[String]) = opt match { + case Some(x) => println(x) + case None => println("nothing") + } +} + +// if bodies are duplicated, then we would get an error like "double definition" + +trait John[A,B] { + def filter(x:Any) = x match { + case (x::xs, _) => "ga" + case _ => {x:String => "foobar"} + } +} diff --git a/tests/new/patterns1.scala b/tests/new/patterns1.scala new file mode 100644 index 000000000..f660ea054 --- /dev/null +++ b/tests/new/patterns1.scala @@ -0,0 +1,15 @@ +trait Option[+a] + +case class Some[a](x: a) extends Option[a] + +case object None extends Option[Nothing] + +object test { + + def println(str: String): Unit = java.lang.System.out.println(str) + + def print(opt: Option[String]) = opt match { + case Some(x) => println(x) + case None => println("nothing") + } +} diff --git a/tests/new/pmbug.scala b/tests/new/pmbug.scala new file mode 100644 index 000000000..7d94e7a8b --- /dev/null +++ b/tests/new/pmbug.scala @@ -0,0 +1,8 @@ +object Test { + + def flatten[a](l: List[List[a]]): List[a] = l match { + case Nil => Nil + case head :: tail => head ::: flatten(tail) + } + +} diff --git a/tests/new/private-types-after-typer.scala b/tests/new/private-types-after-typer.scala new file mode 100644 index 000000000..5c20cac2a --- /dev/null +++ b/tests/new/private-types-after-typer.scala @@ -0,0 +1,9 @@ +// Testing that the type of the outer accessor in O2 +// doesn't crash the compiler over private type escaping scope. +trait T { + class C { + private object O1 { + object O2 + } + } +} diff --git a/tests/new/selftails.scala b/tests/new/selftails.scala new file mode 100644 index 000000000..a4253b80c --- /dev/null +++ b/tests/new/selftails.scala @@ -0,0 +1,23 @@ +package net.liftweb.util + +/** +* This trait adds functionality to Scala standard types +*/ +trait BasicTypesHelpers { self: StringHelpers with ControlHelpers => + + /** + * Compare two arrays of Byte for byte equality. + * @return true if two Byte arrays contain the same bytes + */ + def isEq(a: Array[Byte], b: Array[Byte]) = { + def eq(a: Array[Byte], b: Array[Byte], pos: Int, len: Int): Boolean = { + if (pos == len) true + else if (a(pos) != b(pos)) false + else eq(a , b, pos + 1, len) + } + a.length == b.length && eq(a, b, 0, a.length) + } +} + +trait StringHelpers +trait ControlHelpers diff --git a/tests/new/seqtest2.scala b/tests/new/seqtest2.scala new file mode 100644 index 000000000..239b1b581 --- /dev/null +++ b/tests/new/seqtest2.scala @@ -0,0 +1,13 @@ +object test { + + val b = List(1, 2, 3); + + def main(args: Array[String]) = + Console.println( + b match { + case List(1, 2, 3) => true; + case _ => false; + } + ) + +} |