diff options
author | Paul Phillips <paulp@improving.org> | 2012-05-03 17:11:30 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-05-03 17:15:31 -0700 |
commit | 8bc8b83f0bd7daef62b41b4a0c87b4e9b7344284 (patch) | |
tree | 4f445792891bd6945ce8132b97a0231a8cf54392 /test/pending/run | |
parent | 58f6a1346093db2f407879246884d480ff8d7904 (diff) | |
download | scala-8bc8b83f0bd7daef62b41b4a0c87b4e9b7344284.tar.gz scala-8bc8b83f0bd7daef62b41b4a0c87b4e9b7344284.tar.bz2 scala-8bc8b83f0bd7daef62b41b4a0c87b4e9b7344284.zip |
Moved passing tests from pending to files.
Most are pattern matcher bugs fixed by virtpatmat. A few are reifier,
package object, or miscellaneous. I threw in an original test for
SI-2337, to go with those for SI-1697, SI-3705, SI-4415, and SI-1357,
all of which (in the interests of making sure this basket has all the
eggs) I am closing.
Diffstat (limited to 'test/pending/run')
-rw-r--r-- | test/pending/run/reify_csv.check | 10 | ||||
-rw-r--r-- | test/pending/run/reify_csv.scala | 35 | ||||
-rw-r--r-- | test/pending/run/reify_lazyevaluation.check | 8 | ||||
-rw-r--r-- | test/pending/run/reify_lazyevaluation.scala | 58 | ||||
-rw-r--r-- | test/pending/run/reify_properties.check | 2 | ||||
-rw-r--r-- | test/pending/run/reify_properties.scala | 56 | ||||
-rw-r--r-- | test/pending/run/t1697.scala | 19 | ||||
-rw-r--r-- | test/pending/run/t3705.scala | 17 | ||||
-rw-r--r-- | test/pending/run/t4415.scala | 86 | ||||
-rw-r--r-- | test/pending/run/t5258a.check | 1 | ||||
-rw-r--r-- | test/pending/run/t5258a.scala | 7 |
11 files changed, 0 insertions, 299 deletions
diff --git a/test/pending/run/reify_csv.check b/test/pending/run/reify_csv.check deleted file mode 100644 index b56f4bb50b..0000000000 --- a/test/pending/run/reify_csv.check +++ /dev/null @@ -1,10 +0,0 @@ -List(phase name, id, description) -record(parser,1,parse source into ASTs, perform simple desugaring) -record(namer,2,resolve names, attach symbols to named trees) -record(packageobjects,3,load package objects) -record(typer,4,the meat and potatoes: type the trees) -record(superaccessors,5,add super accessors in traits and nested classes) -record(pickler,6,serialize symbol tables) -record(refchecks,7,reference/override checking, translate nested objects) -record(selectiveanf,8,) -record(liftcode,9,reify trees) diff --git a/test/pending/run/reify_csv.scala b/test/pending/run/reify_csv.scala deleted file mode 100644 index 966521575c..0000000000 --- a/test/pending/run/reify_csv.scala +++ /dev/null @@ -1,35 +0,0 @@ -import scala.reflect.mirror._ - -object Test extends App { - val csv = """ - | phase name; id; description - | parser; 1; parse source into ASTs, perform simple desugaring - | namer; 2; resolve names, attach symbols to named trees - |packageobjects; 3; load package objects - | typer; 4; the meat and potatoes: type the trees - |superaccessors; 5; add super accessors in traits and nested classes - | pickler; 6; serialize symbol tables - | refchecks; 7; reference/override checking, translate nested objects - | selectiveanf; 8; - | liftcode; 9; reify trees""".stripMargin.split("\n").map{_.trim()}.drop(1).toList - - val fields = csv.head.split(";").map{_.trim()}.toList - println(fields) - - reify({ - object Csv { - case class record(`phase name`: String, id: String, description: String) - - object record { - def parse(lines: List[String]) = { - lines drop(1) map { line => line.split(";", -1).toList match { - case phase$whitespace$name :: id :: description :: _ => record(phase$whitespace$name.trim(), id.trim(), description.trim()) - case _ => throw new Exception("format error") - }} - } - } - } - - Csv.record.parse(csv) foreach println - }).eval -} diff --git a/test/pending/run/reify_lazyevaluation.check b/test/pending/run/reify_lazyevaluation.check deleted file mode 100644 index 1c7f96cd96..0000000000 --- a/test/pending/run/reify_lazyevaluation.check +++ /dev/null @@ -1,8 +0,0 @@ -s = Susp(?) -evaluating... -s() = 3 -s = Susp(3) -2 + s = 5 -sl2 = Susp(?) -sl2() = Some(3) -sl2 = Susp(Some(3)) diff --git a/test/pending/run/reify_lazyevaluation.scala b/test/pending/run/reify_lazyevaluation.scala deleted file mode 100644 index 1a0c858914..0000000000 --- a/test/pending/run/reify_lazyevaluation.scala +++ /dev/null @@ -1,58 +0,0 @@ -import scala.reflect.mirror._ - -object Test extends App { - reify { - object lazyLib { - - /** Delay the evaluation of an expression until it is needed. */ - def delay[A](value: => A): Susp[A] = new SuspImpl[A](value) - - /** Get the value of a delayed expression. */ - implicit def force[A](s: Susp[A]): A = s() - - /** - * Data type of suspended computations. (The name froms from ML.) - */ - abstract class Susp[+A] extends Function0[A] - - /** - * Implementation of suspended computations, separated from the - * abstract class so that the type parameter can be invariant. - */ - class SuspImpl[A](lazyValue: => A) extends Susp[A] { - private var maybeValue: Option[A] = None - - override def apply() = maybeValue match { - case None => - val value = lazyValue - maybeValue = Some(value) - value - case Some(value) => - value - } - - override def toString() = maybeValue match { - case None => "Susp(?)" - case Some(value) => "Susp(" + value + ")" - } - } - } - - import lazyLib._ - - val s: Susp[Int] = delay { println("evaluating..."); 3 } - - println("s = " + s) // show that s is unevaluated - println("s() = " + s()) // evaluate s - println("s = " + s) // show that the value is saved - println("2 + s = " + (2 + s)) // implicit call to force() - - val sl = delay { Some(3) } - val sl1: Susp[Some[Int]] = sl - val sl2: Susp[Option[Int]] = sl1 // the type is covariant - - println("sl2 = " + sl2) - println("sl2() = " + sl2()) - println("sl2 = " + sl2) - }.eval -} diff --git a/test/pending/run/reify_properties.check b/test/pending/run/reify_properties.check deleted file mode 100644 index d769bea4b0..0000000000 --- a/test/pending/run/reify_properties.check +++ /dev/null @@ -1,2 +0,0 @@ -user1: MR. ROBERT <noname> -user2: MR. BOB KUZ diff --git a/test/pending/run/reify_properties.scala b/test/pending/run/reify_properties.scala deleted file mode 100644 index 5cacc262ac..0000000000 --- a/test/pending/run/reify_properties.scala +++ /dev/null @@ -1,56 +0,0 @@ -import scala.reflect.mirror._ - -object Test extends App { - reify { - /** A mutable property whose getter and setter may be customized. */ - case class Property[T](init: T) { - private var value: T = init - - /** The getter function, defaults to identity. */ - private var setter: T => T = identity[T] - - /** The setter function, defaults to identity. */ - private var getter: T => T = identity[T] - - /** Retrive the value held in this property. */ - def apply(): T = getter(value) - - /** Update the value held in this property, through the setter. */ - def update(newValue: T) = value = setter(newValue) - - /** Change the getter. */ - def get(newGetter: T => T) = { getter = newGetter; this } - - /** Change the setter */ - def set(newSetter: T => T) = { setter = newSetter; this } - } - - class User { - // Create a property with custom getter and setter - val firstname = Property("") - .get { v => v.toUpperCase() } - .set { v => "Mr. " + v } - val lastname = Property("<noname>") - - /** Scala provides syntactic sugar for calling 'apply'. Simply - * adding a list of arguments between parenthesis (in this case, - * an empty list) is translated to a call to 'apply' with those - * arguments. - */ - override def toString() = firstname() + " " + lastname() - } - - val user1 = new User - - // Syntactic sugar for 'update': an assignment is translated to a - // call to method 'update' - user1.firstname() = "Robert" - - val user2 = new User - user2.firstname() = "bob" - user2.lastname() = "KUZ" - - println("user1: " + user1) - println("user2: " + user2) - }.eval -} diff --git a/test/pending/run/t1697.scala b/test/pending/run/t1697.scala deleted file mode 100644 index 01590dd405..0000000000 --- a/test/pending/run/t1697.scala +++ /dev/null @@ -1,19 +0,0 @@ -class Term -case class Num(n: Int) extends Term -case class Add(x: Term, y: Term) extends Term - -object Value { - def unapply(term: Any): Boolean = true -} - -object Test { - def main(args: Array[String]) { - val term = Add(Num(1), Add(Num(2), Num(3))) - val res = term match { - case Add(Num(x), Num(y)) => "Add(Num, Num)" - case Add(Value(), y) => "Add(Value, ?)" - case _ => "?" - } - assert(res == "Add(Value, ?)") - } -} diff --git a/test/pending/run/t3705.scala b/test/pending/run/t3705.scala deleted file mode 100644 index fcc020f28c..0000000000 --- a/test/pending/run/t3705.scala +++ /dev/null @@ -1,17 +0,0 @@ -// package foo - -import scala.xml._ -object Test { - def updateNodes(ns: Seq[Node]): Seq[Node] = - for(subnode <- ns) yield subnode match { - case <d>{_}</d> if true => <d>abc</d> - case Elem(prefix, label, attribs, scope, children @ _*) => - Elem(prefix, label, attribs, scope, updateNodes(children) : _*) - case other => other - } - def main(args: Array[String]): Unit = { - updateNodes(<b />) - - } -} - diff --git a/test/pending/run/t4415.scala b/test/pending/run/t4415.scala deleted file mode 100644 index f96031d650..0000000000 --- a/test/pending/run/t4415.scala +++ /dev/null @@ -1,86 +0,0 @@ -/** - * Demonstration of issue with Extractors. If lines 15/16 are not present, get at runtime: - * - * Exception in thread "main" java.lang.VerifyError: (class: ExtractorIssue$$, method: convert signature: (LTopProperty;)LMyProp;) Accessing value from uninitialized register 5 - * at ExtractorIssue.main(ExtractorIssue.scala) - * at com.intellij.rt.execution.application.AppMain.main(AppMain.java:115)] - * - * If lines 15/16 are present, the compiler crashes: - * - * fatal error (server aborted): not enough arguments for method body%3: (val p: MyProp[java.lang.String])MyProp[_33]. - * Unspecified value parameter p. - */ -object Test { - - def main(args: Array[String]) { - convert(new SubclassProperty) - } - - def convert(prop: TopProperty): MyProp[_] = { - prop match { - - /////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //case SubclassSecondMatch(p) => p // if these lines are present, the compiler crashes. If commented, unsafe byte - //case SecondMatch(p) => p // byte code is generated, which causes a java.lang.VerifyError at runtime - /////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - case SubclassMatch(p) => p - case StandardMatch(p) => p - } - } -} - -class TopProperty - -class StandardProperty extends TopProperty -class SubclassProperty extends StandardProperty - -class SecondProperty extends TopProperty -class SubclassSecondProperty extends StandardProperty - -trait MyProp[T] -case class MyPropImpl[T] extends MyProp[T] - -object SubclassMatch { - - def unapply(prop: SubclassProperty) : Option[MyProp[String]] = { - Some(new MyPropImpl) - } - - def apply(prop: MyProp[String]) : SubclassProperty = { - new SubclassProperty() - } -} - -object StandardMatch { - - def unapply(prop: StandardProperty) : Option[MyProp[String]] = { - Some(new MyPropImpl) - } - - def apply(prop: MyProp[String]) : StandardProperty = { - new StandardProperty() - } -} - -object SubclassSecondMatch { - - def unapply(prop: SubclassSecondProperty) : Option[MyProp[BigInt]] = { - Some(new MyPropImpl) - } - - def apply(prop: MyProp[String]) : SubclassSecondProperty = { - new SubclassSecondProperty() - } -} - -object SecondMatch { - - def unapply(prop: SecondProperty) : Option[MyProp[BigInt]] = { - Some(new MyPropImpl) - } - - def apply(prop: MyProp[String]) : SecondProperty = { - new SecondProperty() - } -}
\ No newline at end of file diff --git a/test/pending/run/t5258a.check b/test/pending/run/t5258a.check deleted file mode 100644 index 4e0b2da04c..0000000000 --- a/test/pending/run/t5258a.check +++ /dev/null @@ -1 +0,0 @@ -int
\ No newline at end of file diff --git a/test/pending/run/t5258a.scala b/test/pending/run/t5258a.scala deleted file mode 100644 index 127829c724..0000000000 --- a/test/pending/run/t5258a.scala +++ /dev/null @@ -1,7 +0,0 @@ -import scala.reflect.mirror._ - -object Test extends App { - reify { - println(classOf[Int]) - }.eval -}
\ No newline at end of file |