diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2013-10-02 16:47:11 +0200 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-11-12 18:40:01 -0800 |
commit | ce37ae45e22463a3f1a2d659d6699f2977b26c6b (patch) | |
tree | c10f54142a9db9653c6c8518e579987093e753ed /test/files/neg | |
parent | beed16825e53077c40ff38b035bfaafb3a4e39d5 (diff) | |
download | scala-ce37ae45e22463a3f1a2d659d6699f2977b26c6b.tar.gz scala-ce37ae45e22463a3f1a2d659d6699f2977b26c6b.tar.bz2 scala-ce37ae45e22463a3f1a2d659d6699f2977b26c6b.zip |
blackbox and whitebox macros
This is the first commit in the series. This commit only:
1) Splits Context into BlackboxContext and WhiteboxContext
2) Splits Macro into BlackboxMacro and WhiteboxMacro
3) Introduces the isBundle property in the macro impl binding
Here we just teach the compiler that macros can now be blackbox and whitebox,
without actually imposing any restrictions on blackbox macros. These
restrictions will come in subsequent commits.
For description and documentation of the blackbox/whitebox separation
see the official macro guide at the scaladoc website:
http://docs.scala-lang.org/overviews/macros/blackbox-whitebox.html
Some infrastructure work to make evolving macros easier:
compile partest-extras with quick so they can use latest library/reflect/...
Diffstat (limited to 'test/files/neg')
57 files changed, 192 insertions, 181 deletions
diff --git a/test/files/neg/macro-abort/Macros_1.scala b/test/files/neg/macro-abort/Macros_1.scala index 676c112098..577e640089 100644 --- a/test/files/neg/macro-abort/Macros_1.scala +++ b/test/files/neg/macro-abort/Macros_1.scala @@ -1,8 +1,8 @@ import scala.language.experimental.macros -import scala.reflect.macros.Context +import scala.reflect.macros.BlackboxContext object Macros { - def impl(c: Context) = { + def impl(c: BlackboxContext) = { c.abort(c.enclosingPosition, "aborted") } def abort = macro impl diff --git a/test/files/neg/macro-basic-mamdmi/Impls_Macros_Test_1.scala b/test/files/neg/macro-basic-mamdmi/Impls_Macros_Test_1.scala index 97780ef503..ae34815d37 100644 --- a/test/files/neg/macro-basic-mamdmi/Impls_Macros_Test_1.scala +++ b/test/files/neg/macro-basic-mamdmi/Impls_Macros_Test_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.macros.{Context => Ctx} +import scala.reflect.macros.{BlackboxContext => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { diff --git a/test/files/neg/macro-bundle-abstract.check b/test/files/neg/macro-bundle-abstract.check index 4b07adcc95..8ef59106b8 100644 --- a/test/files/neg/macro-bundle-abstract.check +++ b/test/files/neg/macro-bundle-abstract.check @@ -1,4 +1,4 @@ -macro-bundle-abstract.scala:5: error: class Bundle$Bundle needs to be abstract, since method deferred in trait Bundle of type => Int is not defined -trait Bundle extends Macro { +macro-bundle-abstract.scala:4: error: class Bundle$Bundle needs to be abstract, since method deferred in trait Bundle of type => Int is not defined +trait Bundle extends BlackboxMacro { ^ one error found diff --git a/test/files/neg/macro-bundle-abstract.scala b/test/files/neg/macro-bundle-abstract.scala index 2b302045da..f7778d03be 100644 --- a/test/files/neg/macro-bundle-abstract.scala +++ b/test/files/neg/macro-bundle-abstract.scala @@ -1,8 +1,7 @@ import scala.language.experimental.macros -import scala.reflect.macros.Macro -import scala.reflect.macros.Context +import scala.reflect.macros.BlackboxMacro -trait Bundle extends Macro { +trait Bundle extends BlackboxMacro { def deferred: Int def impl = ??? } diff --git a/test/files/neg/macro-bundle-class.check b/test/files/neg/macro-bundle-class.check index 92695390ab..8fd04f1303 100644 --- a/test/files/neg/macro-bundle-class.check +++ b/test/files/neg/macro-bundle-class.check @@ -1,4 +1,4 @@ -macro-bundle-class.scala:10: error: macro bundles must be monomorphic traits extending scala.reflect.macros.Macro and not implementing its `val c: Context` member +macro-bundle-class.scala:10: error: macro bundles must be monomorphic traits extending either BlackboxMacro or WhiteboxMacro and not implementing their `val c: BlackboxContext/WhiteboxContext` member def foo = macro Bundle.impl ^ one error found diff --git a/test/files/neg/macro-bundle-class.scala b/test/files/neg/macro-bundle-class.scala index 4b92cdd40f..024e2dbaaa 100644 --- a/test/files/neg/macro-bundle-class.scala +++ b/test/files/neg/macro-bundle-class.scala @@ -1,8 +1,8 @@ import scala.language.experimental.macros -import scala.reflect.macros.Macro -import scala.reflect.macros.Context +import scala.reflect.macros.BlackboxMacro +import scala.reflect.macros.BlackboxContext -class Bundle(val c: Context) extends Macro { +class Bundle(val c: BlackboxContext) extends BlackboxMacro { def impl = ??? } diff --git a/test/files/neg/macro-bundle-mixbox.check b/test/files/neg/macro-bundle-mixbox.check new file mode 100644 index 0000000000..4f8cedcece --- /dev/null +++ b/test/files/neg/macro-bundle-mixbox.check @@ -0,0 +1,4 @@ +macro-bundle-mixbox.scala:9: error: macro bundles must be monomorphic traits extending either BlackboxMacro or WhiteboxMacro and not implementing their `val c: BlackboxContext/WhiteboxContext` member + def foo = macro Bundle.impl + ^ +one error found diff --git a/test/files/neg/macro-bundle-mixbox.scala b/test/files/neg/macro-bundle-mixbox.scala new file mode 100644 index 0000000000..1e36f3d94c --- /dev/null +++ b/test/files/neg/macro-bundle-mixbox.scala @@ -0,0 +1,10 @@ +import scala.language.experimental.macros +import scala.reflect.macros.{BlackboxMacro, WhiteboxMacro} + +trait Bundle extends BlackboxMacro with WhiteboxMacro { + def impl = ??? +} + +object Macros { + def foo = macro Bundle.impl +}
\ No newline at end of file diff --git a/test/files/neg/macro-bundle-object.check b/test/files/neg/macro-bundle-object.check index 8c19271b51..e148e86969 100644 --- a/test/files/neg/macro-bundle-object.check +++ b/test/files/neg/macro-bundle-object.check @@ -1,6 +1,6 @@ -macro-bundle-object.scala:11: error: macro implementation has wrong shape: - required: (c: scala.reflect.macros.Context): c.Expr[Any] - or : (c: scala.reflect.macros.Context): c.Tree +macro-bundle-object.scala:10: error: macro implementation has wrong shape: + required: (c: scala.reflect.macros.BlackboxContext): c.Expr[Any] + or : (c: scala.reflect.macros.BlackboxContext): c.Tree found : : Nothing number of parameter sections differ def foo = macro Bundle.impl diff --git a/test/files/neg/macro-bundle-object.scala b/test/files/neg/macro-bundle-object.scala index 98c4238a62..105c81f1f5 100644 --- a/test/files/neg/macro-bundle-object.scala +++ b/test/files/neg/macro-bundle-object.scala @@ -1,9 +1,8 @@ import scala.language.experimental.macros -import scala.reflect.macros.Macro -import scala.reflect.macros.Context +import scala.reflect.macros.{BlackboxMacro, BlackboxContext} -object Bundle extends Macro { - val c: Context = ??? +object Bundle extends BlackboxMacro { + val c: BlackboxContext = ??? def impl = ??? } diff --git a/test/files/neg/macro-bundle-polymorphic.check b/test/files/neg/macro-bundle-polymorphic.check index 204bd30bca..07c5f551b1 100644 --- a/test/files/neg/macro-bundle-polymorphic.check +++ b/test/files/neg/macro-bundle-polymorphic.check @@ -1,10 +1,10 @@ -macro-bundle-polymorphic.scala:10: error: macro bundles must be monomorphic traits extending scala.reflect.macros.Macro and not implementing its `val c: Context` member +macro-bundle-polymorphic.scala:9: error: macro bundles must be monomorphic traits extending either BlackboxMacro or WhiteboxMacro and not implementing their `val c: BlackboxContext/WhiteboxContext` member def foo = macro Bundle.impl ^ -macro-bundle-polymorphic.scala:11: error: macro bundles must be monomorphic traits extending scala.reflect.macros.Macro and not implementing its `val c: Context` member +macro-bundle-polymorphic.scala:10: error: macro bundles must be monomorphic traits extending either BlackboxMacro or WhiteboxMacro and not implementing their `val c: BlackboxContext/WhiteboxContext` member def foo = macro Bundle[Int].impl ^ -macro-bundle-polymorphic.scala:12: error: macro bundles must be monomorphic traits extending scala.reflect.macros.Macro and not implementing its `val c: Context` member +macro-bundle-polymorphic.scala:11: error: macro bundles must be monomorphic traits extending either BlackboxMacro or WhiteboxMacro and not implementing their `val c: BlackboxContext/WhiteboxContext` member def foo = macro Bundle[Int, Nothing].impl ^ three errors found diff --git a/test/files/neg/macro-bundle-polymorphic.scala b/test/files/neg/macro-bundle-polymorphic.scala index 0468d841bd..faf1e2e9e5 100644 --- a/test/files/neg/macro-bundle-polymorphic.scala +++ b/test/files/neg/macro-bundle-polymorphic.scala @@ -1,8 +1,7 @@ import scala.language.experimental.macros -import scala.reflect.macros.Macro -import scala.reflect.macros.Context +import scala.reflect.macros.BlackboxMacro -trait Bundle[T] extends Macro { +trait Bundle[T] extends BlackboxMacro { def impl = ??? } diff --git a/test/files/neg/macro-bundle-trait.check b/test/files/neg/macro-bundle-trait.check index 972788c577..bf906a5310 100644 --- a/test/files/neg/macro-bundle-trait.check +++ b/test/files/neg/macro-bundle-trait.check @@ -1,4 +1,4 @@ -macro-bundle-trait.scala:11: error: macro bundles must be monomorphic traits extending scala.reflect.macros.Macro and not implementing its `val c: Context` member +macro-bundle-trait.scala:11: error: macro bundles must be monomorphic traits extending either BlackboxMacro or WhiteboxMacro and not implementing their `val c: BlackboxContext/WhiteboxContext` member def foo = macro Bundle.impl ^ one error found diff --git a/test/files/neg/macro-bundle-trait.scala b/test/files/neg/macro-bundle-trait.scala index ddc87f6db3..62ade49953 100644 --- a/test/files/neg/macro-bundle-trait.scala +++ b/test/files/neg/macro-bundle-trait.scala @@ -1,9 +1,9 @@ import scala.language.experimental.macros -import scala.reflect.macros.Macro -import scala.reflect.macros.Context +import scala.reflect.macros.BlackboxMacro +import scala.reflect.macros.BlackboxContext -trait Bundle extends Macro { - val c: Context = ??? +trait Bundle extends BlackboxMacro { + val c: BlackboxContext = ??? def impl = ??? } diff --git a/test/files/neg/macro-cyclic/Impls_Macros_1.scala b/test/files/neg/macro-cyclic/Impls_Macros_1.scala index ac9b7938db..ba08345bcc 100644 --- a/test/files/neg/macro-cyclic/Impls_Macros_1.scala +++ b/test/files/neg/macro-cyclic/Impls_Macros_1.scala @@ -1,7 +1,7 @@ -import scala.reflect.macros.Context +import scala.reflect.macros.BlackboxContext object Macros { - def impl(c: Context) = { + def impl(c: BlackboxContext) = { c.universe.reify { implicitly[SourceLocation] } } diff --git a/test/files/neg/macro-divergence-controlled/Impls_Macros_1.scala b/test/files/neg/macro-divergence-controlled/Impls_Macros_1.scala index 3983f590dc..23fcdd6445 100644 --- a/test/files/neg/macro-divergence-controlled/Impls_Macros_1.scala +++ b/test/files/neg/macro-divergence-controlled/Impls_Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.macros.Context +import scala.reflect.macros.BlackboxContext import language.experimental.macros trait Complex[T] @@ -6,7 +6,7 @@ trait Complex[T] class Foo(val foo: Foo) object Complex { - def impl[T: c.WeakTypeTag](c: Context): c.Expr[Complex[T]] = { + def impl[T: c.WeakTypeTag](c: BlackboxContext): c.Expr[Complex[T]] = { import c.universe._ val tpe = weakTypeOf[T] for (f <- tpe.declarations.collect{case f: TermSymbol if f.isParamAccessor && !f.isMethod => f}) { diff --git a/test/files/neg/macro-exception/Macros_1.scala b/test/files/neg/macro-exception/Macros_1.scala index 60e4020aec..7bd8415e4f 100644 --- a/test/files/neg/macro-exception/Macros_1.scala +++ b/test/files/neg/macro-exception/Macros_1.scala @@ -1,8 +1,8 @@ import scala.language.experimental.macros -import scala.reflect.macros.Context +import scala.reflect.macros.BlackboxContext object Macros { - def impl(c: Context) = { + def impl(c: BlackboxContext) = { throw new Exception() } def exception = macro impl diff --git a/test/files/neg/macro-false-deprecation-warning/Impls_Macros_1.scala b/test/files/neg/macro-false-deprecation-warning/Impls_Macros_1.scala index 6dc2ea114b..1bd808d55d 100644 --- a/test/files/neg/macro-false-deprecation-warning/Impls_Macros_1.scala +++ b/test/files/neg/macro-false-deprecation-warning/Impls_Macros_1.scala @@ -1,11 +1,11 @@ -import scala.reflect.macros.Context +import scala.reflect.macros.BlackboxContext object Helper { def unapplySeq[T](x: List[T]): Option[Seq[T]] = } object Macros { - def impl[T: c.WeakTypeTag](c: Context)(x: c.Expr[List[T]]) = { + def impl[T: c.WeakTypeTag](c: BlackboxContext)(x: c.Expr[List[T]]) = { c.universe.reify(Helper.unapplySeq(x.splice)) } diff --git a/test/files/neg/macro-invalidimpl.check b/test/files/neg/macro-invalidimpl.check index e39cc8105b..432da4d00b 100644 --- a/test/files/neg/macro-invalidimpl.check +++ b/test/files/neg/macro-invalidimpl.check @@ -19,28 +19,28 @@ macro [<macro bundle>].<method name>[[<type args>]] def foo(x: Any) = macro Impls4.foo ^ Macros_Test_2.scala:26: error: ambiguous reference to overloaded definition, -both method foo in object Impls5 of type (c: scala.reflect.macros.Context)(x: c.Expr[Any], y: c.Expr[Any])Nothing -and method foo in object Impls5 of type (c: scala.reflect.macros.Context)(x: c.Expr[Any])Nothing +both method foo in object Impls5 of type (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Any], y: c.Expr[Any])Nothing +and method foo in object Impls5 of type (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Any])Nothing match expected type ? def foo(x: Any) = macro Impls5.foo ^ Macros_Test_2.scala:27: error: ambiguous reference to overloaded definition, -both method foo in object Impls5 of type (c: scala.reflect.macros.Context)(x: c.Expr[Any], y: c.Expr[Any])Nothing -and method foo in object Impls5 of type (c: scala.reflect.macros.Context)(x: c.Expr[Any])Nothing +both method foo in object Impls5 of type (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Any], y: c.Expr[Any])Nothing +and method foo in object Impls5 of type (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Any])Nothing match expected type ? def foo(x: Any, y: Any) = macro Impls5.foo ^ Macros_Test_2.scala:31: error: macro implementation has wrong shape: - required: (c: scala.reflect.macros.Context): c.Expr[Unit] - or : (c: scala.reflect.macros.Context): c.Tree - found : (c: scala.reflect.macros.Context)(): c.Expr[Unit] + required: (c: scala.reflect.macros.BlackboxContext): c.Expr[Unit] + or : (c: scala.reflect.macros.BlackboxContext): c.Tree + found : (c: scala.reflect.macros.BlackboxContext)(): c.Expr[Unit] number of parameter sections differ def foo1 = macro Impls6.fooEmpty ^ Macros_Test_2.scala:32: error: macro implementation has wrong shape: - required: (c: scala.reflect.macros.Context)(): c.Expr[Unit] - or : (c: scala.reflect.macros.Context)(): c.Tree - found : (c: scala.reflect.macros.Context): c.Expr[Unit] + required: (c: scala.reflect.macros.BlackboxContext)(): c.Expr[Unit] + or : (c: scala.reflect.macros.BlackboxContext)(): c.Tree + found : (c: scala.reflect.macros.BlackboxContext): c.Expr[Unit] number of parameter sections differ def bar1() = macro Impls6.fooNullary ^ diff --git a/test/files/neg/macro-invalidimpl/Impls_1.scala b/test/files/neg/macro-invalidimpl/Impls_1.scala index 9f48ab7ad9..b85ac9ee43 100644 --- a/test/files/neg/macro-invalidimpl/Impls_1.scala +++ b/test/files/neg/macro-invalidimpl/Impls_1.scala @@ -1,39 +1,39 @@ -import scala.reflect.macros.Context +import scala.reflect.macros.BlackboxContext class Impls1 { - def foo(c: Context)(x: c.Expr[Any]) = ??? + def foo(c: BlackboxContext)(x: c.Expr[Any]) = ??? } object Impls2 { - def foo(c: Context)(x: c.Expr[Any]) = ??? + def foo(c: BlackboxContext)(x: c.Expr[Any]) = ??? } trait MacroHelpers { object Impls4 { - def foo(c: Context)(x: c.Expr[Any]) = x + def foo(c: BlackboxContext)(x: c.Expr[Any]) = x } } object Impls5 { - def foo(c: Context)(x: c.Expr[Any]) = ??? - def foo(c: Context)(x: c.Expr[Any], y: c.Expr[Any]) = ??? + def foo(c: BlackboxContext)(x: c.Expr[Any]) = ??? + def foo(c: BlackboxContext)(x: c.Expr[Any], y: c.Expr[Any]) = ??? } object Impls6 { - def fooNullary(c: Context) = { + def fooNullary(c: BlackboxContext) = { import c.universe._ c.Expr[Unit](q"""Predef.println("it works")""") } - def fooEmpty(c: Context)() = fooNullary(c) + def fooEmpty(c: BlackboxContext)() = fooNullary(c) } object Impls7 { - def foo[U <: Int](c: Context) = ??? + def foo[U <: Int](c: BlackboxContext) = ??? } package foo { object Impls8 { - private[foo] def impl(c: Context) = ??? + private[foo] def impl(c: BlackboxContext) = ??? } }
\ No newline at end of file diff --git a/test/files/neg/macro-invalidimpl/Macros_Test_2.scala b/test/files/neg/macro-invalidimpl/Macros_Test_2.scala index 8aae9553f5..0df7d2e0c5 100644 --- a/test/files/neg/macro-invalidimpl/Macros_Test_2.scala +++ b/test/files/neg/macro-invalidimpl/Macros_Test_2.scala @@ -1,4 +1,4 @@ -import scala.reflect.macros.Context +import scala.reflect.macros.BlackboxContext object Macros1 { val impls = new Impls1 @@ -12,7 +12,7 @@ object Macros2 { class Macros3 { object Impls3 { - def foo(c: Context)(x: c.Expr[Any]) = ??? + def foo(c: BlackboxContext)(x: c.Expr[Any]) = ??? } def foo(x: Any) = macro Impls3.foo diff --git a/test/files/neg/macro-invalidret.check b/test/files/neg/macro-invalidret.check index 6cf62c292b..19adc70fb3 100644 --- a/test/files/neg/macro-invalidret.check +++ b/test/files/neg/macro-invalidret.check @@ -1,14 +1,14 @@ Macros_Test_2.scala:2: error: macro implementation has wrong shape: - required: (c: scala.reflect.macros.Context): c.Expr[Any] - or : (c: scala.reflect.macros.Context): c.Tree - found : (c: scala.reflect.macros.Context): Int + required: (c: scala.reflect.macros.BlackboxContext): c.Expr[Any] + or : (c: scala.reflect.macros.BlackboxContext): c.Tree + found : (c: scala.reflect.macros.BlackboxContext): Int type mismatch for return type: Int does not conform to c.Expr[Any] def foo1 = macro Impls.foo1 ^ Macros_Test_2.scala:3: error: macro implementation has wrong shape: - required: (c: scala.reflect.macros.Context): c.Expr[Any] - or : (c: scala.reflect.macros.Context): c.Tree - found : (c: scala.reflect.macros.Context): reflect.runtime.universe.Literal + required: (c: scala.reflect.macros.BlackboxContext): c.Expr[Any] + or : (c: scala.reflect.macros.BlackboxContext): c.Tree + found : (c: scala.reflect.macros.BlackboxContext): reflect.runtime.universe.Literal type mismatch for return type: reflect.runtime.universe.Literal does not conform to c.Expr[Any] def foo2 = macro Impls.foo2 ^ diff --git a/test/files/neg/macro-invalidret/Impls_1.scala b/test/files/neg/macro-invalidret/Impls_1.scala index a58af1a23c..d957b74512 100644 --- a/test/files/neg/macro-invalidret/Impls_1.scala +++ b/test/files/neg/macro-invalidret/Impls_1.scala @@ -1,7 +1,7 @@ -import scala.reflect.macros.Context +import scala.reflect.macros.BlackboxContext import scala.reflect.runtime.{universe => ru} object Impls { - def foo1(c: Context) = 2 - def foo2(c: Context) = ru.Literal(ru.Constant(42)) + def foo1(c: BlackboxContext) = 2 + def foo2(c: BlackboxContext) = ru.Literal(ru.Constant(42)) } diff --git a/test/files/neg/macro-invalidshape/Impls_1.scala b/test/files/neg/macro-invalidshape/Impls_1.scala index 4467021545..3d5da9a2ed 100644 --- a/test/files/neg/macro-invalidshape/Impls_1.scala +++ b/test/files/neg/macro-invalidshape/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.macros.{Context => Ctx} +import scala.reflect.macros.{BlackboxContext => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Any]) = ??? diff --git a/test/files/neg/macro-invalidshape/Macros_Test_2.scala b/test/files/neg/macro-invalidshape/Macros_Test_2.scala index 819844b9f1..8f643ab281 100644 --- a/test/files/neg/macro-invalidshape/Macros_Test_2.scala +++ b/test/files/neg/macro-invalidshape/Macros_Test_2.scala @@ -3,7 +3,7 @@ object Macros { def foo2(x: Any) = macro Impls.foo(null)(null) def foo3(x: Any) = macro {2; Impls.foo} { - def impl(c: scala.reflect.macros.Context) = { import c.universe._; c.Expr[Unit](q"()") } + def impl(c: scala.reflect.macros.BlackboxContext) = { import c.universe._; c.Expr[Unit](q"()") } def foo = macro impl foo } diff --git a/test/files/neg/macro-invalidsig-params-badtype.check b/test/files/neg/macro-invalidsig-params-badtype.check index 86aa08291f..e0cd63fbe4 100644 --- a/test/files/neg/macro-invalidsig-params-badtype.check +++ b/test/files/neg/macro-invalidsig-params-badtype.check @@ -1,7 +1,7 @@ Impls_Macros_1.scala:8: error: macro implementation has wrong shape: - required: (c: scala.reflect.macros.Context)(x: c.Expr[Int]): c.Expr[Any] - or : (c: scala.reflect.macros.Context)(x: c.Tree): c.Tree - found : (c: scala.reflect.macros.Context)(x: Int): Nothing + required: (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Int]): c.Expr[Any] + or : (c: scala.reflect.macros.BlackboxContext)(x: c.Tree): c.Tree + found : (c: scala.reflect.macros.BlackboxContext)(x: Int): Nothing type mismatch for parameter x: c.Expr[Int] does not conform to Int def foo(x: Int) = macro Impls.foo ^ diff --git a/test/files/neg/macro-invalidsig-params-badtype/Impls_Macros_1.scala b/test/files/neg/macro-invalidsig-params-badtype/Impls_Macros_1.scala index 175683d6d3..5f468424bd 100644 --- a/test/files/neg/macro-invalidsig-params-badtype/Impls_Macros_1.scala +++ b/test/files/neg/macro-invalidsig-params-badtype/Impls_Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.macros.{Context => Ctx} +import scala.reflect.macros.{BlackboxContext => Ctx} object Impls { def foo(c: Ctx)(x: Int) = ??? diff --git a/test/files/neg/macro-invalidsig.check b/test/files/neg/macro-invalidsig.check index 732380d4b3..42b8db5628 100644 --- a/test/files/neg/macro-invalidsig.check +++ b/test/files/neg/macro-invalidsig.check @@ -1,77 +1,77 @@ Macros_Test_2.scala:2: error: macro implementation has wrong shape: - required: (c: scala.reflect.macros.Context): c.Expr[Any] - or : (c: scala.reflect.macros.Context): c.Tree - found : (c: scala.reflect.macros.Context)(implicit evidence$2: Numeric[U]): c.universe.Literal + required: (c: scala.reflect.macros.BlackboxContext): c.Expr[Any] + or : (c: scala.reflect.macros.BlackboxContext): c.Tree + found : (c: scala.reflect.macros.BlackboxContext)(implicit evidence$2: Numeric[U]): c.universe.Literal macro implementations cannot have implicit parameters other than WeakTypeTag evidences def foo[U] = macro Impls1.foo[U] ^ Macros_Test_2.scala:6: error: macro implementation has wrong shape: - required: (c: scala.reflect.macros.Context): c.Expr[Any] - or : (c: scala.reflect.macros.Context): c.Tree + required: (c: scala.reflect.macros.BlackboxContext): c.Expr[Any] + or : (c: scala.reflect.macros.BlackboxContext): c.Tree found : : Nothing number of parameter sections differ def foo = macro Impls2.foo ^ Macros_Test_2.scala:10: error: macro implementation has wrong shape: - required: (c: scala.reflect.macros.Context): c.Expr[Any] - or : (c: scala.reflect.macros.Context): c.Tree + required: (c: scala.reflect.macros.BlackboxContext): c.Expr[Any] + or : (c: scala.reflect.macros.BlackboxContext): c.Tree found : (c: scala.reflect.api.Universe): Nothing -type mismatch for parameter c: scala.reflect.macros.Context does not conform to scala.reflect.api.Universe +type mismatch for parameter c: scala.reflect.macros.BlackboxContext does not conform to scala.reflect.api.Universe def foo = macro Impls3.foo ^ Macros_Test_2.scala:14: error: macro implementation has wrong shape: - required: (c: scala.reflect.macros.Context): c.Expr[Any] - or : (c: scala.reflect.macros.Context): c.Tree - found : (cs: scala.reflect.macros.Context*): Nothing + required: (c: scala.reflect.macros.BlackboxContext): c.Expr[Any] + or : (c: scala.reflect.macros.BlackboxContext): c.Tree + found : (cs: scala.reflect.macros.BlackboxContext*): Nothing types incompatible for parameter cs: corresponding is not a vararg parameter def foo = macro Impls4.foo ^ Macros_Test_2.scala:18: error: macro implementation has wrong shape: - required: (c: scala.reflect.macros.Context)(x: c.Expr[Any]): c.Expr[Any] - or : (c: scala.reflect.macros.Context)(x: c.Tree): c.Tree - found : (c: scala.reflect.macros.Context): Nothing + required: (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Any]): c.Expr[Any] + or : (c: scala.reflect.macros.BlackboxContext)(x: c.Tree): c.Tree + found : (c: scala.reflect.macros.BlackboxContext): Nothing number of parameter sections differ def foo(x: Any) = macro Impls5.foo ^ Macros_Test_2.scala:22: error: macro implementation has wrong shape: - required: (c: scala.reflect.macros.Context)(x: c.Expr[Int]): c.Expr[Unit] - or : (c: scala.reflect.macros.Context)(x: c.Tree): c.Tree - found : (c: scala.reflect.macros.Context)(implicit x: c.Expr[Int]): c.Expr[Unit] + required: (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Int]): c.Expr[Unit] + or : (c: scala.reflect.macros.BlackboxContext)(x: c.Tree): c.Tree + found : (c: scala.reflect.macros.BlackboxContext)(implicit x: c.Expr[Int]): c.Expr[Unit] macro implementations cannot have implicit parameters other than WeakTypeTag evidences def foo[U](x: Int) = macro Impls6.foo[T, U] ^ Macros_Test_2.scala:26: error: macro implementation has wrong shape: - required: (c: scala.reflect.macros.Context)(x: c.Expr[Int]): c.Expr[Any] - or : (c: scala.reflect.macros.Context)(x: c.Tree): c.Tree - found : (c: scala.reflect.macros.Context)(x: c.Expr[Int], y: c.Expr[Int]): Nothing + required: (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Int]): c.Expr[Any] + or : (c: scala.reflect.macros.BlackboxContext)(x: c.Tree): c.Tree + found : (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Int], y: c.Expr[Int]): Nothing parameter lists have different length, found extra parameter y: c.Expr[Int] def foo(x: Int) = macro Impls7.foo ^ Macros_Test_2.scala:30: error: macro implementation has wrong shape: - required: (c: scala.reflect.macros.Context)(x: c.Expr[Int]): c.Expr[Any] - or : (c: scala.reflect.macros.Context)(x: c.Tree): c.Tree - found : (c: scala.reflect.macros.Context)(x: c.universe.Symbol): Nothing + required: (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Int]): c.Expr[Any] + or : (c: scala.reflect.macros.BlackboxContext)(x: c.Tree): c.Tree + found : (c: scala.reflect.macros.BlackboxContext)(x: c.universe.Symbol): Nothing type mismatch for parameter x: c.Expr[Int] does not conform to c.universe.Symbol def foo(x: Int) = macro Impls8.foo ^ Macros_Test_2.scala:34: error: macro implementation has wrong shape: - required: (c: scala.reflect.macros.Context)(x: c.Expr[Int], y: c.Expr[Int]): c.Expr[Any] - or : (c: scala.reflect.macros.Context)(x: c.Tree, y: c.Tree): c.Tree - found : (c: scala.reflect.macros.Context)(xs: c.Expr[Int]*): Nothing + required: (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Int], y: c.Expr[Int]): c.Expr[Any] + or : (c: scala.reflect.macros.BlackboxContext)(x: c.Tree, y: c.Tree): c.Tree + found : (c: scala.reflect.macros.BlackboxContext)(xs: c.Expr[Int]*): Nothing parameter lists have different length, required extra parameter y: c.Expr[Int] def foo(x: Int, y: Int) = macro Impls9.foo ^ Macros_Test_2.scala:38: error: macro implementation has wrong shape: - required: (c: scala.reflect.macros.Context)(x: c.Expr[Int], y: c.Expr[Int]): c.Expr[Any] - or : (c: scala.reflect.macros.Context)(x: c.Tree, y: c.Tree): c.Tree - found : (c: scala.reflect.macros.Context)(y: c.Expr[Int], x: c.Expr[Int]): Nothing + required: (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Int], y: c.Expr[Int]): c.Expr[Any] + or : (c: scala.reflect.macros.BlackboxContext)(x: c.Tree, y: c.Tree): c.Tree + found : (c: scala.reflect.macros.BlackboxContext)(y: c.Expr[Int], x: c.Expr[Int]): Nothing parameter names differ: x != y def foo(x: Int, y: Int) = macro Impls10.foo ^ Macros_Test_2.scala:42: error: macro implementation has wrong shape: - required: (c: scala.reflect.macros.Context): c.Expr[Any] - or : (c: scala.reflect.macros.Context): c.Tree - found : (c: scala.reflect.macros.Context)(U: c.universe.Type): Nothing + required: (c: scala.reflect.macros.BlackboxContext): c.Expr[Any] + or : (c: scala.reflect.macros.BlackboxContext): c.Tree + found : (c: scala.reflect.macros.BlackboxContext)(U: c.universe.Type): Nothing number of parameter sections differ def foo[U] = macro Impls11.foo[U] ^ @@ -81,13 +81,13 @@ Macros_Test_2.scala:46: error: type arguments [U] do not conform to method foo's Macros_Test_2.scala:50: error: type arguments [U] do not conform to method foo's type parameter bounds [U <: String] def foo[U <: Int] = macro Impls13.foo[U] ^ -Macros_Test_2.scala:54: error: wrong number of type parameters for method foo: [U](c: scala.reflect.macros.Context)(implicit evidence$4: c.WeakTypeTag[U])Nothing +Macros_Test_2.scala:54: error: wrong number of type parameters for method foo: [U](c: scala.reflect.macros.BlackboxContext)(implicit evidence$4: c.WeakTypeTag[U])Nothing def foo = macro Impls14.foo ^ -Macros_Test_2.scala:59: error: wrong number of type parameters for method foo: [T, U, V](c: scala.reflect.macros.Context)(implicit evidence$5: c.WeakTypeTag[T], implicit evidence$6: c.WeakTypeTag[U], implicit V: c.WeakTypeTag[V])c.Expr[Unit] +Macros_Test_2.scala:59: error: wrong number of type parameters for method foo: [T, U, V](c: scala.reflect.macros.BlackboxContext)(implicit evidence$5: c.WeakTypeTag[T], implicit evidence$6: c.WeakTypeTag[U], implicit V: c.WeakTypeTag[V])c.Expr[Unit] def foo15[V] = macro Impls15.foo ^ -Macros_Test_2.scala:60: error: wrong number of type parameters for method foo: [T, U, V](c: scala.reflect.macros.Context)(implicit evidence$7: c.WeakTypeTag[T], implicit evidence$8: c.WeakTypeTag[U], implicit V: c.WeakTypeTag[V])c.Expr[Unit] +Macros_Test_2.scala:60: error: wrong number of type parameters for method foo: [T, U, V](c: scala.reflect.macros.BlackboxContext)(implicit evidence$7: c.WeakTypeTag[T], implicit evidence$8: c.WeakTypeTag[U], implicit V: c.WeakTypeTag[V])c.Expr[Unit] def foo16[V] = macro Impls16.foo[V] ^ 16 errors found diff --git a/test/files/neg/macro-invalidsig/Impls_1.scala b/test/files/neg/macro-invalidsig/Impls_1.scala index d16ed26386..7c98160925 100644 --- a/test/files/neg/macro-invalidsig/Impls_1.scala +++ b/test/files/neg/macro-invalidsig/Impls_1.scala @@ -1,8 +1,8 @@ import scala.reflect.runtime.universe._ -import scala.reflect.macros.Context +import scala.reflect.macros.BlackboxContext object Impls1 { - def foo[U: c.WeakTypeTag: Numeric](c: Context) = { import c.universe._; q"42" } + def foo[U: c.WeakTypeTag: Numeric](c: BlackboxContext) = { import c.universe._; q"42" } } object Impls2 { @@ -14,15 +14,15 @@ object Impls3 { } object Impls4 { - def foo(cs: Context*) = ??? + def foo(cs: BlackboxContext*) = ??? } object Impls5 { - def foo(c: Context) = ??? + def foo(c: BlackboxContext) = ??? } object Impls6 { - def foo[T, U: c.WeakTypeTag](c: Context)(implicit x: c.Expr[Int]) = { + def foo[T, U: c.WeakTypeTag](c: BlackboxContext)(implicit x: c.Expr[Int]) = { import c.{prefix => prefix} import c.universe._ c.Expr[Unit](q""" @@ -34,39 +34,39 @@ object Impls6 { } object Impls7 { - def foo(c: Context)(x: c.Expr[Int], y: c.Expr[Int]) = ??? + def foo(c: BlackboxContext)(x: c.Expr[Int], y: c.Expr[Int]) = ??? } object Impls8 { - def foo(c: Context)(x: c.universe.Symbol) = ??? + def foo(c: BlackboxContext)(x: c.universe.Symbol) = ??? } object Impls9 { - def foo(c: Context)(xs: c.Expr[Int]*) = ??? + def foo(c: BlackboxContext)(xs: c.Expr[Int]*) = ??? } object Impls10 { - def foo(c: Context)(y: c.Expr[Int], x: c.Expr[Int]) = ??? + def foo(c: BlackboxContext)(y: c.Expr[Int], x: c.Expr[Int]) = ??? } object Impls11 { - def foo[U](c: Context)(U: c.universe.Type) = ??? + def foo[U](c: BlackboxContext)(U: c.universe.Type) = ??? } object Impls12 { - def foo[U <: String](c: Context) = ??? + def foo[U <: String](c: BlackboxContext) = ??? } object Impls13 { - def foo[U <: String](c: Context) = ??? + def foo[U <: String](c: BlackboxContext) = ??? } object Impls14 { - def foo[U: c.WeakTypeTag](c: Context) = ??? + def foo[U: c.WeakTypeTag](c: BlackboxContext) = ??? } object Impls15 { - def foo[T: c.WeakTypeTag, U: c.WeakTypeTag, V](c: Context)(implicit V: c.WeakTypeTag[V]): c.Expr[Unit] = { + def foo[T: c.WeakTypeTag, U: c.WeakTypeTag, V](c: BlackboxContext)(implicit V: c.WeakTypeTag[V]): c.Expr[Unit] = { import c.universe._ println(implicitly[c.WeakTypeTag[T]]) println(implicitly[c.WeakTypeTag[U]]) @@ -76,7 +76,7 @@ object Impls15 { } object Impls16 { - def foo[T: c.WeakTypeTag, U: c.WeakTypeTag, V](c: Context)(implicit V: c.WeakTypeTag[V]): c.Expr[Unit] = { + def foo[T: c.WeakTypeTag, U: c.WeakTypeTag, V](c: BlackboxContext)(implicit V: c.WeakTypeTag[V]): c.Expr[Unit] = { import c.universe._ println(implicitly[c.WeakTypeTag[T]]) println(implicitly[c.WeakTypeTag[U]]) diff --git a/test/files/neg/macro-invalidusage-badargs/Impls_1.scala b/test/files/neg/macro-invalidusage-badargs/Impls_1.scala index 52c9f9c3e9..678cb53929 100644 --- a/test/files/neg/macro-invalidusage-badargs/Impls_1.scala +++ b/test/files/neg/macro-invalidusage-badargs/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.macros.{Context => Ctx} +import scala.reflect.macros.{BlackboxContext => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Int]) = x diff --git a/test/files/neg/macro-invalidusage-badbounds/Impls_1.scala b/test/files/neg/macro-invalidusage-badbounds/Impls_1.scala index 74c163596a..393f7de976 100644 --- a/test/files/neg/macro-invalidusage-badbounds/Impls_1.scala +++ b/test/files/neg/macro-invalidusage-badbounds/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.macros.{Context => Ctx} +import scala.reflect.macros.{BlackboxContext => Ctx} object Impls { def foo[U <: String](c: Ctx) = { import c.universe._; c.Expr[Unit](q"()") } diff --git a/test/files/neg/macro-invalidusage-badtargs/Impls_1.scala b/test/files/neg/macro-invalidusage-badtargs/Impls_1.scala index 52c9f9c3e9..678cb53929 100644 --- a/test/files/neg/macro-invalidusage-badtargs/Impls_1.scala +++ b/test/files/neg/macro-invalidusage-badtargs/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.macros.{Context => Ctx} +import scala.reflect.macros.{BlackboxContext => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Int]) = x diff --git a/test/files/neg/macro-invalidusage-methodvaluesyntax/Impls_1.scala b/test/files/neg/macro-invalidusage-methodvaluesyntax/Impls_1.scala index 11b6a8c3b0..15894efb68 100644 --- a/test/files/neg/macro-invalidusage-methodvaluesyntax/Impls_1.scala +++ b/test/files/neg/macro-invalidusage-methodvaluesyntax/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.macros.{Context => Ctx} +import scala.reflect.macros.{BlackboxContext => Ctx} object Impls { def foo(c: Ctx) = { diff --git a/test/files/neg/macro-invalidusage-nontypeable/Impls_Macros_1.scala b/test/files/neg/macro-invalidusage-nontypeable/Impls_Macros_1.scala index 869a5a41fa..44e508a1c6 100644 --- a/test/files/neg/macro-invalidusage-nontypeable/Impls_Macros_1.scala +++ b/test/files/neg/macro-invalidusage-nontypeable/Impls_Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.macros.{Context => Ctx} +import scala.reflect.macros.{BlackboxContext => Ctx} object Impls { def foo(c: Ctx) = { diff --git a/test/files/neg/macro-invalidusage-presuper/Impls_1.scala b/test/files/neg/macro-invalidusage-presuper/Impls_1.scala index c4b57233c9..02c87b5a81 100644 --- a/test/files/neg/macro-invalidusage-presuper/Impls_1.scala +++ b/test/files/neg/macro-invalidusage-presuper/Impls_1.scala @@ -1,5 +1,5 @@ -import scala.reflect.macros.Context +import scala.reflect.macros.BlackboxContext object Impls { - def impl(c: Context) = { import c.universe._; c.Expr[Unit](q"()") } + def impl(c: BlackboxContext) = { import c.universe._; c.Expr[Unit](q"()") } }
\ No newline at end of file diff --git a/test/files/neg/macro-noexpand/Impls_1.scala b/test/files/neg/macro-noexpand/Impls_1.scala index 4467021545..3d5da9a2ed 100644 --- a/test/files/neg/macro-noexpand/Impls_1.scala +++ b/test/files/neg/macro-noexpand/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.macros.{Context => Ctx} +import scala.reflect.macros.{BlackboxContext => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Any]) = ??? diff --git a/test/files/neg/macro-nontypeablebody/Impls_1.scala b/test/files/neg/macro-nontypeablebody/Impls_1.scala index 4467021545..3d5da9a2ed 100644 --- a/test/files/neg/macro-nontypeablebody/Impls_1.scala +++ b/test/files/neg/macro-nontypeablebody/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.macros.{Context => Ctx} +import scala.reflect.macros.{BlackboxContext => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Any]) = ??? diff --git a/test/files/neg/macro-override-macro-overrides-abstract-method-a/Impls_Macros_1.scala b/test/files/neg/macro-override-macro-overrides-abstract-method-a/Impls_Macros_1.scala index e43264f52f..0e8a5f3b01 100644 --- a/test/files/neg/macro-override-macro-overrides-abstract-method-a/Impls_Macros_1.scala +++ b/test/files/neg/macro-override-macro-overrides-abstract-method-a/Impls_Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.macros.{Context => Ctx} +import scala.reflect.macros.{BlackboxContext => Ctx} object Impls { def impl(c: Ctx)(x: c.Expr[Int]) = x diff --git a/test/files/neg/macro-override-macro-overrides-abstract-method-b/Impls_Macros_1.scala b/test/files/neg/macro-override-macro-overrides-abstract-method-b/Impls_Macros_1.scala index f5b2555aa5..c98279b2b8 100644 --- a/test/files/neg/macro-override-macro-overrides-abstract-method-b/Impls_Macros_1.scala +++ b/test/files/neg/macro-override-macro-overrides-abstract-method-b/Impls_Macros_1.scala @@ -1,8 +1,8 @@ -import scala.reflect.macros.Context +import scala.reflect.macros.BlackboxContext import language.experimental.macros trait T { def t(): Unit } trait A { def t(): Unit = () } -object Macro { def t(c: Context)(): c.Expr[Unit] = c.universe.reify(()) } +object Macro { def t(c: BlackboxContext)(): c.Expr[Unit] = c.universe.reify(()) } trait C extends T { self: A => override def t(): Unit = macro Macro.t } diff --git a/test/files/neg/macro-override-method-overrides-macro/Impls_1.scala b/test/files/neg/macro-override-method-overrides-macro/Impls_1.scala index 64a9299ee6..f2d3f67ccc 100644 --- a/test/files/neg/macro-override-method-overrides-macro/Impls_1.scala +++ b/test/files/neg/macro-override-method-overrides-macro/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.macros.{Context => Ctx} +import scala.reflect.macros.{BlackboxContext => Ctx} object Impls { def impl(c: Ctx)(tag: String, x: c.Expr[_]) = { diff --git a/test/files/neg/macro-quasiquotes/Macros_1.scala b/test/files/neg/macro-quasiquotes/Macros_1.scala index 17c1034720..7f0219e6ac 100644 --- a/test/files/neg/macro-quasiquotes/Macros_1.scala +++ b/test/files/neg/macro-quasiquotes/Macros_1.scala @@ -1,7 +1,7 @@ import language.experimental.macros -import scala.reflect.macros.Macro +import scala.reflect.macros.BlackboxMacro -trait Impls extends Macro { +trait Impls extends BlackboxMacro { import c.universe._ def impl1(x: Expr[Int]) = q"println(x)" def impl2(x: Tree) = q"println(x)" diff --git a/test/files/neg/macro-without-xmacros-a/Impls_1.scala b/test/files/neg/macro-without-xmacros-a/Impls_1.scala index 868616aace..6b73a96184 100644 --- a/test/files/neg/macro-without-xmacros-a/Impls_1.scala +++ b/test/files/neg/macro-without-xmacros-a/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.macros.{Context => Ctx} +import scala.reflect.macros.{BlackboxContext => Ctx} object Impls { def foo_impl(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { diff --git a/test/files/neg/macro-without-xmacros-b/Impls_1.scala b/test/files/neg/macro-without-xmacros-b/Impls_1.scala index 868616aace..6b73a96184 100644 --- a/test/files/neg/macro-without-xmacros-b/Impls_1.scala +++ b/test/files/neg/macro-without-xmacros-b/Impls_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.macros.{Context => Ctx} +import scala.reflect.macros.{BlackboxContext => Ctx} object Impls { def foo_impl(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { diff --git a/test/files/neg/t5689.check b/test/files/neg/t5689.check index 8cf0534e77..e74de40280 100644 --- a/test/files/neg/t5689.check +++ b/test/files/neg/t5689.check @@ -1,7 +1,7 @@ t5689.scala:4: error: macro implementation has wrong shape: - required: (c: scala.reflect.macros.Context)(i: c.Expr[Double]): c.Expr[String] - or : (c: scala.reflect.macros.Context)(i: c.Tree): c.Tree - found : (c: scala.reflect.macros.Context)(i: c.Expr[Double]): c.Expr[Int] + required: (c: scala.reflect.macros.BlackboxContext)(i: c.Expr[Double]): c.Expr[String] + or : (c: scala.reflect.macros.BlackboxContext)(i: c.Tree): c.Tree + found : (c: scala.reflect.macros.BlackboxContext)(i: c.Expr[Double]): c.Expr[Int] type mismatch for return type: c.Expr[Int] does not conform to c.Expr[String] def returnsString(i: Double): String = macro returnsIntImpl ^ diff --git a/test/files/neg/t5689.scala b/test/files/neg/t5689.scala index 3266039c35..d0e468849d 100644 --- a/test/files/neg/t5689.scala +++ b/test/files/neg/t5689.scala @@ -1,6 +1,6 @@ -import scala.reflect.macros.Context +import scala.reflect.macros.BlackboxContext object Macros { def returnsString(i: Double): String = macro returnsIntImpl - def returnsIntImpl(c: Context)(i: c.Expr[Double]): c.Expr[Int] = ??? + def returnsIntImpl(c: BlackboxContext)(i: c.Expr[Double]): c.Expr[Int] = ??? } diff --git a/test/files/neg/t5753/Impls_Macros_1.scala b/test/files/neg/t5753/Impls_Macros_1.scala index 1d9c26458c..f93d731d40 100644 --- a/test/files/neg/t5753/Impls_Macros_1.scala +++ b/test/files/neg/t5753/Impls_Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.macros.{Context => Ctx} +import scala.reflect.macros.{BlackboxContext => Ctx} trait Impls { def impl(c: Ctx)(x: c.Expr[Any]) = x diff --git a/test/files/neg/t5753/Test_2.scala b/test/files/neg/t5753/Test_2.scala index 2369b18e76..f1cad67fed 100644 --- a/test/files/neg/t5753/Test_2.scala +++ b/test/files/neg/t5753/Test_2.scala @@ -1,4 +1,4 @@ -import scala.reflect.macros.{Context => Ctx} +import scala.reflect.macros.{BlackboxContext => Ctx} object Macros extends Impls { def foo(x: Any) = macro impl diff --git a/test/files/neg/t5903a/Macros_1.scala b/test/files/neg/t5903a/Macros_1.scala index e82be0fc68..9fc3bfe261 100644 --- a/test/files/neg/t5903a/Macros_1.scala +++ b/test/files/neg/t5903a/Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.macros.Context +import scala.reflect.macros.BlackboxContext import language.experimental.macros trait Tree @@ -13,7 +13,7 @@ object NewQuasiquotes { } object QuasiquoteMacros { - def unapplyImpl(c: Context)(t: c.Tree) = { + def unapplyImpl(c: BlackboxContext)(t: c.Tree) = { import c.universe._ q""" new { diff --git a/test/files/neg/t5903b/Macros_1.scala b/test/files/neg/t5903b/Macros_1.scala index b1b875969d..46f0eee0f1 100644 --- a/test/files/neg/t5903b/Macros_1.scala +++ b/test/files/neg/t5903b/Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.macros.Context +import scala.reflect.macros.BlackboxContext import language.experimental.macros object Interpolation { @@ -10,7 +10,7 @@ object Interpolation { } object Macros { - def unapplyImpl[T: c.WeakTypeTag](c: Context)(x: c.Tree) = { + def unapplyImpl[T: c.WeakTypeTag](c: BlackboxContext)(x: c.Tree) = { import c.universe._ q""" new { diff --git a/test/files/neg/t5903c/Macros_1.scala b/test/files/neg/t5903c/Macros_1.scala index 70efab3101..281a06e93c 100644 --- a/test/files/neg/t5903c/Macros_1.scala +++ b/test/files/neg/t5903c/Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.macros.Context +import scala.reflect.macros.BlackboxContext import language.experimental.macros object Interpolation { @@ -10,7 +10,7 @@ object Interpolation { } object Macros { - def unapplyImpl[T: c.WeakTypeTag](c: Context)(x: c.Tree) = { + def unapplyImpl[T: c.WeakTypeTag](c: BlackboxContext)(x: c.Tree) = { import c.universe._ if (!(c.weakTypeOf[Int] =:= c.weakTypeOf[T])) c.abort(c.enclosingPosition, s"${c.weakTypeOf[T]} is not supported") else { diff --git a/test/files/neg/t5903d/Macros_1.scala b/test/files/neg/t5903d/Macros_1.scala index 15ff226cff..5dd6220e1a 100644 --- a/test/files/neg/t5903d/Macros_1.scala +++ b/test/files/neg/t5903d/Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.macros.Context +import scala.reflect.macros.BlackboxContext import language.experimental.macros object Interpolation { @@ -10,7 +10,7 @@ object Interpolation { } object Macros { - def unapplyImpl(c: Context)(x: c.Tree) = { + def unapplyImpl(c: BlackboxContext)(x: c.Tree) = { import c.universe._ q""" class Match(x: Int) { diff --git a/test/files/neg/t5903e/Macros_1.scala b/test/files/neg/t5903e/Macros_1.scala index 4e1ce89c9f..13e168d529 100644 --- a/test/files/neg/t5903e/Macros_1.scala +++ b/test/files/neg/t5903e/Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.macros.Context +import scala.reflect.macros.BlackboxContext import language.experimental.macros object Interpolation { @@ -10,7 +10,7 @@ object Interpolation { } object Macros { - def unapplyImpl(c: Context)(x: c.Tree) = { + def unapplyImpl(c: BlackboxContext)(x: c.Tree) = { import c.universe._ q""" new { diff --git a/test/files/neg/t6123-explaintypes-macros.check b/test/files/neg/t6123-explaintypes-macros.check index 43f8371326..9a0402039b 100644 --- a/test/files/neg/t6123-explaintypes-macros.check +++ b/test/files/neg/t6123-explaintypes-macros.check @@ -1,9 +1,9 @@ c.universe.Expr[Any]* <: c.universe.Expr[String]*? false BadMac_2.scala:6: error: macro implementation has wrong shape: - required: (c: scala.reflect.macros.Context)(format: c.Expr[String], params: c.Expr[Any]*): c.Expr[Unit] - or : (c: scala.reflect.macros.Context)(format: c.Tree, params: Tree*): c.Tree - found : (c: scala.reflect.macros.Context)(format: c.Expr[String], params: c.Expr[String]*): c.Expr[Unit] + required: (c: scala.reflect.macros.BlackboxContext)(format: c.Expr[String], params: c.Expr[Any]*): c.Expr[Unit] + or : (c: scala.reflect.macros.BlackboxContext)(format: c.Tree, params: Tree*): c.Tree + found : (c: scala.reflect.macros.BlackboxContext)(format: c.Expr[String], params: c.Expr[String]*): c.Expr[Unit] type mismatch for parameter params: c.Expr[Any]* does not conform to c.Expr[String]* def printf(format: String, params: Any*): Unit = macro printf_impl ^ diff --git a/test/files/neg/t6123-explaintypes-macros/BadMac_2.scala b/test/files/neg/t6123-explaintypes-macros/BadMac_2.scala index 38b8e24444..456e753893 100644 --- a/test/files/neg/t6123-explaintypes-macros/BadMac_2.scala +++ b/test/files/neg/t6123-explaintypes-macros/BadMac_2.scala @@ -1,8 +1,8 @@ import scala.language.experimental.macros -import scala.reflect.macros.Context +import scala.reflect.macros.BlackboxContext // explain some macro types to me object BadMac { def printf(format: String, params: Any*): Unit = macro printf_impl - def printf_impl(c: Context)(format: c.Expr[String], params: c.Expr[String]*): c.Expr[Unit] = ??? + def printf_impl(c: BlackboxContext)(format: c.Expr[String], params: c.Expr[String]*): c.Expr[Unit] = ??? } diff --git a/test/files/neg/t6123-explaintypes-macros/Macros.scala b/test/files/neg/t6123-explaintypes-macros/Macros.scala index a12c277c86..cdcea34272 100644 --- a/test/files/neg/t6123-explaintypes-macros/Macros.scala +++ b/test/files/neg/t6123-explaintypes-macros/Macros.scala @@ -1,9 +1,9 @@ import scala.language.experimental.macros -import scala.reflect.macros.Context +import scala.reflect.macros.BlackboxContext object Macros { def printf(format: String, params: Any*): Unit = macro printf_impl - def printf_impl(c: Context)(format: c.Expr[String], params: c.Expr[Any]*): c.Expr[Unit] = ??? + def printf_impl(c: BlackboxContext)(format: c.Expr[String], params: c.Expr[Any]*): c.Expr[Unit] = ??? } // something trivial to run diff --git a/test/files/neg/t6539/Macro_1.scala b/test/files/neg/t6539/Macro_1.scala index 4f7d289e2e..454489752c 100644 --- a/test/files/neg/t6539/Macro_1.scala +++ b/test/files/neg/t6539/Macro_1.scala @@ -1,9 +1,9 @@ import language.experimental.macros -import reflect.macros.Context +import reflect.macros.BlackboxContext object M { def m(a: Any, b: Any): Any = macro mImpl - def mImpl(c: Context)(a: c.Expr[Any], b: c.Expr[Any]) = a + def mImpl(c: BlackboxContext)(a: c.Expr[Any], b: c.Expr[Any]) = c.universe.reify(println(a.splice)) @reflect.internal.annotations.compileTimeOnly("cto may only be used as an argument to " + "m") def cto = 0 diff --git a/test/files/neg/t7157/Impls_Macros_1.scala b/test/files/neg/t7157/Impls_Macros_1.scala index 9069d26e6e..16cb001422 100644 --- a/test/files/neg/t7157/Impls_Macros_1.scala +++ b/test/files/neg/t7157/Impls_Macros_1.scala @@ -1,31 +1,31 @@ -import scala.reflect.macros.Context +import scala.reflect.macros.BlackboxContext import language.experimental.macros object Macros { - def impl1_0_0(c: Context)() = { import c.universe._; c.Expr[Unit](q"()") } - def impl1_1_1(c: Context)(x: c.Expr[Int]) = { import c.universe._; c.Expr[Unit](q"()") } - def impl1_2_2(c: Context)(x: c.Expr[Int], y: c.Expr[Int]) = { import c.universe._; c.Expr[Unit](q"()") } + def impl1_0_0(c: BlackboxContext)() = { import c.universe._; c.Expr[Unit](q"""println("hello world")""") } + def impl1_1_1(c: BlackboxContext)(x: c.Expr[Int]) = { import c.universe._; c.Expr[Unit](q"""println("hello world")""") } + def impl1_2_2(c: BlackboxContext)(x: c.Expr[Int], y: c.Expr[Int]) = { import c.universe._; c.Expr[Unit](q"""println("hello world")""") } def m1_0_0() = macro impl1_0_0 def m1_1_1(x: Int) = macro impl1_1_1 def m1_2_2(x: Int, y: Int) = macro impl1_2_2 - def impl1_0_inf(c: Context)(x: c.Expr[Int]*) = { import c.universe._; c.Expr[Unit](q"()") } - def impl1_1_inf(c: Context)(x: c.Expr[Int], y: c.Expr[Int]*) = { import c.universe._; c.Expr[Unit](q"()") } - def impl1_2_inf(c: Context)(x: c.Expr[Int], y: c.Expr[Int], z: c.Expr[Int]*) = { import c.universe._; c.Expr[Unit](q"()") } + def impl1_0_inf(c: BlackboxContext)(x: c.Expr[Int]*) = { import c.universe._; c.Expr[Unit](q"""println("hello world")""") } + def impl1_1_inf(c: BlackboxContext)(x: c.Expr[Int], y: c.Expr[Int]*) = { import c.universe._; c.Expr[Unit](q"""println("hello world")""") } + def impl1_2_inf(c: BlackboxContext)(x: c.Expr[Int], y: c.Expr[Int], z: c.Expr[Int]*) = { import c.universe._; c.Expr[Unit](q"""println("hello world")""") } def m1_0_inf(x: Int*) = macro impl1_0_inf def m1_1_inf(x: Int, y: Int*) = macro impl1_1_inf def m1_2_inf(x: Int, y: Int, z: Int*) = macro impl1_2_inf - def impl2_0_0(c: Context)()() = { import c.universe._; c.Expr[Unit](q"()") } - def impl2_1_1(c: Context)()(x: c.Expr[Int]) = { import c.universe._; c.Expr[Unit](q"()") } - def impl2_2_2(c: Context)()(x: c.Expr[Int], y: c.Expr[Int]) = { import c.universe._; c.Expr[Unit](q"()") } + def impl2_0_0(c: BlackboxContext)()() = { import c.universe._; c.Expr[Unit](q"""println("hello world")""") } + def impl2_1_1(c: BlackboxContext)()(x: c.Expr[Int]) = { import c.universe._; c.Expr[Unit](q"""println("hello world")""") } + def impl2_2_2(c: BlackboxContext)()(x: c.Expr[Int], y: c.Expr[Int]) = { import c.universe._; c.Expr[Unit](q"""println("hello world")""") } def m2_0_0()() = macro impl2_0_0 def m2_1_1()(x: Int) = macro impl2_1_1 def m2_2_2()(x: Int, y: Int) = macro impl2_2_2 - def impl2_0_inf(c: Context)()(x: c.Expr[Int]*) = { import c.universe._; c.Expr[Unit](q"()") } - def impl2_1_inf(c: Context)()(x: c.Expr[Int], y: c.Expr[Int]*) = { import c.universe._; c.Expr[Unit](q"()") } - def impl2_2_inf(c: Context)()(x: c.Expr[Int], y: c.Expr[Int], z: c.Expr[Int]*) = { import c.universe._; c.Expr[Unit](q"()") } + def impl2_0_inf(c: BlackboxContext)()(x: c.Expr[Int]*) = { import c.universe._; c.Expr[Unit](q"""println("hello world")""") } + def impl2_1_inf(c: BlackboxContext)()(x: c.Expr[Int], y: c.Expr[Int]*) = { import c.universe._; c.Expr[Unit](q"""println("hello world")""") } + def impl2_2_inf(c: BlackboxContext)()(x: c.Expr[Int], y: c.Expr[Int], z: c.Expr[Int]*) = { import c.universe._; c.Expr[Unit](q"""println("hello world")""") } def m2_0_inf()(x: Int*) = macro impl2_0_inf def m2_1_inf()(x: Int, y: Int*) = macro impl2_1_inf def m2_2_inf()(x: Int, y: Int, z: Int*) = macro impl2_2_inf |