diff options
Diffstat (limited to 'test/files/run')
171 files changed, 755 insertions, 249 deletions
diff --git a/test/files/run/WeakHashSetTest.scala b/test/files/run/WeakHashSetTest.scala new file mode 100644 index 0000000000..3c8f380150 --- /dev/null +++ b/test/files/run/WeakHashSetTest.scala @@ -0,0 +1,174 @@ +object Test { + def main(args: Array[String]) { + val test = scala.reflect.internal.util.WeakHashSetTest + test.checkEmpty + test.checkPlusEquals + test.checkPlusEqualsCollisions + test.checkRehashing + test.checkRehashCollisions + test.checkFindOrUpdate + test.checkMinusEquals + test.checkMinusEqualsCollisions + test.checkClear + test.checkIterator + test.checkIteratorCollisions + + // This test is commented out because it relies on gc behavior which isn't reliable enough in an automated environment + // test.checkRemoveUnreferencedObjects + } +} + +// put the main test object in the same package as WeakHashSet because +// it uses the package private "diagnostics" method +package scala.reflect.internal.util { + + object WeakHashSetTest { + // a class guaranteed to provide hash collisions + case class Collider(x : String) extends Comparable[Collider] with Serializable { + override def hashCode = 0 + def compareTo(y : Collider) = this.x compareTo y.x + } + + // basic emptiness check + def checkEmpty { + val hs = new WeakHashSet[String]() + assert(hs.size == 0) + hs.diagnostics.fullyValidate + } + + // make sure += works + def checkPlusEquals { + val hs = new WeakHashSet[String]() + val elements = List("hello", "goodbye") + elements foreach (hs += _) + assert(hs.size == 2) + assert(hs contains "hello") + assert(hs contains "goodbye") + hs.diagnostics.fullyValidate + } + + // make sure += works when there are collisions + def checkPlusEqualsCollisions { + val hs = new WeakHashSet[Collider]() + val elements = List("hello", "goodbye") map Collider + elements foreach (hs += _) + assert(hs.size == 2) + assert(hs contains Collider("hello")) + assert(hs contains Collider("goodbye")) + hs.diagnostics.fullyValidate + } + + // add a large number of elements to force rehashing and then validate + def checkRehashing { + val size = 200 + val hs = new WeakHashSet[String]() + val elements = (0 until size).toList map ("a" + _) + elements foreach (hs += _) + elements foreach {i => assert(hs contains i)} + hs.diagnostics.fullyValidate + } + + // make sure rehashing works properly when the set is rehashed + def checkRehashCollisions { + val size = 200 + val hs = new WeakHashSet[Collider]() + val elements = (0 until size).toList map {x => Collider("a" + x)} + elements foreach (hs += _) + elements foreach {i => assert(hs contains i)} + hs.diagnostics.fullyValidate + } + + // test that unreferenced objects are removed + // not run in an automated environment because gc behavior can't be relied on + def checkRemoveUnreferencedObjects { + val size = 200 + val hs = new WeakHashSet[Collider]() + val elements = (0 until size).toList map {x => Collider("a" + x)} + elements foreach (hs += _) + // don't throw the following into a retained collection so gc + // can remove them + for (i <- 0 until size) { + hs += Collider("b" + i) + } + System.gc() + Thread.sleep(1000) + assert(hs.size == 200) + elements foreach {i => assert(hs contains i)} + for (i <- 0 until size) { + assert(!(hs contains Collider("b" + i))) + } + hs.diagnostics.fullyValidate + } + + // make sure findOrUpdate returns the originally entered element + def checkFindOrUpdate { + val size = 200 + val hs = new WeakHashSet[Collider]() + val elements = (0 until size).toList map {x => Collider("a" + x)} + elements foreach {x => assert(hs findEntryOrUpdate x eq x)} + for (i <- 0 until size) { + // when we do a lookup the result should be the same reference we + // original put in + assert(hs findEntryOrUpdate(Collider("a" + i)) eq elements(i)) + } + hs.diagnostics.fullyValidate + } + + // check -= functionality + def checkMinusEquals { + val hs = new WeakHashSet[String]() + val elements = List("hello", "goodbye") + elements foreach (hs += _) + hs -= "goodbye" + assert(hs.size == 1) + assert(hs contains "hello") + assert(!(hs contains "goodbye")) + hs.diagnostics.fullyValidate + } + + // check -= when there are collisions + def checkMinusEqualsCollisions { + val hs = new WeakHashSet[Collider] + val elements = List(Collider("hello"), Collider("goodbye")) + elements foreach (hs += _) + hs -= Collider("goodbye") + assert(hs.size == 1) + assert(hs contains Collider("hello")) + assert(!(hs contains Collider("goodbye"))) + hs -= Collider("hello") + assert(hs.size == 0) + assert(!(hs contains Collider("hello"))) + hs.diagnostics.fullyValidate + } + + // check that the clear method actually cleans everything + def checkClear { + val size = 200 + val hs = new WeakHashSet[String]() + val elements = (0 until size).toList map ("a" + _) + elements foreach (hs += _) + hs.clear() + assert(hs.size == 0) + elements foreach {i => assert(!(hs contains i))} + hs.diagnostics.fullyValidate + } + + // check that the iterator covers all the contents + def checkIterator { + val hs = new WeakHashSet[String]() + val elements = (0 until 20).toList map ("a" + _) + elements foreach (hs += _) + assert(elements.iterator.toList.sorted == elements.sorted) + hs.diagnostics.fullyValidate + } + + // check that the iterator covers all the contents even when there is a collision + def checkIteratorCollisions { + val hs = new WeakHashSet[Collider] + val elements = (0 until 20).toList map {x => Collider("a" + x)} + elements foreach (hs += _) + assert(elements.iterator.toList.sorted == elements.sorted) + hs.diagnostics.fullyValidate + } + } +} diff --git a/test/files/run/macro-bodyexpandstoimpl/Impls_1.scala b/test/files/run/macro-bodyexpandstoimpl/Impls_1.scala index 9c1e4ee46d..56c5252f31 100644 --- a/test/files/run/macro-bodyexpandstoimpl/Impls_1.scala +++ b/test/files/run/macro-bodyexpandstoimpl/Impls_1.scala @@ -7,6 +7,8 @@ object Impls { def refToFoo_impl(c: Ctx)(dummy: c.Expr[Int]) = { import c.universe._ val body = Select(Ident(TermName("Impls")), TermName("foo")) + val global = c.universe.asInstanceOf[scala.tools.nsc.Global] + global.analyzer.markMacroImplRef(body.asInstanceOf[global.Tree]) c.Expr[Int](body) } }
\ No newline at end of file diff --git a/test/files/run/macro-bundle.check b/test/files/run/macro-bundle.check new file mode 100644 index 0000000000..2107454960 --- /dev/null +++ b/test/files/run/macro-bundle.check @@ -0,0 +1,3 @@ +() +Int +() diff --git a/test/files/run/macro-declared-in-annotation.flags b/test/files/run/macro-bundle.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/run/macro-declared-in-annotation.flags +++ b/test/files/run/macro-bundle.flags diff --git a/test/files/run/macro-bundle/Impls_Macros_1.scala b/test/files/run/macro-bundle/Impls_Macros_1.scala new file mode 100644 index 0000000000..3f651c9a43 --- /dev/null +++ b/test/files/run/macro-bundle/Impls_Macros_1.scala @@ -0,0 +1,13 @@ +import scala.reflect.macros.Context +import scala.reflect.macros.Macro + +trait Impl extends Macro { + def mono = c.literalUnit + def poly[T: c.WeakTypeTag] = c.literal(c.weakTypeOf[T].toString) + def weird = macro mono +} + +object Macros { + def mono = macro Impl.mono + def poly[T] = macro Impl.poly[T] +}
\ No newline at end of file diff --git a/test/files/run/macro-bundle/Test_2.scala b/test/files/run/macro-bundle/Test_2.scala new file mode 100644 index 0000000000..428f809f9d --- /dev/null +++ b/test/files/run/macro-bundle/Test_2.scala @@ -0,0 +1,5 @@ +object Test extends App { + println(Macros.mono) + println(Macros.poly[Int]) + println(new Impl{val c = ???}.weird) +}
\ No newline at end of file diff --git a/test/files/run/macro-def-infer-return-type-a.check b/test/files/run/macro-def-infer-return-type-a.check deleted file mode 100644 index f70d7bba4a..0000000000 --- a/test/files/run/macro-def-infer-return-type-a.check +++ /dev/null @@ -1 +0,0 @@ -42
\ No newline at end of file diff --git a/test/files/run/macro-def-infer-return-type-a/Impls_1.scala b/test/files/run/macro-def-infer-return-type-a/Impls_1.scala deleted file mode 100644 index 52c9f9c3e9..0000000000 --- a/test/files/run/macro-def-infer-return-type-a/Impls_1.scala +++ /dev/null @@ -1,5 +0,0 @@ -import scala.reflect.macros.{Context => Ctx} - -object Impls { - def foo(c: Ctx)(x: c.Expr[Int]) = x -} diff --git a/test/files/run/macro-def-infer-return-type-a/Macros_Test_2.scala b/test/files/run/macro-def-infer-return-type-a/Macros_Test_2.scala deleted file mode 100644 index 60fe9dc1c2..0000000000 --- a/test/files/run/macro-def-infer-return-type-a/Macros_Test_2.scala +++ /dev/null @@ -1,4 +0,0 @@ -object Test extends App { - def foo(x: Int) = macro Impls.foo - println(foo(42)) -}
\ No newline at end of file diff --git a/test/files/run/macro-def-infer-return-type-b/Impls_Macros_1.scala b/test/files/run/macro-def-infer-return-type-b/Impls_Macros_1.scala deleted file mode 100644 index 8a0f18c01b..0000000000 --- a/test/files/run/macro-def-infer-return-type-b/Impls_Macros_1.scala +++ /dev/null @@ -1,10 +0,0 @@ -import scala.reflect.macros.{Context => Ctx} - -object Impls { - def foo[T](c: Ctx)(x: c.Expr[T]) = - throw new Error("an implementation is missing") -} - -object Macros { - def foo[T](x: T) = macro Impls.foo[T] -}
\ No newline at end of file diff --git a/test/files/run/macro-def-infer-return-type-b/Test_2.scala b/test/files/run/macro-def-infer-return-type-b/Test_2.scala deleted file mode 100644 index 9e57b90b57..0000000000 --- a/test/files/run/macro-def-infer-return-type-b/Test_2.scala +++ /dev/null @@ -1,8 +0,0 @@ -object Test extends App { - import scala.reflect.runtime.universe._ - import scala.reflect.runtime.{currentMirror => cm} - import scala.tools.reflect.ToolBox - val tree = Apply(Select(Ident(TermName("Macros")), TermName("foo")), List(Literal(Constant(42)))) - try cm.mkToolBox().eval(tree) - catch { case ex: Throwable => println(ex.getMessage) } -} diff --git a/test/files/run/macro-def-infer-return-type-c.check b/test/files/run/macro-def-infer-return-type-c.check deleted file mode 100644 index f70d7bba4a..0000000000 --- a/test/files/run/macro-def-infer-return-type-c.check +++ /dev/null @@ -1 +0,0 @@ -42
\ No newline at end of file diff --git a/test/files/run/macro-def-infer-return-type-c/Impls_1.scala b/test/files/run/macro-def-infer-return-type-c/Impls_1.scala deleted file mode 100644 index 78db67eebf..0000000000 --- a/test/files/run/macro-def-infer-return-type-c/Impls_1.scala +++ /dev/null @@ -1,5 +0,0 @@ -import scala.reflect.macros.{Context => Ctx} - -object Impls { - def foo[T](c: Ctx)(x: c.Expr[T]): c.Expr[T] = x -} diff --git a/test/files/run/macro-def-infer-return-type-c/Macros_Test_2.scala b/test/files/run/macro-def-infer-return-type-c/Macros_Test_2.scala deleted file mode 100644 index 967d16f6de..0000000000 --- a/test/files/run/macro-def-infer-return-type-c/Macros_Test_2.scala +++ /dev/null @@ -1,4 +0,0 @@ -object Test extends App { - def foo[T](x: T) = macro Impls.foo[T] - println(foo(42)) -}
\ No newline at end of file diff --git a/test/files/run/macro-def-infer-return-type-b.check b/test/files/run/macro-def-infer-return-type.check index ae2dc7a06f..308e881960 100644 --- a/test/files/run/macro-def-infer-return-type-b.check +++ b/test/files/run/macro-def-infer-return-type.check @@ -1,6 +1,8 @@ +42 reflective compilation has failed: exception during macro expansion: java.lang.Error: an implementation is missing - at Impls$.foo(Impls_Macros_1.scala:5) + at Impls2$.foo(Impls_1.scala:9) +42 diff --git a/test/files/run/macro-declared-in-anonymous.flags b/test/files/run/macro-def-infer-return-type.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/run/macro-declared-in-anonymous.flags +++ b/test/files/run/macro-def-infer-return-type.flags diff --git a/test/files/run/macro-def-infer-return-type/Impls_1.scala b/test/files/run/macro-def-infer-return-type/Impls_1.scala new file mode 100644 index 0000000000..f8636fe725 --- /dev/null +++ b/test/files/run/macro-def-infer-return-type/Impls_1.scala @@ -0,0 +1,14 @@ +import scala.reflect.macros.Context + +object Impls1 { + def foo(c: Context)(x: c.Expr[Int]) = x +} + +object Impls2 { + def foo[T](c: Context)(x: c.Expr[T]) = + throw new Error("an implementation is missing") +} + +object Impls3 { + def foo[T](c: Context)(x: c.Expr[T]): c.Expr[T] = x +} diff --git a/test/files/run/macro-def-infer-return-type/Macros_Test_2.scala b/test/files/run/macro-def-infer-return-type/Macros_Test_2.scala new file mode 100644 index 0000000000..f579586b7f --- /dev/null +++ b/test/files/run/macro-def-infer-return-type/Macros_Test_2.scala @@ -0,0 +1,24 @@ +object Macros1 { + def foo(x: Int) = macro Impls1.foo +} + +object Macros2 { + def foo[T](x: T) = macro Impls2.foo[T] +} + +object Macros3 { + def foo[T](x: T) = macro Impls3.foo[T] +} + +object Test extends App { + println(Macros1.foo(42)) + + import scala.reflect.runtime.universe._ + import scala.reflect.runtime.{currentMirror => cm} + import scala.tools.reflect.ToolBox + val tree = Apply(Select(Ident(TermName("Macros2")), TermName("foo")), List(Literal(Constant(42)))) + try cm.mkToolBox().eval(tree) + catch { case ex: Throwable => println(ex.getMessage) } + + println(Macros3.foo(42)) +} diff --git a/test/files/run/macro-def-path-dependent-b.check b/test/files/run/macro-def-path-dependent-b.check deleted file mode 100644 index 7658ad2c24..0000000000 --- a/test/files/run/macro-def-path-dependent-b.check +++ /dev/null @@ -1 +0,0 @@ -it works diff --git a/test/files/run/macro-def-path-dependent-c.check b/test/files/run/macro-def-path-dependent-c.check deleted file mode 100644 index 7658ad2c24..0000000000 --- a/test/files/run/macro-def-path-dependent-c.check +++ /dev/null @@ -1 +0,0 @@ -it works diff --git a/test/files/run/macro-def-path-dependent-d1.check b/test/files/run/macro-def-path-dependent-d1.check deleted file mode 100644 index 7658ad2c24..0000000000 --- a/test/files/run/macro-def-path-dependent-d1.check +++ /dev/null @@ -1 +0,0 @@ -it works diff --git a/test/files/run/macro-def-path-dependent-d1/Test_2.scala b/test/files/run/macro-def-path-dependent-d1/Test_2.scala deleted file mode 100644 index 7dffc5107d..0000000000 --- a/test/files/run/macro-def-path-dependent-d1/Test_2.scala +++ /dev/null @@ -1,3 +0,0 @@ -object Test extends App { - println("it works") -}
\ No newline at end of file diff --git a/test/files/run/macro-def-path-dependent-d2.check b/test/files/run/macro-def-path-dependent-d2.check deleted file mode 100644 index 7658ad2c24..0000000000 --- a/test/files/run/macro-def-path-dependent-d2.check +++ /dev/null @@ -1 +0,0 @@ -it works diff --git a/test/files/run/macro-def-path-dependent-d2.flags b/test/files/run/macro-def-path-dependent-d2.flags deleted file mode 100644 index cd66464f2f..0000000000 --- a/test/files/run/macro-def-path-dependent-d2.flags +++ /dev/null @@ -1 +0,0 @@ --language:experimental.macros
\ No newline at end of file diff --git a/test/files/run/macro-def-path-dependent-d2/Test_3.scala b/test/files/run/macro-def-path-dependent-d2/Test_3.scala deleted file mode 100644 index 7dffc5107d..0000000000 --- a/test/files/run/macro-def-path-dependent-d2/Test_3.scala +++ /dev/null @@ -1,3 +0,0 @@ -object Test extends App { - println("it works") -}
\ No newline at end of file diff --git a/test/files/run/macro-declared-in-annotation.check b/test/files/run/macro-def-path-dependent.check index 7658ad2c24..7658ad2c24 100644 --- a/test/files/run/macro-declared-in-annotation.check +++ b/test/files/run/macro-def-path-dependent.check diff --git a/test/files/run/macro-declared-in-block.flags b/test/files/run/macro-def-path-dependent.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/run/macro-declared-in-block.flags +++ b/test/files/run/macro-def-path-dependent.flags diff --git a/test/files/run/macro-def-path-dependent-a/Test_2.scala b/test/files/run/macro-def-path-dependent/Dummy.scala index 7dffc5107d..7dffc5107d 100644 --- a/test/files/run/macro-def-path-dependent-a/Test_2.scala +++ b/test/files/run/macro-def-path-dependent/Dummy.scala diff --git a/test/files/run/macro-def-path-dependent-a/Impls_Macros_1.scala b/test/files/run/macro-def-path-dependent/Test_1.scala index 3a91e41ff9..06c15e16c9 100644 --- a/test/files/run/macro-def-path-dependent-a/Impls_Macros_1.scala +++ b/test/files/run/macro-def-path-dependent/Test_1.scala @@ -1,3 +1,5 @@ +package test1 + import scala.reflect.macros.{Context => Ctx} trait Exprs { diff --git a/test/files/run/macro-def-path-dependent-b/Impls_Macros_1.scala b/test/files/run/macro-def-path-dependent/Test_2.scala index cf9f9ebd0e..f1e9909981 100644 --- a/test/files/run/macro-def-path-dependent-b/Impls_Macros_1.scala +++ b/test/files/run/macro-def-path-dependent/Test_2.scala @@ -1,3 +1,5 @@ +package test2 + import scala.reflect.macros.{Context => Ctx} trait Exprs { diff --git a/test/files/run/macro-def-path-dependent-c/Impls_Macros_1.scala b/test/files/run/macro-def-path-dependent/Test_3.scala index 6cb374d9ba..9f5efe5e47 100644 --- a/test/files/run/macro-def-path-dependent-c/Impls_Macros_1.scala +++ b/test/files/run/macro-def-path-dependent/Test_3.scala @@ -1,3 +1,5 @@ +package test3 + import scala.reflect.macros.{Context => Ctx} trait Exprs { diff --git a/test/files/run/macro-def-path-dependent-d1/Impls_Macros_1.scala b/test/files/run/macro-def-path-dependent/Test_4.scala index 69d9708b2a..3af920d739 100644 --- a/test/files/run/macro-def-path-dependent-d1/Impls_Macros_1.scala +++ b/test/files/run/macro-def-path-dependent/Test_4.scala @@ -1,3 +1,5 @@ +package test4 + import scala.reflect.runtime.universe._ import scala.reflect.macros.Context import scala.reflect.api.Universe diff --git a/test/files/run/macro-def-path-dependent-d2/Impls_1.scala b/test/files/run/macro-def-path-dependent/Test_5.scala index 7fa9c3579e..bc32fb92de 100644 --- a/test/files/run/macro-def-path-dependent-d2/Impls_1.scala +++ b/test/files/run/macro-def-path-dependent/Test_5.scala @@ -1,3 +1,5 @@ +package test56 + import scala.reflect.runtime.universe._ import scala.reflect.macros.Context import scala.reflect.api.Universe diff --git a/test/files/run/macro-def-path-dependent-d2/Macros_2.scala b/test/files/run/macro-def-path-dependent/Test_6.scala index 65ce4d8bd2..6267743473 100644 --- a/test/files/run/macro-def-path-dependent-d2/Macros_2.scala +++ b/test/files/run/macro-def-path-dependent/Test_6.scala @@ -1,3 +1,5 @@ +package test56 + import scala.reflect.runtime.universe._ import scala.reflect.macros.Context import scala.reflect.api.Universe diff --git a/test/files/run/macro-expand-nullary-generic.check b/test/files/run/macro-expand-nullary-generic.check index 42976f4baf..0470d239dc 100644 --- a/test/files/run/macro-expand-nullary-generic.check +++ b/test/files/run/macro-expand-nullary-generic.check @@ -1,6 +1,6 @@ -it works WeakTypeTag[Int] -it works WeakTypeTag[Int] -it works WeakTypeTag[Int] -it works WeakTypeTag[Int] -it works WeakTypeTag[Int] +fooNullary[Int] +fooEmpty[Int] +fooEmpty[Int] +barNullary[Int] +barEmpty[Int] kkthxbai diff --git a/test/files/run/macro-expand-nullary-generic/Impls_1.scala b/test/files/run/macro-expand-nullary-generic/Impls_1.scala index 39a9db0e14..5dfdd5c539 100644 --- a/test/files/run/macro-expand-nullary-generic/Impls_1.scala +++ b/test/files/run/macro-expand-nullary-generic/Impls_1.scala @@ -2,14 +2,14 @@ import scala.reflect.runtime.universe._ import scala.reflect.macros.{Context => Ctx} object Impls { - def impl[T: c.WeakTypeTag](c: Ctx) = { + def impl[T: c.WeakTypeTag](c: Ctx)(meth: String) = { import c.universe._ - val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works " + implicitly[c.WeakTypeTag[T]])))) + val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(s"$meth[${c.weakTypeOf[T]}]")))) c.Expr[Unit](body) } - def fooNullary[T: c.WeakTypeTag](c: Ctx) = impl[T](c) - def fooEmpty[T: c.WeakTypeTag](c: Ctx)() = impl[T](c) - def barNullary[T: c.WeakTypeTag](c: Ctx)(x: c.Expr[Int]) = impl[T](c) - def barEmpty[T: c.WeakTypeTag](c: Ctx)(x: c.Expr[Int])() = impl[T](c) + def fooNullary[T: c.WeakTypeTag](c: Ctx) = impl[T](c)("fooNullary") + def fooEmpty[T: c.WeakTypeTag](c: Ctx)() = impl[T](c)("fooEmpty") + def barNullary[T: c.WeakTypeTag](c: Ctx)(x: c.Expr[Int]) = impl[T](c)("barNullary") + def barEmpty[T: c.WeakTypeTag](c: Ctx)(x: c.Expr[Int])() = impl[T](c)("barEmpty") }
\ No newline at end of file diff --git a/test/files/run/macro-expand-nullary-nongeneric.check b/test/files/run/macro-expand-nullary-nongeneric.check index 9ab5f3a2bc..cb7e766394 100644 --- a/test/files/run/macro-expand-nullary-nongeneric.check +++ b/test/files/run/macro-expand-nullary-nongeneric.check @@ -1,6 +1,6 @@ -it works -it works -it works -it works -it works +fooNullary +fooEmpty +fooEmpty +barNullary +barEmpty kkthxbai diff --git a/test/files/run/macro-expand-nullary-nongeneric/Impls_1.scala b/test/files/run/macro-expand-nullary-nongeneric/Impls_1.scala index 41e50acc86..d23c671c84 100644 --- a/test/files/run/macro-expand-nullary-nongeneric/Impls_1.scala +++ b/test/files/run/macro-expand-nullary-nongeneric/Impls_1.scala @@ -1,14 +1,15 @@ +import scala.reflect.runtime.universe._ import scala.reflect.macros.{Context => Ctx} object Impls { - def impl(c: Ctx) = { + def impl(c: Ctx)(meth: String) = { import c.universe._ - val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works")))) + val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(meth)))) c.Expr[Unit](body) } - def fooNullary(c: Ctx) = impl(c) - def fooEmpty(c: Ctx)() = impl(c) - def barNullary(c: Ctx)(x: c.Expr[Int]) = impl(c) - def barEmpty(c: Ctx)(x: c.Expr[Int])() = impl(c) + def fooNullary(c: Ctx) = impl(c)("fooNullary") + def fooEmpty(c: Ctx)() = impl(c)("fooEmpty") + def barNullary(c: Ctx)(x: c.Expr[Int]) = impl(c)("barNullary") + def barEmpty(c: Ctx)(x: c.Expr[Int])() = impl(c)("barEmpty") }
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-bounds-a.flags b/test/files/run/macro-expand-tparams-bounds-a.flags deleted file mode 100644 index cd66464f2f..0000000000 --- a/test/files/run/macro-expand-tparams-bounds-a.flags +++ /dev/null @@ -1 +0,0 @@ --language:experimental.macros
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-bounds-a/Macros_Test_2.scala b/test/files/run/macro-expand-tparams-bounds-a/Macros_Test_2.scala deleted file mode 100644 index b498e6f65b..0000000000 --- a/test/files/run/macro-expand-tparams-bounds-a/Macros_Test_2.scala +++ /dev/null @@ -1,8 +0,0 @@ -object Macros { - def foo[U <: String] = macro Impls.foo[U] -} - -object Test extends App { - import Macros._ - foo[String] -}
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-bounds-b.check b/test/files/run/macro-expand-tparams-bounds-b.check deleted file mode 100644 index e69de29bb2..0000000000 --- a/test/files/run/macro-expand-tparams-bounds-b.check +++ /dev/null diff --git a/test/files/run/macro-expand-tparams-bounds-b.flags b/test/files/run/macro-expand-tparams-bounds-b.flags deleted file mode 100644 index cd66464f2f..0000000000 --- a/test/files/run/macro-expand-tparams-bounds-b.flags +++ /dev/null @@ -1 +0,0 @@ --language:experimental.macros
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-bounds-b/Impls_1.scala b/test/files/run/macro-expand-tparams-bounds-b/Impls_1.scala deleted file mode 100644 index c11c89151c..0000000000 --- a/test/files/run/macro-expand-tparams-bounds-b/Impls_1.scala +++ /dev/null @@ -1,7 +0,0 @@ -import scala.reflect.macros.{Context => Ctx} - -class C - -object Impls { - def foo[U <: C](c: Ctx): c.Expr[Unit] = c.literalUnit -} diff --git a/test/files/run/macro-expand-tparams-bounds-b/Macros_Test_2.scala b/test/files/run/macro-expand-tparams-bounds-b/Macros_Test_2.scala deleted file mode 100644 index 1a261e9f73..0000000000 --- a/test/files/run/macro-expand-tparams-bounds-b/Macros_Test_2.scala +++ /dev/null @@ -1,10 +0,0 @@ -class D extends C - -object Macros { - def foo[T <: D] = macro Impls.foo[T] -} - -object Test extends App { - import Macros._ - foo[D] -}
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-bounds-a.check b/test/files/run/macro-expand-tparams-bounds.check index e69de29bb2..e69de29bb2 100644 --- a/test/files/run/macro-expand-tparams-bounds-a.check +++ b/test/files/run/macro-expand-tparams-bounds.check diff --git a/test/files/run/macro-declared-in-class-class.flags b/test/files/run/macro-expand-tparams-bounds.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/run/macro-declared-in-class-class.flags +++ b/test/files/run/macro-expand-tparams-bounds.flags diff --git a/test/files/run/macro-expand-tparams-bounds/Impls_1.scala b/test/files/run/macro-expand-tparams-bounds/Impls_1.scala new file mode 100644 index 0000000000..f9103aaf8f --- /dev/null +++ b/test/files/run/macro-expand-tparams-bounds/Impls_1.scala @@ -0,0 +1,12 @@ +import scala.reflect.macros.Context + +object Impls1 { + def foo[U <: String](c: Context): c.Expr[Unit] = c.literalUnit +} + +class C +class D extends C + +object Impls2 { + def foo[U <: C](c: Context): c.Expr[Unit] = c.literalUnit +} diff --git a/test/files/run/macro-expand-tparams-bounds/Macros_Test_2.scala b/test/files/run/macro-expand-tparams-bounds/Macros_Test_2.scala new file mode 100644 index 0000000000..37a4bcb2b9 --- /dev/null +++ b/test/files/run/macro-expand-tparams-bounds/Macros_Test_2.scala @@ -0,0 +1,12 @@ +object Macros1 { + def foo[U <: String] = macro Impls1.foo[U] +} + +object Macros2 { + def foo[T <: D] = macro Impls2.foo[T] +} + +object Test extends App { + Macros1.foo[String] + Macros2.foo[D] +} diff --git a/test/files/run/macro-expand-tparams-only-in-impl.flags b/test/files/run/macro-expand-tparams-only-in-impl.flags deleted file mode 100644 index cd66464f2f..0000000000 --- a/test/files/run/macro-expand-tparams-only-in-impl.flags +++ /dev/null @@ -1 +0,0 @@ --language:experimental.macros
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-only-in-impl/Impls_1.scala b/test/files/run/macro-expand-tparams-only-in-impl/Impls_1.scala deleted file mode 100644 index 9b8dafaa97..0000000000 --- a/test/files/run/macro-expand-tparams-only-in-impl/Impls_1.scala +++ /dev/null @@ -1,5 +0,0 @@ -import scala.reflect.macros.{Context => Ctx} - -object Impls { - def foo[U <: String](c: Ctx): c.Expr[Unit] = c.literalUnit -} diff --git a/test/files/run/macro-expand-tparams-optional.flags b/test/files/run/macro-expand-tparams-optional.flags deleted file mode 100644 index cd66464f2f..0000000000 --- a/test/files/run/macro-expand-tparams-optional.flags +++ /dev/null @@ -1 +0,0 @@ --language:experimental.macros
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-prefix-a.check b/test/files/run/macro-expand-tparams-prefix-a.check deleted file mode 100644 index ca44a4f652..0000000000 --- a/test/files/run/macro-expand-tparams-prefix-a.check +++ /dev/null @@ -1,4 +0,0 @@ -WeakTypeTag[Int] -WeakTypeTag[Int] -WeakTypeTag[String] -WeakTypeTag[Boolean] diff --git a/test/files/run/macro-expand-tparams-prefix-a.flags b/test/files/run/macro-expand-tparams-prefix-a.flags deleted file mode 100644 index cd66464f2f..0000000000 --- a/test/files/run/macro-expand-tparams-prefix-a.flags +++ /dev/null @@ -1 +0,0 @@ --language:experimental.macros
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-prefix-a/Impls_1.scala b/test/files/run/macro-expand-tparams-prefix-a/Impls_1.scala deleted file mode 100644 index c729aada51..0000000000 --- a/test/files/run/macro-expand-tparams-prefix-a/Impls_1.scala +++ /dev/null @@ -1,11 +0,0 @@ -import scala.reflect.runtime.universe._ -import scala.reflect.macros.{Context => Ctx} - -object Impls { - def foo[U: c.WeakTypeTag](c: Ctx)(x: c.Expr[U]) = { - import c.universe._ - val U = implicitly[c.WeakTypeTag[U]] - val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(U.toString)))) - c.Expr[Unit](body) - } -}
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-prefix-a/Macros_Test_2.scala b/test/files/run/macro-expand-tparams-prefix-a/Macros_Test_2.scala deleted file mode 100644 index 81ccb7ff42..0000000000 --- a/test/files/run/macro-expand-tparams-prefix-a/Macros_Test_2.scala +++ /dev/null @@ -1,10 +0,0 @@ -object Test extends App { - class C[T] { - def foo[U](x: U) = macro Impls.foo[U] - } - - new C[Int]().foo(42) - new C[Boolean]().foo(42) - new C[Int]().foo("42") - new C[String]().foo(true) -}
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-prefix-b.check b/test/files/run/macro-expand-tparams-prefix-b.check deleted file mode 100644 index 2ff2ce435d..0000000000 --- a/test/files/run/macro-expand-tparams-prefix-b.check +++ /dev/null @@ -1,2 +0,0 @@ -WeakTypeTag[Boolean] WeakTypeTag[Int] -WeakTypeTag[Boolean] WeakTypeTag[String] diff --git a/test/files/run/macro-expand-tparams-prefix-b.flags b/test/files/run/macro-expand-tparams-prefix-b.flags deleted file mode 100644 index cd66464f2f..0000000000 --- a/test/files/run/macro-expand-tparams-prefix-b.flags +++ /dev/null @@ -1 +0,0 @@ --language:experimental.macros
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-prefix-b/Impls_1.scala b/test/files/run/macro-expand-tparams-prefix-b/Impls_1.scala deleted file mode 100644 index 8880d13b04..0000000000 --- a/test/files/run/macro-expand-tparams-prefix-b/Impls_1.scala +++ /dev/null @@ -1,12 +0,0 @@ -import scala.reflect.runtime.universe._ -import scala.reflect.macros.{Context => Ctx} - -object Impls { - def foo[T: c.WeakTypeTag, U: c.WeakTypeTag](c: Ctx)(x: c.Expr[U]) = { - import c.universe._ - val T = implicitly[c.WeakTypeTag[T]] - val U = implicitly[c.WeakTypeTag[U]] - val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(T.toString + " " + U.toString)))) - c.Expr[Unit](body) - } -}
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-prefix-b/Macros_Test_2.scala b/test/files/run/macro-expand-tparams-prefix-b/Macros_Test_2.scala deleted file mode 100644 index a4a0acfe8b..0000000000 --- a/test/files/run/macro-expand-tparams-prefix-b/Macros_Test_2.scala +++ /dev/null @@ -1,10 +0,0 @@ -object Test extends App { - class C[T] { - def foo[U](x: U) = macro Impls.foo[T, U] - } - - object D extends C[Boolean] - - D.foo(42) - D.foo("42") -}
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-prefix-c1.check b/test/files/run/macro-expand-tparams-prefix-c1.check deleted file mode 100644 index 0f24f74db1..0000000000 --- a/test/files/run/macro-expand-tparams-prefix-c1.check +++ /dev/null @@ -1,3 +0,0 @@ -WeakTypeTag[Int] -WeakTypeTag[String] -WeakTypeTag[Boolean] diff --git a/test/files/run/macro-expand-tparams-prefix-c1.flags b/test/files/run/macro-expand-tparams-prefix-c1.flags deleted file mode 100644 index cd66464f2f..0000000000 --- a/test/files/run/macro-expand-tparams-prefix-c1.flags +++ /dev/null @@ -1 +0,0 @@ --language:experimental.macros
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-prefix-c1/Impls_1.scala b/test/files/run/macro-expand-tparams-prefix-c1/Impls_1.scala deleted file mode 100644 index 2df42e969f..0000000000 --- a/test/files/run/macro-expand-tparams-prefix-c1/Impls_1.scala +++ /dev/null @@ -1,13 +0,0 @@ -import scala.reflect.runtime.universe._ -import scala.reflect.macros.{Context => Ctx} - -object Impls { - def foo[T, U: c.WeakTypeTag, V](c: Ctx)(implicit T: c.WeakTypeTag[T], V: c.WeakTypeTag[V]): c.Expr[Unit] = { - import c.universe._ - c.Expr(Block(List( - Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(T.toString)))), - Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(implicitly[c.WeakTypeTag[U]].toString)))), - Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(V.toString))))), - Literal(Constant(())))) - } -}
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-prefix-c1/Macros_Test_2.scala b/test/files/run/macro-expand-tparams-prefix-c1/Macros_Test_2.scala deleted file mode 100644 index 4fa0c8cb33..0000000000 --- a/test/files/run/macro-expand-tparams-prefix-c1/Macros_Test_2.scala +++ /dev/null @@ -1,11 +0,0 @@ -class D[T] { - class C[U] { - def foo[V] = macro Impls.foo[T, U, V] - } -} - -object Test extends App { - val outer1 = new D[Int] - val outer2 = new outer1.C[String] - outer2.foo[Boolean] -}
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-prefix-c2.check b/test/files/run/macro-expand-tparams-prefix-c2.check deleted file mode 100644 index 0f24f74db1..0000000000 --- a/test/files/run/macro-expand-tparams-prefix-c2.check +++ /dev/null @@ -1,3 +0,0 @@ -WeakTypeTag[Int] -WeakTypeTag[String] -WeakTypeTag[Boolean] diff --git a/test/files/run/macro-expand-tparams-prefix-c2.flags b/test/files/run/macro-expand-tparams-prefix-c2.flags deleted file mode 100644 index cd66464f2f..0000000000 --- a/test/files/run/macro-expand-tparams-prefix-c2.flags +++ /dev/null @@ -1 +0,0 @@ --language:experimental.macros
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-prefix-c2/Impls_Macros_1.scala b/test/files/run/macro-expand-tparams-prefix-c2/Impls_Macros_1.scala deleted file mode 100644 index 08817708d4..0000000000 --- a/test/files/run/macro-expand-tparams-prefix-c2/Impls_Macros_1.scala +++ /dev/null @@ -1,19 +0,0 @@ -import scala.reflect.runtime.universe._ -import scala.reflect.macros.{Context => Ctx} - -object Impls { - def foo[T, U: c.WeakTypeTag, V](c: Ctx)(implicit T: c.WeakTypeTag[T], V: c.WeakTypeTag[V]): c.Expr[Unit] = { - import c.universe._ - c.Expr(Block(List( - Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(T.toString)))), - Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(implicitly[c.WeakTypeTag[U]].toString)))), - Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(V.toString))))), - Literal(Constant(())))) - } -} - -class D[T] { - class C[U] { - def foo[V] = macro Impls.foo[T, U, V] - } -}
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-prefix-c2/Test_2.scala b/test/files/run/macro-expand-tparams-prefix-c2/Test_2.scala deleted file mode 100644 index e729d4a536..0000000000 --- a/test/files/run/macro-expand-tparams-prefix-c2/Test_2.scala +++ /dev/null @@ -1,5 +0,0 @@ -object Test extends App { - val outer1 = new D[Int] - val outer2 = new outer1.C[String] - outer2.foo[Boolean] -}
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-prefix-d1.check b/test/files/run/macro-expand-tparams-prefix-d1.check deleted file mode 100644 index 7832503256..0000000000 --- a/test/files/run/macro-expand-tparams-prefix-d1.check +++ /dev/null @@ -1,3 +0,0 @@ -WeakTypeTag[T] -WeakTypeTag[U] -WeakTypeTag[Boolean] diff --git a/test/files/run/macro-expand-tparams-prefix-d1.flags b/test/files/run/macro-expand-tparams-prefix-d1.flags deleted file mode 100644 index cd66464f2f..0000000000 --- a/test/files/run/macro-expand-tparams-prefix-d1.flags +++ /dev/null @@ -1 +0,0 @@ --language:experimental.macros
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-prefix-d1/Impls_1.scala b/test/files/run/macro-expand-tparams-prefix-d1/Impls_1.scala deleted file mode 100644 index 2df42e969f..0000000000 --- a/test/files/run/macro-expand-tparams-prefix-d1/Impls_1.scala +++ /dev/null @@ -1,13 +0,0 @@ -import scala.reflect.runtime.universe._ -import scala.reflect.macros.{Context => Ctx} - -object Impls { - def foo[T, U: c.WeakTypeTag, V](c: Ctx)(implicit T: c.WeakTypeTag[T], V: c.WeakTypeTag[V]): c.Expr[Unit] = { - import c.universe._ - c.Expr(Block(List( - Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(T.toString)))), - Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(implicitly[c.WeakTypeTag[U]].toString)))), - Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(V.toString))))), - Literal(Constant(())))) - } -}
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-prefix-d1/Macros_Test_2.scala b/test/files/run/macro-expand-tparams-prefix-d1/Macros_Test_2.scala deleted file mode 100644 index 8222a6d1e8..0000000000 --- a/test/files/run/macro-expand-tparams-prefix-d1/Macros_Test_2.scala +++ /dev/null @@ -1,11 +0,0 @@ -object Test extends App { - class D[T] { - class C[U] { - def foo[V] = macro Impls.foo[T, U, V] - foo[Boolean] - } - } - - val outer1 = new D[Int] - new outer1.C[String] -}
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-prefix.check b/test/files/run/macro-expand-tparams-prefix.check new file mode 100644 index 0000000000..7397958066 --- /dev/null +++ b/test/files/run/macro-expand-tparams-prefix.check @@ -0,0 +1,20 @@ +===Macros1=== +WeakTypeTag[Int] +WeakTypeTag[Int] +WeakTypeTag[String] +WeakTypeTag[Boolean] +===Macros2=== +WeakTypeTag[Boolean] WeakTypeTag[Int] +WeakTypeTag[Boolean] WeakTypeTag[String] +===Macros3=== +WeakTypeTag[Int] +WeakTypeTag[String] +WeakTypeTag[Boolean] +===Macros4=== +WeakTypeTag[Int] +WeakTypeTag[String] +WeakTypeTag[Boolean] +===Macros5=== +WeakTypeTag[T] +WeakTypeTag[U] +WeakTypeTag[Boolean] diff --git a/test/files/run/macro-declared-in-class-object.flags b/test/files/run/macro-expand-tparams-prefix.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/run/macro-declared-in-class-object.flags +++ b/test/files/run/macro-expand-tparams-prefix.flags diff --git a/test/files/run/macro-expand-tparams-prefix/Impls_1.scala b/test/files/run/macro-expand-tparams-prefix/Impls_1.scala new file mode 100644 index 0000000000..e92396d1b4 --- /dev/null +++ b/test/files/run/macro-expand-tparams-prefix/Impls_1.scala @@ -0,0 +1,40 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.macros.Context + +object Impls1 { + def foo[U: c.WeakTypeTag](c: Context)(x: c.Expr[U]) = { + import c.universe._ + val U = implicitly[c.WeakTypeTag[U]] + val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(U.toString)))) + c.Expr[Unit](body) + } +} + +object Impls2 { + def foo[T: c.WeakTypeTag, U: c.WeakTypeTag](c: Context)(x: c.Expr[U]) = { + import c.universe._ + val T = implicitly[c.WeakTypeTag[T]] + val U = implicitly[c.WeakTypeTag[U]] + val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(T.toString + " " + U.toString)))) + c.Expr[Unit](body) + } +} + +object Impls345 { + def foo[T, U: c.WeakTypeTag, V](c: Context)(implicit T: c.WeakTypeTag[T], V: c.WeakTypeTag[V]): c.Expr[Unit] = { + import c.universe._ + c.Expr(Block(List( + Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(T.toString)))), + Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(implicitly[c.WeakTypeTag[U]].toString)))), + Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(V.toString))))), + Literal(Constant(())))) + } +} + +object Macros4 { + class D[T] { + class C[U] { + def foo[V] = macro Impls345.foo[T, U, V] + } + } +} diff --git a/test/files/run/macro-expand-tparams-prefix/Macros_Test_2.scala b/test/files/run/macro-expand-tparams-prefix/Macros_Test_2.scala new file mode 100644 index 0000000000..2b1730d36e --- /dev/null +++ b/test/files/run/macro-expand-tparams-prefix/Macros_Test_2.scala @@ -0,0 +1,57 @@ +object Macros1 { + class C[T] { + def foo[U](x: U) = macro Impls1.foo[U] + } +} + +object Macros2 { + class C[T] { + def foo[U](x: U) = macro Impls2.foo[T, U] + } +} + +object Macros3 { + class D[T] { + class C[U] { + def foo[V] = macro Impls345.foo[T, U, V] + } + } +} + +// object Macros4 is declared in Impls_1.scala + +object Macros5 { + class D[T] { + class C[U] { + def foo[V] = macro Impls345.foo[T, U, V] + foo[Boolean] + } + } +} + +object Test extends App { + println("===Macros1===") + new Macros1.C[Int]().foo(42) + new Macros1.C[Boolean]().foo(42) + new Macros1.C[Int]().foo("42") + new Macros1.C[String]().foo(true) + + println("===Macros2===") + object D2 extends Macros2.C[Boolean] + D2.foo(42) + D2.foo("42") + + println("===Macros3===") + val outer31 = new Macros3.D[Int] + val outer32 = new outer31.C[String] + outer32.foo[Boolean] + + println("===Macros4===") + val outer41 = new Macros4.D[Int] + val outer42 = new outer41.C[String] + outer42.foo[Boolean] + + println("===Macros5===") + val outer1 = new Macros5.D[Int] + new outer1.C[String] +}
\ No newline at end of file diff --git a/test/files/run/macro-impl-relaxed.check b/test/files/run/macro-impl-relaxed.check new file mode 100644 index 0000000000..487b116534 --- /dev/null +++ b/test/files/run/macro-impl-relaxed.check @@ -0,0 +1,4 @@ +2 +2 +2 +2 diff --git a/test/files/run/macro-impl-relaxed/Macros_1.scala b/test/files/run/macro-impl-relaxed/Macros_1.scala new file mode 100644 index 0000000000..af62646b4e --- /dev/null +++ b/test/files/run/macro-impl-relaxed/Macros_1.scala @@ -0,0 +1,14 @@ +import language.experimental.macros +import scala.reflect.macros.Context + +object Macros { + def implUU(c: Context)(x: c.Tree): c.Tree = x + def implTU(c: Context)(x: c.Expr[Int]): c.Tree = x.tree + def implUT(c: Context)(x: c.Tree): c.Expr[Int] = c.Expr[Int](x) + def implTT(c: Context)(x: c.Expr[Int]): c.Expr[Int] = x + + def fooUU(x: Int): Int = macro implUU + def fooTU(x: Int): Int = macro implTU + def fooUT(x: Int): Int = macro implUT + def fooTT(x: Int): Int = macro implTT +}
\ No newline at end of file diff --git a/test/files/run/macro-impl-relaxed/Test_2.scala b/test/files/run/macro-impl-relaxed/Test_2.scala new file mode 100644 index 0000000000..2eaeef0fd0 --- /dev/null +++ b/test/files/run/macro-impl-relaxed/Test_2.scala @@ -0,0 +1,6 @@ +object Test extends App { + println(Macros.fooUU(2)) + println(Macros.fooTU(2)) + println(Macros.fooUT(2)) + println(Macros.fooTT(2)) +}
\ No newline at end of file diff --git a/test/files/run/macro-declared-in-class.flags b/test/files/run/macro-impl-tparam-only-in-impl.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/run/macro-declared-in-class.flags +++ b/test/files/run/macro-impl-tparam-only-in-impl.flags diff --git a/test/files/run/macro-expand-tparams-bounds-a/Impls_1.scala b/test/files/run/macro-impl-tparam-only-in-impl/Impls_1.scala index 9b8dafaa97..9b8dafaa97 100644 --- a/test/files/run/macro-expand-tparams-bounds-a/Impls_1.scala +++ b/test/files/run/macro-impl-tparam-only-in-impl/Impls_1.scala diff --git a/test/files/run/macro-expand-tparams-only-in-impl/Macros_Test_2.scala b/test/files/run/macro-impl-tparam-only-in-impl/Macros_Test_2.scala index 218c7aec7f..218c7aec7f 100644 --- a/test/files/run/macro-expand-tparams-only-in-impl/Macros_Test_2.scala +++ b/test/files/run/macro-impl-tparam-only-in-impl/Macros_Test_2.scala diff --git a/test/files/run/macro-expand-tparams-optional.check b/test/files/run/macro-impl-tparam-typetag-is-optional.check index b4a0f394c1..b4a0f394c1 100644 --- a/test/files/run/macro-expand-tparams-optional.check +++ b/test/files/run/macro-impl-tparam-typetag-is-optional.check diff --git a/test/files/run/macro-declared-in-default-param.flags b/test/files/run/macro-impl-tparam-typetag-is-optional.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/run/macro-declared-in-default-param.flags +++ b/test/files/run/macro-impl-tparam-typetag-is-optional.flags diff --git a/test/files/run/macro-expand-tparams-optional/Impls_1.scala b/test/files/run/macro-impl-tparam-typetag-is-optional/Impls_1.scala index ace7a6cd26..ace7a6cd26 100644 --- a/test/files/run/macro-expand-tparams-optional/Impls_1.scala +++ b/test/files/run/macro-impl-tparam-typetag-is-optional/Impls_1.scala diff --git a/test/files/run/macro-expand-tparams-optional/Macros_Test_2.scala b/test/files/run/macro-impl-tparam-typetag-is-optional/Macros_Test_2.scala index e72c27881a..e72c27881a 100644 --- a/test/files/run/macro-expand-tparams-optional/Macros_Test_2.scala +++ b/test/files/run/macro-impl-tparam-typetag-is-optional/Macros_Test_2.scala diff --git a/test/files/run/macro-invalidusage-partialapplication-with-tparams.check b/test/files/run/macro-invalidusage-partialapplication-with-tparams.check index f1d5e925fa..326f3e08ca 100644 --- a/test/files/run/macro-invalidusage-partialapplication-with-tparams.check +++ b/test/files/run/macro-invalidusage-partialapplication-with-tparams.check @@ -1,3 +1,3 @@ reflective compilation has failed: -macros cannot be partially applied +too few argument lists for macro invocation diff --git a/test/files/run/macro-invalidusage-partialapplication.check b/test/files/run/macro-invalidusage-partialapplication.check index f1d5e925fa..326f3e08ca 100644 --- a/test/files/run/macro-invalidusage-partialapplication.check +++ b/test/files/run/macro-invalidusage-partialapplication.check @@ -1,3 +1,3 @@ reflective compilation has failed: -macros cannot be partially applied +too few argument lists for macro invocation diff --git a/test/files/run/macro-def-path-dependent-a.check b/test/files/run/macro-term-declared-in-annotation.check index 7658ad2c24..7658ad2c24 100644 --- a/test/files/run/macro-def-path-dependent-a.check +++ b/test/files/run/macro-term-declared-in-annotation.check diff --git a/test/files/run/macro-declared-in-implicit-class.flags b/test/files/run/macro-term-declared-in-annotation.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/run/macro-declared-in-implicit-class.flags +++ b/test/files/run/macro-term-declared-in-annotation.flags diff --git a/test/files/run/macro-declared-in-annotation/Impls_1.scala b/test/files/run/macro-term-declared-in-annotation/Impls_1.scala index 1ea06de679..1ea06de679 100644 --- a/test/files/run/macro-declared-in-annotation/Impls_1.scala +++ b/test/files/run/macro-term-declared-in-annotation/Impls_1.scala diff --git a/test/files/run/macro-declared-in-annotation/Macros_2.scala b/test/files/run/macro-term-declared-in-annotation/Macros_2.scala index 40d71c62fb..40d71c62fb 100644 --- a/test/files/run/macro-declared-in-annotation/Macros_2.scala +++ b/test/files/run/macro-term-declared-in-annotation/Macros_2.scala diff --git a/test/files/run/macro-declared-in-annotation/Test_3.scala b/test/files/run/macro-term-declared-in-annotation/Test_3.scala index 866487f028..866487f028 100644 --- a/test/files/run/macro-declared-in-annotation/Test_3.scala +++ b/test/files/run/macro-term-declared-in-annotation/Test_3.scala diff --git a/test/files/run/macro-declared-in-anonymous.check b/test/files/run/macro-term-declared-in-anonymous.check index 09b8d015a6..09b8d015a6 100644 --- a/test/files/run/macro-declared-in-anonymous.check +++ b/test/files/run/macro-term-declared-in-anonymous.check diff --git a/test/files/run/macro-declared-in-method.flags b/test/files/run/macro-term-declared-in-anonymous.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/run/macro-declared-in-method.flags +++ b/test/files/run/macro-term-declared-in-anonymous.flags diff --git a/test/files/run/macro-declared-in-anonymous/Impls_1.scala b/test/files/run/macro-term-declared-in-anonymous/Impls_1.scala index 348f3420f2..348f3420f2 100644 --- a/test/files/run/macro-declared-in-anonymous/Impls_1.scala +++ b/test/files/run/macro-term-declared-in-anonymous/Impls_1.scala diff --git a/test/files/run/macro-declared-in-anonymous/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-anonymous/Macros_Test_2.scala index 88cd29ae4f..88cd29ae4f 100644 --- a/test/files/run/macro-declared-in-anonymous/Macros_Test_2.scala +++ b/test/files/run/macro-term-declared-in-anonymous/Macros_Test_2.scala diff --git a/test/files/run/macro-declared-in-block.check b/test/files/run/macro-term-declared-in-block.check index 5e687db8bf..5e687db8bf 100644 --- a/test/files/run/macro-declared-in-block.check +++ b/test/files/run/macro-term-declared-in-block.check diff --git a/test/files/run/macro-declared-in-object-class.flags b/test/files/run/macro-term-declared-in-block.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/run/macro-declared-in-object-class.flags +++ b/test/files/run/macro-term-declared-in-block.flags diff --git a/test/files/run/macro-declared-in-block/Impls_1.scala b/test/files/run/macro-term-declared-in-block/Impls_1.scala index 348f3420f2..348f3420f2 100644 --- a/test/files/run/macro-declared-in-block/Impls_1.scala +++ b/test/files/run/macro-term-declared-in-block/Impls_1.scala diff --git a/test/files/run/macro-declared-in-block/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-block/Macros_Test_2.scala index 69088e24bc..69088e24bc 100644 --- a/test/files/run/macro-declared-in-block/Macros_Test_2.scala +++ b/test/files/run/macro-term-declared-in-block/Macros_Test_2.scala diff --git a/test/files/run/macro-declared-in-class-class.check b/test/files/run/macro-term-declared-in-class-class.check index 47248d7af7..47248d7af7 100644 --- a/test/files/run/macro-declared-in-class-class.check +++ b/test/files/run/macro-term-declared-in-class-class.check diff --git a/test/files/run/macro-declared-in-object-object.flags b/test/files/run/macro-term-declared-in-class-class.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/run/macro-declared-in-object-object.flags +++ b/test/files/run/macro-term-declared-in-class-class.flags diff --git a/test/files/run/macro-declared-in-class-class/Impls_1.scala b/test/files/run/macro-term-declared-in-class-class/Impls_1.scala index 348f3420f2..348f3420f2 100644 --- a/test/files/run/macro-declared-in-class-class/Impls_1.scala +++ b/test/files/run/macro-term-declared-in-class-class/Impls_1.scala diff --git a/test/files/run/macro-declared-in-class-class/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-class-class/Macros_Test_2.scala index 871857a97f..871857a97f 100644 --- a/test/files/run/macro-declared-in-class-class/Macros_Test_2.scala +++ b/test/files/run/macro-term-declared-in-class-class/Macros_Test_2.scala diff --git a/test/files/run/macro-declared-in-class-object.check b/test/files/run/macro-term-declared-in-class-object.check index 35af59e40f..35af59e40f 100644 --- a/test/files/run/macro-declared-in-class-object.check +++ b/test/files/run/macro-term-declared-in-class-object.check diff --git a/test/files/run/macro-declared-in-object.flags b/test/files/run/macro-term-declared-in-class-object.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/run/macro-declared-in-object.flags +++ b/test/files/run/macro-term-declared-in-class-object.flags diff --git a/test/files/run/macro-declared-in-class-object/Impls_1.scala b/test/files/run/macro-term-declared-in-class-object/Impls_1.scala index 348f3420f2..348f3420f2 100644 --- a/test/files/run/macro-declared-in-class-object/Impls_1.scala +++ b/test/files/run/macro-term-declared-in-class-object/Impls_1.scala diff --git a/test/files/run/macro-declared-in-class-object/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-class-object/Macros_Test_2.scala index 994f9fe935..994f9fe935 100644 --- a/test/files/run/macro-declared-in-class-object/Macros_Test_2.scala +++ b/test/files/run/macro-term-declared-in-class-object/Macros_Test_2.scala diff --git a/test/files/run/macro-declared-in-class.check b/test/files/run/macro-term-declared-in-class.check index a1c1d7af8b..a1c1d7af8b 100644 --- a/test/files/run/macro-declared-in-class.check +++ b/test/files/run/macro-term-declared-in-class.check diff --git a/test/files/run/macro-declared-in-package-object.flags b/test/files/run/macro-term-declared-in-class.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/run/macro-declared-in-package-object.flags +++ b/test/files/run/macro-term-declared-in-class.flags diff --git a/test/files/run/macro-declared-in-class/Impls_1.scala b/test/files/run/macro-term-declared-in-class/Impls_1.scala index 348f3420f2..348f3420f2 100644 --- a/test/files/run/macro-declared-in-class/Impls_1.scala +++ b/test/files/run/macro-term-declared-in-class/Impls_1.scala diff --git a/test/files/run/macro-declared-in-class/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-class/Macros_Test_2.scala index 1b9d13e775..1b9d13e775 100644 --- a/test/files/run/macro-declared-in-class/Macros_Test_2.scala +++ b/test/files/run/macro-term-declared-in-class/Macros_Test_2.scala diff --git a/test/files/run/macro-declared-in-default-param.check b/test/files/run/macro-term-declared-in-default-param.check index 6decd7aa4d..6decd7aa4d 100644 --- a/test/files/run/macro-declared-in-default-param.check +++ b/test/files/run/macro-term-declared-in-default-param.check diff --git a/test/files/run/macro-declared-in-refinement.flags b/test/files/run/macro-term-declared-in-default-param.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/run/macro-declared-in-refinement.flags +++ b/test/files/run/macro-term-declared-in-default-param.flags diff --git a/test/files/run/macro-declared-in-default-param/Impls_1.scala b/test/files/run/macro-term-declared-in-default-param/Impls_1.scala index 4380f40b04..4380f40b04 100644 --- a/test/files/run/macro-declared-in-default-param/Impls_1.scala +++ b/test/files/run/macro-term-declared-in-default-param/Impls_1.scala diff --git a/test/files/run/macro-declared-in-default-param/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-default-param/Macros_Test_2.scala index 356029e63e..356029e63e 100644 --- a/test/files/run/macro-declared-in-default-param/Macros_Test_2.scala +++ b/test/files/run/macro-term-declared-in-default-param/Macros_Test_2.scala diff --git a/test/files/run/macro-declared-in-implicit-class.check b/test/files/run/macro-term-declared-in-implicit-class.check index 5dc968c08c..5dc968c08c 100644 --- a/test/files/run/macro-declared-in-implicit-class.check +++ b/test/files/run/macro-term-declared-in-implicit-class.check diff --git a/test/files/run/macro-declared-in-trait.flags b/test/files/run/macro-term-declared-in-implicit-class.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/run/macro-declared-in-trait.flags +++ b/test/files/run/macro-term-declared-in-implicit-class.flags diff --git a/test/files/run/macro-declared-in-implicit-class/Impls_Macros_1.scala b/test/files/run/macro-term-declared-in-implicit-class/Impls_Macros_1.scala index 4c009cc367..4c009cc367 100644 --- a/test/files/run/macro-declared-in-implicit-class/Impls_Macros_1.scala +++ b/test/files/run/macro-term-declared-in-implicit-class/Impls_Macros_1.scala diff --git a/test/files/run/macro-declared-in-implicit-class/Test_2.scala b/test/files/run/macro-term-declared-in-implicit-class/Test_2.scala index d0bc9cc38c..d0bc9cc38c 100644 --- a/test/files/run/macro-declared-in-implicit-class/Test_2.scala +++ b/test/files/run/macro-term-declared-in-implicit-class/Test_2.scala diff --git a/test/files/run/macro-declared-in-method.check b/test/files/run/macro-term-declared-in-method.check index 5e687db8bf..5e687db8bf 100644 --- a/test/files/run/macro-declared-in-method.check +++ b/test/files/run/macro-term-declared-in-method.check diff --git a/test/files/run/macro-def-infer-return-type-a.flags b/test/files/run/macro-term-declared-in-method.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/run/macro-def-infer-return-type-a.flags +++ b/test/files/run/macro-term-declared-in-method.flags diff --git a/test/files/run/macro-declared-in-method/Impls_1.scala b/test/files/run/macro-term-declared-in-method/Impls_1.scala index 348f3420f2..348f3420f2 100644 --- a/test/files/run/macro-declared-in-method/Impls_1.scala +++ b/test/files/run/macro-term-declared-in-method/Impls_1.scala diff --git a/test/files/run/macro-declared-in-method/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-method/Macros_Test_2.scala index ed5c8b7c43..ed5c8b7c43 100644 --- a/test/files/run/macro-declared-in-method/Macros_Test_2.scala +++ b/test/files/run/macro-term-declared-in-method/Macros_Test_2.scala diff --git a/test/files/run/macro-declared-in-object-class.check b/test/files/run/macro-term-declared-in-object-class.check index 47248d7af7..47248d7af7 100644 --- a/test/files/run/macro-declared-in-object-class.check +++ b/test/files/run/macro-term-declared-in-object-class.check diff --git a/test/files/run/macro-def-infer-return-type-b.flags b/test/files/run/macro-term-declared-in-object-class.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/run/macro-def-infer-return-type-b.flags +++ b/test/files/run/macro-term-declared-in-object-class.flags diff --git a/test/files/run/macro-declared-in-object-class/Impls_1.scala b/test/files/run/macro-term-declared-in-object-class/Impls_1.scala index 348f3420f2..348f3420f2 100644 --- a/test/files/run/macro-declared-in-object-class/Impls_1.scala +++ b/test/files/run/macro-term-declared-in-object-class/Impls_1.scala diff --git a/test/files/run/macro-declared-in-object-class/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-object-class/Macros_Test_2.scala index 204deed61c..204deed61c 100644 --- a/test/files/run/macro-declared-in-object-class/Macros_Test_2.scala +++ b/test/files/run/macro-term-declared-in-object-class/Macros_Test_2.scala diff --git a/test/files/run/macro-declared-in-object-object.check b/test/files/run/macro-term-declared-in-object-object.check index 35af59e40f..35af59e40f 100644 --- a/test/files/run/macro-declared-in-object-object.check +++ b/test/files/run/macro-term-declared-in-object-object.check diff --git a/test/files/run/macro-def-infer-return-type-c.flags b/test/files/run/macro-term-declared-in-object-object.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/run/macro-def-infer-return-type-c.flags +++ b/test/files/run/macro-term-declared-in-object-object.flags diff --git a/test/files/run/macro-declared-in-object-object/Impls_1.scala b/test/files/run/macro-term-declared-in-object-object/Impls_1.scala index 348f3420f2..348f3420f2 100644 --- a/test/files/run/macro-declared-in-object-object/Impls_1.scala +++ b/test/files/run/macro-term-declared-in-object-object/Impls_1.scala diff --git a/test/files/run/macro-declared-in-object-object/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-object-object/Macros_Test_2.scala index e261a50f3d..e261a50f3d 100644 --- a/test/files/run/macro-declared-in-object-object/Macros_Test_2.scala +++ b/test/files/run/macro-term-declared-in-object-object/Macros_Test_2.scala diff --git a/test/files/run/macro-declared-in-object.check b/test/files/run/macro-term-declared-in-object.check index 4d955a96b1..4d955a96b1 100644 --- a/test/files/run/macro-declared-in-object.check +++ b/test/files/run/macro-term-declared-in-object.check diff --git a/test/files/run/macro-def-path-dependent-a.flags b/test/files/run/macro-term-declared-in-object.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/run/macro-def-path-dependent-a.flags +++ b/test/files/run/macro-term-declared-in-object.flags diff --git a/test/files/run/macro-declared-in-object/Impls_1.scala b/test/files/run/macro-term-declared-in-object/Impls_1.scala index 348f3420f2..348f3420f2 100644 --- a/test/files/run/macro-declared-in-object/Impls_1.scala +++ b/test/files/run/macro-term-declared-in-object/Impls_1.scala diff --git a/test/files/run/macro-declared-in-object/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-object/Macros_Test_2.scala index a5a4862ba0..a5a4862ba0 100644 --- a/test/files/run/macro-declared-in-object/Macros_Test_2.scala +++ b/test/files/run/macro-term-declared-in-object/Macros_Test_2.scala diff --git a/test/files/run/macro-declared-in-package-object.check b/test/files/run/macro-term-declared-in-package-object.check index bc0069178d..bc0069178d 100644 --- a/test/files/run/macro-declared-in-package-object.check +++ b/test/files/run/macro-term-declared-in-package-object.check diff --git a/test/files/run/macro-def-path-dependent-b.flags b/test/files/run/macro-term-declared-in-package-object.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/run/macro-def-path-dependent-b.flags +++ b/test/files/run/macro-term-declared-in-package-object.flags diff --git a/test/files/run/macro-declared-in-package-object/Impls_1.scala b/test/files/run/macro-term-declared-in-package-object/Impls_1.scala index 348f3420f2..348f3420f2 100644 --- a/test/files/run/macro-declared-in-package-object/Impls_1.scala +++ b/test/files/run/macro-term-declared-in-package-object/Impls_1.scala diff --git a/test/files/run/macro-declared-in-package-object/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-package-object/Macros_Test_2.scala index 54a5962e80..54a5962e80 100644 --- a/test/files/run/macro-declared-in-package-object/Macros_Test_2.scala +++ b/test/files/run/macro-term-declared-in-package-object/Macros_Test_2.scala diff --git a/test/files/run/macro-declared-in-refinement.check b/test/files/run/macro-term-declared-in-refinement.check index 09b8d015a6..09b8d015a6 100644 --- a/test/files/run/macro-declared-in-refinement.check +++ b/test/files/run/macro-term-declared-in-refinement.check diff --git a/test/files/run/macro-def-path-dependent-c.flags b/test/files/run/macro-term-declared-in-refinement.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/run/macro-def-path-dependent-c.flags +++ b/test/files/run/macro-term-declared-in-refinement.flags diff --git a/test/files/run/macro-declared-in-refinement/Impls_1.scala b/test/files/run/macro-term-declared-in-refinement/Impls_1.scala index 348f3420f2..348f3420f2 100644 --- a/test/files/run/macro-declared-in-refinement/Impls_1.scala +++ b/test/files/run/macro-term-declared-in-refinement/Impls_1.scala diff --git a/test/files/run/macro-declared-in-refinement/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-refinement/Macros_Test_2.scala index ff9a66d58a..ff9a66d58a 100644 --- a/test/files/run/macro-declared-in-refinement/Macros_Test_2.scala +++ b/test/files/run/macro-term-declared-in-refinement/Macros_Test_2.scala diff --git a/test/files/run/macro-declared-in-trait.check b/test/files/run/macro-term-declared-in-trait.check index 0d70ac74f3..0d70ac74f3 100644 --- a/test/files/run/macro-declared-in-trait.check +++ b/test/files/run/macro-term-declared-in-trait.check diff --git a/test/files/run/macro-def-path-dependent-d1.flags b/test/files/run/macro-term-declared-in-trait.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/run/macro-def-path-dependent-d1.flags +++ b/test/files/run/macro-term-declared-in-trait.flags diff --git a/test/files/run/macro-declared-in-trait/Impls_1.scala b/test/files/run/macro-term-declared-in-trait/Impls_1.scala index 348f3420f2..348f3420f2 100644 --- a/test/files/run/macro-declared-in-trait/Impls_1.scala +++ b/test/files/run/macro-term-declared-in-trait/Impls_1.scala diff --git a/test/files/run/macro-declared-in-trait/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-trait/Macros_Test_2.scala index f75906b636..f75906b636 100644 --- a/test/files/run/macro-declared-in-trait/Macros_Test_2.scala +++ b/test/files/run/macro-term-declared-in-trait/Macros_Test_2.scala diff --git a/test/files/run/macro-toplevel-companion-b/Test_2.scala b/test/files/run/macro-toplevel-companion-b/Test_2.scala index ca202d053f..4e766bde89 100644 --- a/test/files/run/macro-toplevel-companion-b/Test_2.scala +++ b/test/files/run/macro-toplevel-companion-b/Test_2.scala @@ -7,5 +7,5 @@ import Macros._ object Test extends App { val tb = cm.mkToolBox() try tb.compile(Select(Ident(TermName("Macros")), TermName("foo"))) - catch { case ToolBoxError(message, _) => println("""macroSynthetic-.*?\.scala""".r.replaceAllIn(message, "<synthetic file name>")) } + catch { case ToolBoxError(message, _) => println("""(Found in|and) .*?compileLateSynthetic-.*?\.scala""".r.replaceAllIn(message, m => m.group(1) + " <synthetic file name>")) } }
\ No newline at end of file diff --git a/test/files/run/macro-toplevel-companion-c.scala b/test/files/run/macro-toplevel-companion-c.scala index 0e99903158..c315f8b942 100644 --- a/test/files/run/macro-toplevel-companion-c.scala +++ b/test/files/run/macro-toplevel-companion-c.scala @@ -45,7 +45,7 @@ object Test extends DirectTest { log("Compiling Test_2...") if (compileTest()) log("Success!") else log("Failed...") } - println("""macroSynthetic-.*?\.scala""".r.replaceAllIn(baos.toString, "<synthetic file name>")) + println("""(Found in|and) .*?compileLateSynthetic-.*?\.scala""".r.replaceAllIn(baos.toString, m => m.group(1) + " <synthetic file name>")) System.setErr(prevErr) } }
\ No newline at end of file diff --git a/test/files/run/reify-repl-fail-gracefully.check b/test/files/run/reify-repl-fail-gracefully.check index 1b0f3f2162..18cfd5a7ef 100644 --- a/test/files/run/reify-repl-fail-gracefully.check +++ b/test/files/run/reify-repl-fail-gracefully.check @@ -12,7 +12,7 @@ import scala.reflect.runtime.universe._ scala> scala> reify -<console>:12: error: macros cannot be partially applied +<console>:12: error: too few argument lists for macro invocation reify ^ diff --git a/test/files/run/repl-term-macros.check b/test/files/run/repl-term-macros.check new file mode 100644 index 0000000000..eae489c294 --- /dev/null +++ b/test/files/run/repl-term-macros.check @@ -0,0 +1,44 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> + +scala> import scala.reflect.macros.Context +import scala.reflect.macros.Context + +scala> import language.experimental.macros +import language.experimental.macros + +scala> + +scala> def impl1(c: Context) = c.literalUnit +impl1: (c: scala.reflect.macros.Context)c.Expr[Unit] + +scala> def foo1 = macro impl1 +defined term macro foo1: Unit + +scala> foo1 + +scala> + +scala> def impl2(c: Context)() = c.literalUnit +impl2: (c: scala.reflect.macros.Context)()c.Expr[Unit] + +scala> def foo2() = macro impl2 +defined term macro foo2: ()Unit + +scala> foo2() + +scala> + +scala> def impl3(c: Context)(x: c.Expr[Int])(y: c.Expr[Int]) = c.literalUnit +impl3: (c: scala.reflect.macros.Context)(x: c.Expr[Int])(y: c.Expr[Int])c.Expr[Unit] + +scala> def foo3(x: Int)(y: Int) = macro impl3 +defined term macro foo3: (x: Int)(y: Int)Unit + +scala> foo3(2)(3) + +scala> + +scala> diff --git a/test/files/run/repl-term-macros.scala b/test/files/run/repl-term-macros.scala new file mode 100644 index 0000000000..f826259be9 --- /dev/null +++ b/test/files/run/repl-term-macros.scala @@ -0,0 +1,20 @@ +import scala.tools.partest.ReplTest + +object Test extends ReplTest { + def code = """ + import scala.reflect.macros.Context +import language.experimental.macros + +def impl1(c: Context) = c.literalUnit +def foo1 = macro impl1 +foo1 + +def impl2(c: Context)() = c.literalUnit +def foo2() = macro impl2 +foo2() + +def impl3(c: Context)(x: c.Expr[Int])(y: c.Expr[Int]) = c.literalUnit +def foo3(x: Int)(y: Int) = macro impl3 +foo3(2)(3) + """ +}
\ No newline at end of file diff --git a/test/files/run/t2464/Annotated.java b/test/files/run/t2464/Annotated.java new file mode 100644 index 0000000000..d022f9852c --- /dev/null +++ b/test/files/run/t2464/Annotated.java @@ -0,0 +1,5 @@ +package test; + +@Connect(loadStyle = Connect.LoadStyle.EAGER) +public class Annotated { +} diff --git a/test/files/run/t2464/Connect.java b/test/files/run/t2464/Connect.java new file mode 100644 index 0000000000..59349f94c8 --- /dev/null +++ b/test/files/run/t2464/Connect.java @@ -0,0 +1,20 @@ +package test; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +public @interface Connect { + + LoadStyle loadStyle() default LoadStyle.EAGER; + + public enum LoadStyle { + EAGER, + DEFERRED, + LAZY + } +} diff --git a/test/files/run/t2464/Test.scala b/test/files/run/t2464/Test.scala new file mode 100644 index 0000000000..90e1a03c17 --- /dev/null +++ b/test/files/run/t2464/Test.scala @@ -0,0 +1,35 @@ +import scala.reflect.io.Streamable +import scala.tools.asm.{ClassWriter, ClassReader} +import scala.tools.asm.tree.ClassNode +import scala.tools.partest._ +import scala.tools.partest.BytecodeTest.modifyClassFile +import java.io.{FileOutputStream, FileInputStream, File} + +object Test extends DirectTest { + def code = ??? + + def compileCode(code: String) = { + val classpath = List(sys.props("partest.lib"), testOutput.path) mkString sys.props("path.separator") + compileString(newCompiler("-cp", classpath, "-d", testOutput.path))(code) + } + + def app = """ + object O { + new test.Annotated + } + """ + + def show(): Unit = { + compileCode(app) + modifyClassFile(new File(testOutput.toFile, "test/Annotated.class")) { + (cn: ClassNode) => + // As investigated https://issues.scala-lang.org/browse/SI-2464?focusedCommentId=64521&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-64521 + // classfiles in the wild sometimes lack the required InnerClass attribute for nested enums that + // are referenced in an annotation. I don't know what compiler or bytecode processor leaves things + // that way, but this test makes sure we don't crash. + cn.innerClasses.clear() + cn + } + compileCode(app) + } +} diff --git a/test/files/run/t3425b/Base_1.scala b/test/files/run/t3425b/Base_1.scala index 02e108b320..5a660a89b2 100644 --- a/test/files/run/t3425b/Base_1.scala +++ b/test/files/run/t3425b/Base_1.scala @@ -9,7 +9,7 @@ class ABC extends A with B with C { private def reflected = ( Thread.currentThread.getStackTrace takeWhile (_.getMethodName != "main") - exists (_.toString contains "java.lang.reflect.") + exists (_.toString contains "sun.reflect.") ) lazy val y: PQ = new PQ(reflected) } diff --git a/test/files/run/t6308.check b/test/files/run/t6308.check new file mode 100644 index 0000000000..e2577db72a --- /dev/null +++ b/test/files/run/t6308.check @@ -0,0 +1,16 @@ +- Unspecialized type args +// Specialized +f1 f1$mIc$sp +f2 f2$mIc$sp +f3 f3$mIc$sp +f4 f4$mIc$sp +f5 f5$mIc$sp + +// Unspecialized type args +f4(Boolean) f4 +f4(String) f4 + +// Ideally these would be specialized +todo1 todo1 +todo2 todo2 +todo3 todo3 diff --git a/test/files/run/t6308.scala b/test/files/run/t6308.scala new file mode 100644 index 0000000000..bcd89359b0 --- /dev/null +++ b/test/files/run/t6308.scala @@ -0,0 +1,41 @@ +import scala.{specialized => sp} + +object Test { + def caller = new Exception().getStackTrace()(1).getMethodName + def f1[@sp(Int) A](a: A, b: Any) = caller + def f2[@sp(Int) A, B](a: A, b: String) = caller + def f3[B, @sp(Int) A](a: A, b: List[B]) = caller + def f4[B, @sp(Int) A](a: A, b: List[(A, B)]) = caller + + def f5[@sp(Int) A, B <: Object](a: A, b: B) = caller + + // `uncurryTreeType` calls a TypeMap on the call to this method and we end up with new + // type parameter symbols, which are not found in `TypeEnv.includes(typeEnv(member), env)` + // in `specSym`. (One of `uncurry`'s tasks is to expand type aliases in signatures.) + type T = Object + def todo1[@sp(Int) A, B <: T](a: A, b: String) = caller + def todo2[@sp(Int) A, B <: AnyRef](a: A, b: String) = caller + def todo3[B <: List[A], @specialized(Int) A](a: A, b: B) = caller + + def main(args: Array[String]) { + val s = "" + val result = + s"""|- Unspecialized type args + |// Specialized + |f1 ${f1(1,"some ref")} + |f2 ${f2(1,"some ref")} + |f3 ${f3(1,List("some ref"))} + |f4 ${f4(1,Nil)} + |f5 ${f5(1,s)} + | + |// Unspecialized type args + |f4(Boolean) ${f4(Boolean,Nil)} + |f4(String) ${f4("",Nil)} + | + |// Ideally these would be specialized + |todo1 ${todo1(1,s)} + |todo2 ${todo2(1,s)} + |todo3 ${todo3(1,List(0))}""".stripMargin + println(result) + } +} diff --git a/test/files/run/t6309.check b/test/files/run/t6309.check new file mode 100644 index 0000000000..7f8f011eb7 --- /dev/null +++ b/test/files/run/t6309.check @@ -0,0 +1 @@ +7 diff --git a/test/files/run/t6309.scala b/test/files/run/t6309.scala new file mode 100644 index 0000000000..7bbca63c2a --- /dev/null +++ b/test/files/run/t6309.scala @@ -0,0 +1,16 @@ +trait A { + def a: Int +} + +object Test { + def f(a: Int) = new { + //private val b = a + private[this] val b = a // crashes, sorry scalac + } with A { + def a = b + } + + def main(args: Array[String]) { + println(f(7).a) + } +} diff --git a/test/files/run/t7157.check b/test/files/run/t7157.check new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/files/run/t7157.check @@ -0,0 +1 @@ +1 diff --git a/test/files/run/t7157/Impls_Macros_1.scala b/test/files/run/t7157/Impls_Macros_1.scala new file mode 100644 index 0000000000..ad3d96eb85 --- /dev/null +++ b/test/files/run/t7157/Impls_Macros_1.scala @@ -0,0 +1,15 @@ +import scala.reflect.macros.Context +import language.experimental.macros + +object Macros { + object AImpl { + def a(ctx: Context)(args: ctx.Expr[Any]*): ctx.Expr[Unit] = { + import ctx.universe._ + ctx.Expr[Unit](Apply(Ident(TermName("println")), List(Literal(Constant(1))))) + } + } + + implicit class A(context: StringContext) { + def a(args: Any*): Unit = macro AImpl.a + } +}
\ No newline at end of file diff --git a/test/files/run/macro-def-path-dependent-c/Test_2.scala b/test/files/run/t7157/Test_2.scala index 7dffc5107d..cceb5ca177 100644 --- a/test/files/run/macro-def-path-dependent-c/Test_2.scala +++ b/test/files/run/t7157/Test_2.scala @@ -1,3 +1,5 @@ +import Macros._ + object Test extends App { - println("it works") + a"" }
\ No newline at end of file diff --git a/test/files/run/t7375a.check b/test/files/run/t7375a.check new file mode 100644 index 0000000000..a0a15dfb2f --- /dev/null +++ b/test/files/run/t7375a.check @@ -0,0 +1,4 @@ +C1 +C2 +C1 +C2 diff --git a/test/files/run/t7375a.scala b/test/files/run/t7375a.scala new file mode 100644 index 0000000000..e46ad08f63 --- /dev/null +++ b/test/files/run/t7375a.scala @@ -0,0 +1,16 @@ +import scala.reflect.ClassTag + +class C1(val n: Int) extends AnyVal +class C2(val n: Int) extends AnyRef + +object Test { + type F1 = C1 + type F2 = C2 + + def main(args: Array[String]): Unit = { + println(implicitly[ClassTag[C1]]) + println(implicitly[ClassTag[C2]]) + println(implicitly[ClassTag[F1]]) + println(implicitly[ClassTag[F2]]) + } +} diff --git a/test/files/run/t7375b.check b/test/files/run/t7375b.check new file mode 100644 index 0000000000..d7578e28ba --- /dev/null +++ b/test/files/run/t7375b.check @@ -0,0 +1,4 @@ +Predef.this.classOf[C1] +Predef.this.classOf[C2] +Predef.this.classOf[C1] +Predef.this.classOf[C2] diff --git a/test/files/run/t7375b/Macros_1.scala b/test/files/run/t7375b/Macros_1.scala new file mode 100644 index 0000000000..70e79cc2b4 --- /dev/null +++ b/test/files/run/t7375b/Macros_1.scala @@ -0,0 +1,18 @@ +import language.experimental.macros +import scala.reflect.macros.Context + +class C1(val n: Int) extends AnyVal +class C2(val n: Int) extends AnyRef + +object Macros { + type F1 = C1 + type F2 = C2 + + def foo = macro impl + def impl(c: Context) = { + import c.universe._ + def test[T: c.TypeTag] = reify(println(c.literal(c.reifyRuntimeClass(c.typeOf[T]).toString).splice)).tree + def tests = Block(List(test[C1], test[C2], test[F1], test[F2]), Literal(Constant(()))) + c.Expr[Unit](tests) + } +}
\ No newline at end of file diff --git a/test/files/run/macro-def-path-dependent-b/Test_2.scala b/test/files/run/t7375b/Test_2.scala index 7dffc5107d..acfddae942 100644 --- a/test/files/run/macro-def-path-dependent-b/Test_2.scala +++ b/test/files/run/t7375b/Test_2.scala @@ -1,3 +1,3 @@ object Test extends App { - println("it works") + Macros.foo }
\ No newline at end of file diff --git a/test/files/run/t7498.scala b/test/files/run/t7498.scala new file mode 100644 index 0000000000..1dbf0597e0 --- /dev/null +++ b/test/files/run/t7498.scala @@ -0,0 +1,20 @@ + + + + + + + +object Test extends App { + import scala.collection.concurrent.TrieMap + + class Collision(val idx: Int) { + override def hashCode = idx % 10 + } + + val tm = TrieMap[Collision, Unit]() + for (i <- 0 until 1000) tm(new Collision(i)) = () + + tm.par.foreach(kv => ()) +} + diff --git a/test/files/run/t7507.scala b/test/files/run/t7507.scala new file mode 100644 index 0000000000..6c1959ddac --- /dev/null +++ b/test/files/run/t7507.scala @@ -0,0 +1,31 @@ +trait Cake extends Slice + +// Minimization +trait Slice { self: Cake => // must have self type that extends `Slice` + private[this] val bippy = () // must be private[this] + locally(bippy) +} + +// Originally reported bug: +trait Cake1 extends Slice1 +trait Slice1 { self: Cake1 => + import java.lang.String // any import will do! + val Tuple2(x, y) = ((1, 2)) +} + + +// Nesting +trait Cake3 extends Outer.Slice3 + +// Minimization +object Outer { + private[this] val bippy = () + trait Slice3 { self: Cake3 => + locally(bippy) + } +} + +object Test extends App { + val s1 = new Cake1 {} + assert((s1.x, s1.y) == (1, 2), (s1.x, s1.y)) +} |