diff options
author | Burak Emir <emir@epfl.ch> | 2007-01-24 15:20:25 +0000 |
---|---|---|
committer | Burak Emir <emir@epfl.ch> | 2007-01-24 15:20:25 +0000 |
commit | 0ef0f40ae31bf8a1e3d5b9c6eea7ef5b5a073192 (patch) | |
tree | 0bb95122566e05dcc1f81322f3a3740d2e1a81cd /test/pending/pos | |
parent | 1cbef2171c91fd0e001b4d0c1570c07017877044 (diff) | |
download | scala-0ef0f40ae31bf8a1e3d5b9c6eea7ef5b5a073192.tar.gz scala-0ef0f40ae31bf8a1e3d5b9c6eea7ef5b5a073192.tar.bz2 scala-0ef0f40ae31bf8a1e3d5b9c6eea7ef5b5a073192.zip |
moved working tests to files
Diffstat (limited to 'test/pending/pos')
-rw-r--r-- | test/pending/pos/bug402.scala | 7 | ||||
-rw-r--r-- | test/pending/pos/bug419.scala | 11 | ||||
-rw-r--r-- | test/pending/pos/bug430.scala | 20 | ||||
-rw-r--r-- | test/pending/pos/bug443.scala | 14 | ||||
-rw-r--r-- | test/pending/pos/bug796.scala | 26 | ||||
-rw-r--r-- | test/pending/pos/gosh.scala | 44 | ||||
-rw-r--r-- | test/pending/pos/init.scala | 14 | ||||
-rw-r--r-- | test/pending/pos/unapplyComplex.scala | 37 | ||||
-rw-r--r-- | test/pending/pos/unapplyContexts2.scala | 11 | ||||
-rw-r--r-- | test/pending/pos/unapplyGeneric.scala | 11 | ||||
-rw-r--r-- | test/pending/pos/unapplyNeedsMemberType.scala | 25 | ||||
-rw-r--r-- | test/pending/pos/unapplySeq.scala | 26 |
12 files changed, 0 insertions, 246 deletions
diff --git a/test/pending/pos/bug402.scala b/test/pending/pos/bug402.scala deleted file mode 100644 index a5a3df4825..0000000000 --- a/test/pending/pos/bug402.scala +++ /dev/null @@ -1,7 +0,0 @@ -object Main { - def main(args: Array[String]): Unit = { - val x: Any = 2 - System.out.println((0.5).isInstanceOf[Int]); - System.out.println(x.isInstanceOf[Int]); - } -} diff --git a/test/pending/pos/bug419.scala b/test/pending/pos/bug419.scala deleted file mode 100644 index 65dcb04356..0000000000 --- a/test/pending/pos/bug419.scala +++ /dev/null @@ -1,11 +0,0 @@ -trait Bar { - class Config {} - var config: Config; // aha, traits can have variables? -} - -object Foo extends Bar { - - class FooConfig extends Config; - var config: Config = new FooConfig() // or not - -} diff --git a/test/pending/pos/bug430.scala b/test/pending/pos/bug430.scala deleted file mode 100644 index 7e3e7eaaec..0000000000 --- a/test/pending/pos/bug430.scala +++ /dev/null @@ -1,20 +0,0 @@ -object Test extends Application { - def foo[T <% Ordered[T]](x: T): Unit = System.out.println(""+(x < x)+" "+(x <= x)) - def bar(x: Unit ): Unit = foo(x); - def bar(x: Boolean): Unit = foo(x); - def bar(x: Byte ): Unit = foo(x); - def bar(x: Short ): Unit = foo(x); - def bar(x: Int ): Unit = foo(x); - def bar(x: Long ): Unit = foo(x); - def bar(x: Float ): Unit = foo(x); - def bar(x: Double ): Unit = foo(x); - bar(()) - bar(true) - bar(1: byte) - bar(1: short) - bar('a') - bar(1) - bar(1l) - bar(1.0f) - bar(1.0) -} diff --git a/test/pending/pos/bug443.scala b/test/pending/pos/bug443.scala deleted file mode 100644 index 5b83e9d2cb..0000000000 --- a/test/pending/pos/bug443.scala +++ /dev/null @@ -1,14 +0,0 @@ -object Test { - - def lookup(): Option[Pair[String, String]] = - (null: Option[Pair[String, String]]) match { - case Some(Pair(_, _)) => - if (true) - Some(Pair(null, null)) - else - lookup() match { - case Some(_) => Some(null) - case None => None - } - } -} diff --git a/test/pending/pos/bug796.scala b/test/pending/pos/bug796.scala deleted file mode 100644 index 756c103e7c..0000000000 --- a/test/pending/pos/bug796.scala +++ /dev/null @@ -1,26 +0,0 @@ -/** I know what I am doing is wrong -- since I am about to look into - * this bug, I add a test in pending/pos... however, I am afraid that - * once this bug is fixed, this test case might go into test/pos - * there it adds to the huge number of tiny little test cases. - * - * Ideally, an option in the bugtracking system would automatically - * handle "pos" bugs. - */ -object Test extends Application { - - object Twice { - def apply(x: int) = x * 2 - def unapply(x: int): Option[Tuple1[int]] = - if (x % 2 == 0) Some(Tuple1(x / 2)) - else None - } - - def test(x: int) = x match { - case Twice(y) => "x is two times "+y - case _ => "x is odd" - } - - Console.println(test(3)) - Console.println(test(4)) - -} diff --git a/test/pending/pos/gosh.scala b/test/pending/pos/gosh.scala deleted file mode 100644 index c4cd3df80b..0000000000 --- a/test/pending/pos/gosh.scala +++ /dev/null @@ -1,44 +0,0 @@ -object ShapeTest extends Application { - - class Point(x : int, y : int) { - override def toString() = "[" + x + "," + y + "]" - } - - abstract class Shape { - def draw() : unit - } - - class Line(s : Point, e : Point) extends Shape { - def draw() : unit = { Console.println("draw line " + s + "," + e) } - } - - abstract class Foo { - type T <: Object - - def show(o : T) : unit - def print() : unit = {Console.println("in Foo")} - } - - abstract class ShapeFoo extends Foo { - type T <: Shape - def show(o : T) : unit = { o.draw() } - override def print() : unit = {Console.println("in ShapeFoo")} - } - - class LineFoo extends ShapeFoo { - type T = Line - override def print() : unit = {Console.println("in LineFoo")} - } - - val p1 = new Point(1,4) - val p2 = new Point(12, 28) - - val l1 = new Line(p1, p2) - - - val l = new ShapeFoo{ // ** // - type T = Line // ** // - override def print() : unit = {Console.println("in LineFoo")} // ** // - } - l.show(l1) // ** // -} diff --git a/test/pending/pos/init.scala b/test/pending/pos/init.scala deleted file mode 100644 index c51446c804..0000000000 --- a/test/pending/pos/init.scala +++ /dev/null @@ -1,14 +0,0 @@ -class Foo { - - var cnt = 0 - - class Bar { - cnt = cnt + 1 - val id = cnt - } -} - -object Test extends Application { - val foo = new Foo - Console.println((new foo.Bar).id) -} diff --git a/test/pending/pos/unapplyComplex.scala b/test/pending/pos/unapplyComplex.scala deleted file mode 100644 index 54080eb86f..0000000000 --- a/test/pending/pos/unapplyComplex.scala +++ /dev/null @@ -1,37 +0,0 @@ -trait Complex extends Product2[double,double] - -class ComplexRect(val _1:double, val _2:double) extends Complex { - override def toString = "ComplexRect("+_1+","+_2+")" -} - -class ComplexPolar(val _1:double, val _2:double) extends Complex { - override def toString = "ComplexPolar("+_1+","+_2+")" -} - -object ComplexRect { - def unapply(z:Complex): Option[Complex] = { - if(z.isInstanceOf[ComplexRect]) Some(z) else z match { - case ComplexPolar(mod, arg) => - Some(new ComplexRect(mod*Math.cos(arg), mod*Math.sin(arg))) -} } } - -object ComplexPolar { - def unapply(z:Complex): Option[Complex] = { - if(z.isInstanceOf[ComplexPolar]) Some(z) else z match { - case ComplexRect(re,im) => - Some(new ComplexPolar(Math.sqrt(re*re + im*im), Math.atan(re/im))) -} } } - -object Test { - def main(args:Array[String]) = { - new ComplexRect(1,1) match { - case ComplexPolar(mod,arg) => // z @ ??? - Console.println("mod"+mod+"arg"+arg) - } - val Komplex = ComplexRect - new ComplexPolar(Math.sqrt(2),Math.Pi / 4.0) match { - case Komplex(re,im) => // z @ ??? - Console.println("re"+re+" im"+im) - } - } -} diff --git a/test/pending/pos/unapplyContexts2.scala b/test/pending/pos/unapplyContexts2.scala deleted file mode 100644 index fcf1e2ff62..0000000000 --- a/test/pending/pos/unapplyContexts2.scala +++ /dev/null @@ -1,11 +0,0 @@ -trait Analyzer { - val WILDCARD = "23" -} - -trait Contexts2 requires Analyzer { - class Context { - def collect(sels: List[String]): List[String] = sels match { - case List(WILDCARD) => val dummy = WILDCARD; Nil - } - } -} diff --git a/test/pending/pos/unapplyGeneric.scala b/test/pending/pos/unapplyGeneric.scala deleted file mode 100644 index bf88816885..0000000000 --- a/test/pending/pos/unapplyGeneric.scala +++ /dev/null @@ -1,11 +0,0 @@ -object Bar { - def unapply[A,B](bar:Bar[A,B]) = Some(bar) -} - -class Bar[A,B](val _1:A, val _2:B) extends Product2[A,B] - -object Test { - new Bar(2, 'a') match { - case Bar(x,y) => - } -} diff --git a/test/pending/pos/unapplyNeedsMemberType.scala b/test/pending/pos/unapplyNeedsMemberType.scala deleted file mode 100644 index b423257e04..0000000000 --- a/test/pending/pos/unapplyNeedsMemberType.scala +++ /dev/null @@ -1,25 +0,0 @@ -// error with -Xunapply, (because of missing call to memberType?) - -trait Gunk[a] { - - type Seq - - object Cons { - def unapply(s: Seq) = unapply_Cons(s) - } - def unapply_Cons(s: Any): Option[Tuple2[a, Seq]] -} - -class Join[a] extends Gunk[a] { - type Seq = JoinSeq - - abstract class JoinSeq - case class App(xs: Seq, ys: Seq) extends JoinSeq - - def append(s1: Seq, s2: Seq): Seq = s1 // mock implementation - - def unapply_Cons(s: Any) = s match { - case App(Cons(x, xs), ys) => Some(Pair(x, append(xs, ys))) - case _ => null - } -} diff --git a/test/pending/pos/unapplySeq.scala b/test/pending/pos/unapplySeq.scala deleted file mode 100644 index aac211de5a..0000000000 --- a/test/pending/pos/unapplySeq.scala +++ /dev/null @@ -1,26 +0,0 @@ -object FooSeq { - def unapplySeq(x:Any): Option[Product2[Int,Seq[String]]] = { - if(x.isInstanceOf[Bar]) { - val y = x.asInstanceOf[Bar] - Some({y.size, y.name}) - } else None - } - - def main(args:Array[String]) = { - val b = new Bar - b match { - case FooSeq(s:Int,_,n:String) => Console.println("size "+s+" name "+n) - } - b.size = 54 - b.name = List("large","L") - b match { - case FooSeq(s:Int,_,n:String) => Console.println("size "+s+" name "+n) - } - } -} - -class Bar { - var size: Int = 50 - var name: Seq[String] = List("medium","M") -} - |