diff options
Diffstat (limited to 'test/pending/run')
29 files changed, 187 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/t4560.scala b/test/pending/run/t4560.scala new file mode 100644 index 0000000000..fe62136319 --- /dev/null +++ b/test/pending/run/t4560.scala @@ -0,0 +1,9 @@ +trait B { + this: Test.type => + + def y = new { def f() = () } + def fail() = y.f() +} +object Test extends B { + def main(args: Array[String]): Unit = fail() +}
\ No newline at end of file diff --git a/test/pending/run/t4728.check b/test/pending/run/t4728.check new file mode 100644 index 0000000000..7a754f414c --- /dev/null +++ b/test/pending/run/t4728.check @@ -0,0 +1,2 @@ +1 +2
\ No newline at end of file diff --git a/test/pending/run/t4728.scala b/test/pending/run/t4728.scala new file mode 100644 index 0000000000..36f7860613 --- /dev/null +++ b/test/pending/run/t4728.scala @@ -0,0 +1,11 @@ +class X +class Y extends X +object Ambiguous { + def f(x: X) = 1 + def f(ys: Y*) = 2 +} + +object Test extends App { + println(Ambiguous.f(new X)) + println(Ambiguous.f(new Y)) +}
\ 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 diff --git a/test/pending/run/t5610a.check b/test/pending/run/t5610a.check new file mode 100644 index 0000000000..2aa46b3b91 --- /dev/null +++ b/test/pending/run/t5610a.check @@ -0,0 +1 @@ +Stroke a kitten diff --git a/test/pending/run/t5610a.scala b/test/pending/run/t5610a.scala new file mode 100644 index 0000000000..f20b295762 --- /dev/null +++ b/test/pending/run/t5610a.scala @@ -0,0 +1,19 @@ +object Test extends App { + class Result(_str: => String) { + lazy val str = _str + } + + def foo(str: => String)(i: Int) = new Result(str) + + def bar(f: Int => Result) = f(42) + + var test: String = null + val result = bar(foo(test)) + test = "bar" + + if (result.str == null) { + println("Destroy ALL THE THINGS!!!") + } else { + println("Stroke a kitten") + } +}
\ No newline at end of file diff --git a/test/pending/run/t5610b.check b/test/pending/run/t5610b.check new file mode 100644 index 0000000000..2aa46b3b91 --- /dev/null +++ b/test/pending/run/t5610b.check @@ -0,0 +1 @@ +Stroke a kitten diff --git a/test/pending/run/t5610b.scala b/test/pending/run/t5610b.scala new file mode 100644 index 0000000000..d922d6333c --- /dev/null +++ b/test/pending/run/t5610b.scala @@ -0,0 +1,21 @@ +object Bug { + def main(args: Array[String]) { + var test: String = null + val result = bar(foo(test)) + test = "bar" + + if (result.str == null) { + println("Destroy ALL THE THINGS!!!") + } else { + println("Stroke a kitten") + } + } + + class Result(_str: => String) { + lazy val str = _str + } + + def foo(str: => String)(i: Int) = new Result(str) + + def bar(f: Int => Result) = f(42) +}
\ No newline at end of file diff --git a/test/pending/run/t5676.flags b/test/pending/run/t5676.flags new file mode 100644 index 0000000000..e1b37447c9 --- /dev/null +++ b/test/pending/run/t5676.flags @@ -0,0 +1 @@ +-Xexperimental
\ No newline at end of file diff --git a/test/pending/run/t5676.scala b/test/pending/run/t5676.scala new file mode 100644 index 0000000000..3ff498eaa2 --- /dev/null +++ b/test/pending/run/t5676.scala @@ -0,0 +1,25 @@ + + + + +class Bar[T] + + +class Foo[T] { + object A extends Bar[T] +} + + +class Baz[S] extends Foo[S] { + override object A extends Bar[S] +} + + +object Test { + + def main(a: Array[String]) { + val b = new Baz[Any] + println(b) + } + +} diff --git a/test/pending/run/t5695.check b/test/pending/run/t5695.check new file mode 100644 index 0000000000..d50069ab4f --- /dev/null +++ b/test/pending/run/t5695.check @@ -0,0 +1,2 @@ +.. +.. diff --git a/test/pending/run/t5695/part_1.scala b/test/pending/run/t5695/part_1.scala new file mode 100644 index 0000000000..b8e8f8e52f --- /dev/null +++ b/test/pending/run/t5695/part_1.scala @@ -0,0 +1,12 @@ +import language.experimental.macros +import scala.reflect.makro.Context + +object Defs { + + def mkInt = macro mkIntImpl + def mkIntImpl(c: Context): c.Expr[Any] = { + println(c.enclosingApplication) + c.reify{ 23 } + } + +} diff --git a/test/pending/run/t5695/part_2.scala b/test/pending/run/t5695/part_2.scala new file mode 100644 index 0000000000..d34219437d --- /dev/null +++ b/test/pending/run/t5695/part_2.scala @@ -0,0 +1,8 @@ +import Defs._ + +object Test extends App { + + val i1 = mkInt + val i2 = identity(mkInt) + +} diff --git a/test/pending/run/t5698/client.scala b/test/pending/run/t5698/client.scala new file mode 100644 index 0000000000..de672c1809 --- /dev/null +++ b/test/pending/run/t5698/client.scala @@ -0,0 +1,9 @@ +package client + + + +object Client extends App { + val peer = actors.remote.Node("localhost", 23456) + val a = actors.remote.RemoteActor.select(peer, 'test) + a ! server.TestMsg +} diff --git a/test/pending/run/t5698/server.scala b/test/pending/run/t5698/server.scala new file mode 100644 index 0000000000..e8f3cea225 --- /dev/null +++ b/test/pending/run/t5698/server.scala @@ -0,0 +1,22 @@ +package server + + + +object Server extends App { + + class ServerActor extends actors.Actor { + def act() { + actors.remote.RemoteActor.alive(23456) + actors.remote.RemoteActor.register('test, actors.Actor.self) + loop { + react { + case TestMsg => println("Yay!") + } + } + } + } + + val a = new ServerActor + a.start() + +} diff --git a/test/pending/run/t5698/testmsg.scala b/test/pending/run/t5698/testmsg.scala new file mode 100644 index 0000000000..004ff0b8c7 --- /dev/null +++ b/test/pending/run/t5698/testmsg.scala @@ -0,0 +1,5 @@ +package server + + + +case object TestMsg diff --git a/test/pending/run/t5722.scala b/test/pending/run/t5722.scala new file mode 100644 index 0000000000..21ace060d6 --- /dev/null +++ b/test/pending/run/t5722.scala @@ -0,0 +1,6 @@ +object Test extends App { + def foo[T: ClassTag] = println(classOf[T]) + foo[Int] + foo[Array[Int]] + foo[List[Int]] +}
\ No newline at end of file diff --git a/test/pending/run/t5726a.scala b/test/pending/run/t5726a.scala new file mode 100644 index 0000000000..24d828a159 --- /dev/null +++ b/test/pending/run/t5726a.scala @@ -0,0 +1,17 @@ +import language.dynamics + +class DynamicTest extends Dynamic { + def selectDynamic(name: String) = s"value of $name" + def updateDynamic(name: String)(value: Any) { + println(s"You have just updated property '$name' with value: $value") + } +} + +object MyApp extends App { + def testing() { + val test = new DynamicTest + test.firstName = "John" + } + + testing() +}
\ No newline at end of file diff --git a/test/pending/run/t5726b.scala b/test/pending/run/t5726b.scala new file mode 100644 index 0000000000..839dcf40b5 --- /dev/null +++ b/test/pending/run/t5726b.scala @@ -0,0 +1,16 @@ +import language.dynamics + +class DynamicTest extends Dynamic { + def updateDynamic(name: String)(value: Any) { + println(s"You have just updated property '$name' with value: $value") + } +} + +object MyApp extends App { + def testing() { + val test = new DynamicTest + test.firstName = "John" + } + + testing() +}
\ No newline at end of file |