diff options
Diffstat (limited to 'test/files/run')
35 files changed, 194 insertions, 50 deletions
diff --git a/test/files/run/bugs.scala b/test/files/run/bugs.scala index d5905af76c..ca598603bb 100644 --- a/test/files/run/bugs.scala +++ b/test/files/run/bugs.scala @@ -445,8 +445,7 @@ object Test { test; } catch { case exception => - val curr: String = currentThread.toString(); - Console.print("Exception in thread \"" + curr + "\" " + exception); + Console.print("Exception in thread \"" + Thread.currentThread + "\" " + exception); Console.println; errors += 1 } diff --git a/test/files/run/inner-parse.check b/test/files/run/inner-parse.check index 87ea9ddeb5..e4a30714bd 100644 --- a/test/files/run/inner-parse.check +++ b/test/files/run/inner-parse.check @@ -5,6 +5,7 @@ class Test$$anonfun$main$1 extends scala.runtime.AbstractFunction1$mcVL$sp descriptor <clinit> ()V descriptor apply (Lscala/Tuple2;)V descriptor apply (Ljava/lang/Object;)Ljava/lang/Object; + descriptor apply (Ljava/lang/Object;)V descriptor cwd$1 Ljava/lang/String; descriptor serialVersionUID J descriptor <init> (Ljava/lang/String;)V diff --git a/test/files/run/inner-parse/S_3.scala b/test/files/run/inner-parse/S_3.scala index 296a651460..aaa6a6ad35 100644 --- a/test/files/run/inner-parse/S_3.scala +++ b/test/files/run/inner-parse/S_3.scala @@ -5,7 +5,7 @@ object Test { val cwd = sys.props("partest.output") for ((f, info) <- JvmClassInfo.classInfoList(cwd)) { - println("file " + f.stripPrefix(cwd + "/")) + println("file " + f.stripPrefix(cwd).substring(1).replace('\\', '/')) println(info) } } diff --git a/test/files/run/macro-declared-in-annotation/Macros_2.scala b/test/files/run/macro-declared-in-annotation/Macros_2.scala index a565849aa9..40d71c62fb 100644 --- a/test/files/run/macro-declared-in-annotation/Macros_2.scala +++ b/test/files/run/macro-declared-in-annotation/Macros_2.scala @@ -1,4 +1,4 @@ -class foo(val bar: String) extends StaticAnnotation +class foo(val bar: String) extends annotation.StaticAnnotation object Api { // foo in ann must have a different name diff --git a/test/files/run/macro-reify-eval-outside-reify/Impls_Macros_1.scala b/test/files/run/macro-reify-eval-outside-reify/Impls_Macros_1.scala index 13b603d610..086f9aeef2 100644 --- a/test/files/run/macro-reify-eval-outside-reify/Impls_Macros_1.scala +++ b/test/files/run/macro-reify-eval-outside-reify/Impls_Macros_1.scala @@ -1,7 +1,10 @@ import scala.reflect.makro.{Context => Ctx} object Impls { - def foo(c: Ctx)(x: c.Expr[Int]) = c.literal(x.eval) + def foo(c: Ctx)(x: c.Expr[Int]) = { + val x1 = c.Expr[Int](c.resetAllAttrs(x.tree)) + c.literal(x1.eval) + } } object Macros { diff --git a/test/files/run/macro-reify-value-outside-reify/Impls_Macros_1.scala b/test/files/run/macro-reify-value-outside-reify/Impls_Macros_1.scala index 28ec1ace67..109e19e44a 100644 --- a/test/files/run/macro-reify-value-outside-reify/Impls_Macros_1.scala +++ b/test/files/run/macro-reify-value-outside-reify/Impls_Macros_1.scala @@ -1,7 +1,10 @@ import scala.reflect.makro.{Context => Ctx} object Impls { - def foo(c: Ctx)(x: c.Expr[Int]) = c.literal(x.value) + def foo(c: Ctx)(x: c.Expr[Int]) = { + val x1 = c.Expr[Int](c.resetAllAttrs(x.tree)) + c.literal(x1.value) + } } object Macros { diff --git a/test/files/run/programmatic-main.check b/test/files/run/programmatic-main.check index d16e2c5178..bdf76ddce1 100644 --- a/test/files/run/programmatic-main.check +++ b/test/files/run/programmatic-main.check @@ -4,27 +4,28 @@ 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 - extmethods 6 add extension methods for inline classes - pickler 7 serialize symbol tables - refchecks 8 reference/override checking, translate nested objects - uncurry 9 uncurry, translate function values to anonymous classes - tailcalls 10 replace tail calls by jumps - specialize 11 @specialized-driven class and method specialization - explicitouter 12 this refs to outer pointers, translate patterns - erasure 13 erase types, add interfaces for traits - posterasure 14 clean up erased inline classes - lazyvals 15 allocate bitmaps, translate lazy vals into lazified defs - lambdalift 16 move nested functions to top level - constructors 17 move field definitions into constructors - flatten 18 eliminate inner classes - mixin 19 mixin composition - cleanup 20 platform-specific cleanups, generate reflective calls - icode 21 generate portable intermediate code - inliner 22 optimization: do inlining -inlineExceptionHandlers 23 optimization: inline exception handlers - closelim 24 optimization: eliminate uncalled closures - dce 25 optimization: eliminate dead code - jvm 26 generate JVM bytecode - terminal 27 The last phase in the compiler chain + patmat 5 translate match expressions + superaccessors 6 add super accessors in traits and nested classes + extmethods 7 add extension methods for inline classes + pickler 8 serialize symbol tables + refchecks 9 reference/override checking, translate nested objects + uncurry 10 uncurry, translate function values to anonymous classes + tailcalls 11 replace tail calls by jumps + specialize 12 @specialized-driven class and method specialization + explicitouter 13 this refs to outer pointers, translate patterns + erasure 14 erase types, add interfaces for traits + posterasure 15 clean up erased inline classes + lazyvals 16 allocate bitmaps, translate lazy vals into lazified defs + lambdalift 17 move nested functions to top level + constructors 18 move field definitions into constructors + flatten 19 eliminate inner classes + mixin 20 mixin composition + cleanup 21 platform-specific cleanups, generate reflective calls + icode 22 generate portable intermediate code + inliner 23 optimization: do inlining +inlineExceptionHandlers 24 optimization: inline exception handlers + closelim 25 optimization: eliminate uncalled closures + dce 26 optimization: eliminate dead code + jvm 27 generate JVM bytecode + terminal 28 The last phase in the compiler chain diff --git a/test/files/run/reflection-simple.check b/test/files/run/reflection-simple.check new file mode 100644 index 0000000000..671d9d2716 --- /dev/null +++ b/test/files/run/reflection-simple.check @@ -0,0 +1,45 @@ +Running +constructor Foo$3 +constructor Object +method != +method != +method ## +method $asInstanceOf +method $init$ +method $isInstanceOf +method == +method == +method _1 +method _2 +method _3 +method a +method asInstanceOf +method b +method c +method canEqual +method clone +method copy +method copy$default$1 +method copy$default$2 +method copy$default$3 +method eq +method equals +method finalize +method getClass +method hashCode +method isInstanceOf +method ne +method notify +method notifyAll +method productArity +method productElement +method productIterator +method productPrefix +method synchronized +method toString +method wait +method wait +method wait +value a +value b +value c diff --git a/test/files/run/reflection-simple.scala b/test/files/run/reflection-simple.scala new file mode 100644 index 0000000000..fb3feec3cb --- /dev/null +++ b/test/files/run/reflection-simple.scala @@ -0,0 +1,11 @@ +// a.scala +// Wed May 2 01:01:22 PDT 2012 + +object Test { + def main(args: Array[String]) { + System.out.println("Running") + case class Foo(a: Int, b: Int, c: Int) + val props = reflect.mirror.classToType(classOf[Foo]).members.filter(_.isTerm).map(_.toString) + props.toList.sorted foreach System.out.println + } +} diff --git a/test/files/run/reify_ann1a.scala b/test/files/run/reify_ann1a.scala index 1f5d1daccd..6c062ca2c2 100644 --- a/test/files/run/reify_ann1a.scala +++ b/test/files/run/reify_ann1a.scala @@ -1,6 +1,6 @@ import scala.reflect.mirror._ -class ann(bar: List[String]) extends StaticAnnotation +class ann(bar: List[String]) extends annotation.StaticAnnotation object Test extends App { // test 1: reify diff --git a/test/files/run/reify_ann1b.scala b/test/files/run/reify_ann1b.scala index 13d861a15c..4faddef72c 100644 --- a/test/files/run/reify_ann1b.scala +++ b/test/files/run/reify_ann1b.scala @@ -1,6 +1,6 @@ import scala.reflect.mirror._ -class ann(bar: String) extends ClassfileAnnotation +class ann(bar: String) extends annotation.ClassfileAnnotation object Test extends App { // test 1: reify diff --git a/test/files/run/reify_ann2a.scala b/test/files/run/reify_ann2a.scala index 370abadba0..a1723c221d 100644 --- a/test/files/run/reify_ann2a.scala +++ b/test/files/run/reify_ann2a.scala @@ -3,7 +3,7 @@ import scala.reflect.mirror._ object Test extends App { // test 1: reify val tree = reify{ - class ann(bar: List[String]) extends StaticAnnotation + class ann(bar: List[String]) extends annotation.StaticAnnotation @ann(bar=List("1a")) @ann(bar=List("1b")) class C[@ann(bar=List("2a")) @ann(bar=List("2b")) T](@ann(bar=List("3a")) @ann(bar=List("3b")) x: T @ann(bar=List("4a")) @ann(bar=List("4b"))) { @ann(bar=List("5a")) @ann(bar=List("5b")) def f(x: Int @ann(bar=List("6a")) @ann(bar=List("6b"))) = { diff --git a/test/files/run/reify_classfileann_a.scala b/test/files/run/reify_classfileann_a.scala index c3e7d8d2e9..9aec69b4a3 100644 --- a/test/files/run/reify_classfileann_a.scala +++ b/test/files/run/reify_classfileann_a.scala @@ -1,6 +1,6 @@ import scala.reflect.mirror._ -class ann(bar: String, quux: Array[String] = Array(), baz: ann = null) extends ClassfileAnnotation +class ann(bar: String, quux: Array[String] = Array(), baz: ann = null) extends annotation.ClassfileAnnotation object Test extends App { // test 1: reify diff --git a/test/files/run/reify_classfileann_b.scala b/test/files/run/reify_classfileann_b.scala index 4e50494af3..a37f20e72e 100644 --- a/test/files/run/reify_classfileann_b.scala +++ b/test/files/run/reify_classfileann_b.scala @@ -1,6 +1,6 @@ import scala.reflect.mirror._ -class ann(bar: String, quux: Array[String] = Array(), baz: ann = null) extends ClassfileAnnotation +class ann(bar: String, quux: Array[String] = Array(), baz: ann = null) extends annotation.ClassfileAnnotation object Test extends App { // test 1: reify diff --git a/test/files/run/reify_fors.flags b/test/files/run/reify_fors.flags index ba80cad69b..e69de29bb2 100644 --- a/test/files/run/reify_fors.flags +++ b/test/files/run/reify_fors.flags @@ -1 +0,0 @@ --Xoldpatmat diff --git a/test/files/run/reify_maps.flags b/test/files/run/reify_maps.flags index ba80cad69b..e69de29bb2 100644 --- a/test/files/run/reify_maps.flags +++ b/test/files/run/reify_maps.flags @@ -1 +0,0 @@ --Xoldpatmat diff --git a/test/files/run/repl-suppressed-warnings.scala b/test/files/run/repl-suppressed-warnings.scala index 9afbbaf1a5..1a51afe34f 100644 --- a/test/files/run/repl-suppressed-warnings.scala +++ b/test/files/run/repl-suppressed-warnings.scala @@ -1,7 +1,7 @@ import scala.tools.partest.ReplTest object Test extends ReplTest { - override def extraSettings = "-Xoldpatmat" + override def extraSettings = "" def code = """ // "Is this thing on?" Not working on first couple diff --git a/test/files/run/t1500.scala b/test/files/run/t1500.scala index c312a9a883..586a2666ad 100644 --- a/test/files/run/t1500.scala +++ b/test/files/run/t1500.scala @@ -8,7 +8,7 @@ object Test { val testCode = <code> - class posingAs[A] extends TypeConstraint + class posingAs[A] extends annotation.TypeConstraint def resolve[A,B](x: A @posingAs[B]): B = x.asInstanceOf[B] diff --git a/test/files/run/t1501.scala b/test/files/run/t1501.scala index 05e4da8c7a..dee6e0c68e 100644 --- a/test/files/run/t1501.scala +++ b/test/files/run/t1501.scala @@ -8,7 +8,7 @@ object Test { val testCode = <code> - class xyz[A] extends TypeConstraint + class xyz[A] extends annotation.TypeConstraint def loopWhile[T](cond: =>Boolean)(body: =>(Unit @xyz[T])): Unit @ xyz[T] = {{ if (cond) {{ diff --git a/test/files/run/t4536.check b/test/files/run/t4536.check new file mode 100644 index 0000000000..0c5a72ada7 --- /dev/null +++ b/test/files/run/t4536.check @@ -0,0 +1,8 @@ +cls: bar +obj: foo +obj: bar +cls: bar +obj: bar +trait: pili +trait: mili +trait: foo
\ No newline at end of file diff --git a/test/files/run/t4536.scala b/test/files/run/t4536.scala new file mode 100644 index 0000000000..acd91deb7f --- /dev/null +++ b/test/files/run/t4536.scala @@ -0,0 +1,46 @@ + + + + + + +object dynamicObject extends Dynamic { + def applyDynamic(m: String)() = println("obj: " + m); + this.foo() +} + + +class dynamicClass extends Dynamic { + def applyDynamic(m: String)() = println("cls: " + m); + this.bar() + dynamicObject.bar() +} + + +abstract class dynamicAbstractClass extends Dynamic { + def applyDynamic(m: String)(args: Any*): Unit + this.pili(1, new dynamicClass, "hello"); +} + + +trait dynamicTrait extends Dynamic { + def applyDynamic(m: String)(args: Any*) = println("trait: " + m); + def two = 2 + this.mili(1,2,3) + two +} + + +object dynamicMixin extends dynamicAbstractClass with dynamicTrait { + this.foo(None) +} + + +object Test { + + def main(args: Array[String]) { + val cls = new dynamicClass + dynamicMixin + } + +} diff --git a/test/files/run/t5224.scala b/test/files/run/t5224.scala index 93b244e03e..cf65f16457 100644 --- a/test/files/run/t5224.scala +++ b/test/files/run/t5224.scala @@ -1,6 +1,6 @@ import scala.reflect.mirror._ -class Foo(bar: String) extends ClassfileAnnotation +class Foo(bar: String) extends annotation.ClassfileAnnotation object Test extends App { val tree = reify{@Foo(bar = "qwe") class C}.tree diff --git a/test/files/run/t5272_1.flags b/test/files/run/t5272_1.flags index cb8324a345..e69de29bb2 100644 --- a/test/files/run/t5272_1.flags +++ b/test/files/run/t5272_1.flags @@ -1 +0,0 @@ --Xoldpatmat
\ No newline at end of file diff --git a/test/files/run/t5272_2.flags b/test/files/run/t5272_2.flags index cb8324a345..e69de29bb2 100644 --- a/test/files/run/t5272_2.flags +++ b/test/files/run/t5272_2.flags @@ -1 +0,0 @@ --Xoldpatmat
\ No newline at end of file diff --git a/test/files/run/t5273_1.flags b/test/files/run/t5273_1.flags index ba80cad69b..e69de29bb2 100644 --- a/test/files/run/t5273_1.flags +++ b/test/files/run/t5273_1.flags @@ -1 +0,0 @@ --Xoldpatmat diff --git a/test/files/run/t5273_2a.flags b/test/files/run/t5273_2a.flags index ba80cad69b..e69de29bb2 100644 --- a/test/files/run/t5273_2a.flags +++ b/test/files/run/t5273_2a.flags @@ -1 +0,0 @@ --Xoldpatmat diff --git a/test/files/run/t5273_2b.flags b/test/files/run/t5273_2b.flags index ba80cad69b..e69de29bb2 100644 --- a/test/files/run/t5273_2b.flags +++ b/test/files/run/t5273_2b.flags @@ -1 +0,0 @@ --Xoldpatmat diff --git a/test/files/run/t5419.scala b/test/files/run/t5419.scala index d65d8f38c8..5f11f5056c 100644 --- a/test/files/run/t5419.scala +++ b/test/files/run/t5419.scala @@ -1,6 +1,6 @@ import scala.reflect.mirror._ -class Foo extends StaticAnnotation +class Foo extends annotation.StaticAnnotation object Test extends App { val tree = reify{(5: @Foo).asInstanceOf[Int]}.tree diff --git a/test/files/run/t5423.scala b/test/files/run/t5423.scala index 645c8c7c1d..ed1faf0429 100644 --- a/test/files/run/t5423.scala +++ b/test/files/run/t5423.scala @@ -1,6 +1,6 @@ import scala.reflect.mirror._ -final class table extends StaticAnnotation +final class table extends annotation.StaticAnnotation @table class A object Test extends App { diff --git a/test/files/run/t5713.check b/test/files/run/t5713.check new file mode 100644 index 0000000000..d3e9348123 --- /dev/null +++ b/test/files/run/t5713.check @@ -0,0 +1 @@ +err
diff --git a/test/files/run/t5713.flags b/test/files/run/t5713.flags new file mode 100644 index 0000000000..cd66464f2f --- /dev/null +++ b/test/files/run/t5713.flags @@ -0,0 +1 @@ +-language:experimental.macros
\ No newline at end of file diff --git a/test/files/run/t5713/Impls_Macros_1.scala b/test/files/run/t5713/Impls_Macros_1.scala new file mode 100644 index 0000000000..b499bc7e4e --- /dev/null +++ b/test/files/run/t5713/Impls_Macros_1.scala @@ -0,0 +1,27 @@ +package m + +import language.experimental.macros +import scala.reflect.makro.Context + +object Level extends Enumeration { + val Error = Value(5) +} + +object Logger { + def error(message: String): Unit = macro LoggerMacros.error +} + +private object LoggerMacros { + + type LoggerContext = Context { type PrefixType = Logger.type } + + def error(c: LoggerContext)(message: c.Expr[String]): c.Expr[Unit] = + log(c)(c.reify(Level.Error), message) + + private def log(c: LoggerContext)(level: c.Expr[Level.Value], message: c.Expr[String]): c.Expr[Unit] = + if (level.eval.id < 4) // TODO Remove hack! + c.reify(()) + else { + c.reify(println(message.eval)) + } +}
\ No newline at end of file diff --git a/test/files/run/t5713/Test_2.scala b/test/files/run/t5713/Test_2.scala new file mode 100644 index 0000000000..24f9e79b11 --- /dev/null +++ b/test/files/run/t5713/Test_2.scala @@ -0,0 +1,5 @@ +import m._ + +object Test extends App { + Logger.error("err") +}
\ No newline at end of file diff --git a/test/files/run/tuple-zipped.scala b/test/files/run/tuple-zipped.scala index 08dcc82de6..b197183844 100644 --- a/test/files/run/tuple-zipped.scala +++ b/test/files/run/tuple-zipped.scala @@ -15,14 +15,14 @@ object Test { def main(args: Array[String]): Unit = { for (cc1 <- xss1 ; cc2 <- xss2) { - val sum1 = (cc1 zip cc2) map { case (x, y) => x + y } sum + val sum1 = (cc1, cc2).zipped map { case (x, y) => x + y } sum val sum2 = (cc1, cc2).zipped map (_ + _) sum assert(sum1 == sum2) } for (cc1 <- xss1 ; cc2 <- xss2 ; cc3 <- xss3) { - val sum1 = (cc1, cc2, cc3).zip map { case (x, y, z) => x + y + z } sum + val sum1 = (cc1, cc2, cc3).zipped map { case (x, y, z) => x + y + z } sum val sum2 = (cc1, cc2, cc3).zipped map (_ + _ + _) sum assert(sum1 == sum2) diff --git a/test/files/run/virtpatmat_staging.flags b/test/files/run/virtpatmat_staging.flags index 3f5a3100e4..48fd867160 100644 --- a/test/files/run/virtpatmat_staging.flags +++ b/test/files/run/virtpatmat_staging.flags @@ -1 +1 @@ - -Xexperimental +-Xexperimental |