summaryrefslogtreecommitdiff
path: root/test/files/run
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/run')
-rw-r--r--test/files/run/bigDecimalTest.check2
-rw-r--r--test/files/run/is-valid-num.scala28
-rw-r--r--test/files/run/large_code.check3
-rw-r--r--test/files/run/large_code.scala24
-rw-r--r--test/files/run/macro-abort-fresh/Macros_1.scala4
-rw-r--r--test/files/run/macro-auto-duplicate/Macros_1.scala4
-rw-r--r--test/files/run/macro-basic-ma-md-mi/Impls_1.scala8
-rw-r--r--test/files/run/macro-basic-ma-mdmi/Impls_Macros_1.scala8
-rw-r--r--test/files/run/macro-basic-mamd-mi/Impls_1.scala8
-rw-r--r--test/files/run/macro-blackbox-materialization/Macros_1.scala4
-rw-r--r--test/files/run/macro-bodyexpandstoimpl/Impls_1.scala3
-rw-r--r--test/files/run/macro-bundle-repl.check12
-rw-r--r--test/files/run/macro-bundle-repl.scala6
-rw-r--r--test/files/run/macro-bundle-static/Impls_Macros_1.scala6
-rw-r--r--test/files/run/macro-bundle-static/Test_2.scala4
-rw-r--r--test/files/run/macro-bundle-toplevel/Impls_Macros_1.scala6
-rw-r--r--test/files/run/macro-bundle-toplevel/Test_2.scala4
-rw-r--r--test/files/run/macro-bundle-whitebox.check6
-rw-r--r--test/files/run/macro-bundle-whitebox/Impls_Macros_1.scala26
-rw-r--r--test/files/run/macro-bundle-whitebox/Test_2.scala8
-rw-r--r--test/files/run/macro-def-path-dependent/Test_1.scala4
-rw-r--r--test/files/run/macro-def-path-dependent/Test_2.scala4
-rw-r--r--test/files/run/macro-def-path-dependent/Test_3.scala4
-rw-r--r--test/files/run/macro-def-path-dependent/Test_4.scala4
-rw-r--r--test/files/run/macro-def-path-dependent/Test_5.scala4
-rw-r--r--test/files/run/macro-def-path-dependent/Test_6.scala2
-rw-r--r--test/files/run/macro-default-params/Macros_1.scala4
-rw-r--r--test/files/run/macro-divergence-spurious/Impls_Macros_1.scala4
-rw-r--r--test/files/run/macro-duplicate/Impls_Macros_1.scala4
-rw-r--r--test/files/run/macro-enclosures/Impls_Macros_1.scala4
-rw-r--r--test/files/run/macro-expand-implicit-argument/Macros_1.scala4
-rw-r--r--test/files/run/macro-expand-implicit-macro-has-implicit/Impls_1.scala4
-rw-r--r--test/files/run/macro-expand-implicit-macro-is-implicit/Impls_1.scala4
-rw-r--r--test/files/run/macro-expand-implicit-macro-is-val/Impls_1.scala4
-rw-r--r--test/files/run/macro-expand-implicit-macro-is-view/Impls_1.scala4
-rw-r--r--test/files/run/macro-expand-multiple-arglists/Impls_1.scala4
-rw-r--r--test/files/run/macro-expand-nullary-generic/Impls_1.scala12
-rw-r--r--test/files/run/macro-expand-nullary-nongeneric/Impls_1.scala12
-rw-r--r--test/files/run/macro-expand-overload/Impls_1.scala12
-rw-r--r--test/files/run/macro-expand-override/Impls_1.scala12
-rw-r--r--test/files/run/macro-expand-recursive/Impls_1.scala6
-rw-r--r--test/files/run/macro-expand-tparams-bounds/Impls_1.scala6
-rw-r--r--test/files/run/macro-expand-tparams-explicit/Impls_1.scala4
-rw-r--r--test/files/run/macro-expand-tparams-implicit/Impls_1.scala4
-rw-r--r--test/files/run/macro-expand-tparams-prefix/Impls_1.scala8
-rw-r--r--test/files/run/macro-expand-unapply-a/Impls_Macros_1.scala4
-rw-r--r--test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Impls_1.scala4
-rw-r--r--test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good/Impls_1.scala4
-rw-r--r--test/files/run/macro-expand-varargs-explicit-over-varargs/Impls_1.scala4
-rw-r--r--test/files/run/macro-expand-varargs-implicit-over-nonvarargs/Impls_1.scala4
-rw-r--r--test/files/run/macro-expand-varargs-implicit-over-varargs/Impls_1.scala4
-rw-r--r--test/files/run/macro-impl-default-params/Impls_Macros_1.scala4
-rw-r--r--test/files/run/macro-impl-relaxed/Macros_1.scala10
-rw-r--r--test/files/run/macro-impl-rename-context/Impls_Macros_1.scala4
-rw-r--r--test/files/run/macro-impl-tparam-only-in-impl/Impls_1.scala4
-rw-r--r--test/files/run/macro-impl-tparam-typetag-is-optional/Impls_1.scala4
-rw-r--r--test/files/run/macro-invalidret-doesnt-conform-to-def-rettype/Impls_Macros_1.scala4
-rw-r--r--test/files/run/macro-invalidret-nontypeable/Impls_Macros_1.scala4
-rw-r--r--test/files/run/macro-invalidusage-badret/Impls_Macros_1.scala4
-rw-r--r--test/files/run/macro-invalidusage-partialapplication-with-tparams/Impls_Macros_1.scala4
-rw-r--r--test/files/run/macro-invalidusage-partialapplication/Impls_Macros_1.scala4
-rw-r--r--test/files/run/macro-openmacros/Impls_Macros_1.scala4
-rw-r--r--test/files/run/macro-parse-position-malformed/Impls_Macros_1.scala5
-rw-r--r--test/files/run/macro-parse-position/Impls_Macros_1.scala4
-rw-r--r--test/files/run/macro-quasiinvalidbody-c/Impls_Macros_1.scala4
-rw-r--r--test/files/run/macro-quasiquotes/Macros_1.scala4
-rw-r--r--test/files/run/macro-range/Common_1.scala4
-rw-r--r--test/files/run/macro-range/Expansion_Impossible_2.scala4
-rw-r--r--test/files/run/macro-reflective-ma-normal-mdmi/Impls_Macros_1.scala4
-rw-r--r--test/files/run/macro-reflective-mamd-normal-mi/Impls_1.scala4
-rw-r--r--test/files/run/macro-reify-basic/Macros_1.scala4
-rw-r--r--test/files/run/macro-reify-freevars/Macros_1.scala2
-rw-r--r--test/files/run/macro-reify-nested-a/Impls_Macros_1.scala8
-rw-r--r--test/files/run/macro-reify-nested-b/Impls_Macros_1.scala8
-rw-r--r--test/files/run/macro-reify-ref-to-packageless/Impls_1.scala4
-rw-r--r--test/files/run/macro-reify-splice-outside-reify/Impls_Macros_1.scala4
-rw-r--r--test/files/run/macro-reify-staticXXX/Macros_1.scala6
-rw-r--r--test/files/run/macro-reify-tagful-a/Macros_1.scala4
-rw-r--r--test/files/run/macro-reify-tagless-a/Impls_Macros_1.scala4
-rw-r--r--test/files/run/macro-reify-type/Macros_1.scala4
-rw-r--r--test/files/run/macro-reify-unreify/Macros_1.scala4
-rw-r--r--test/files/run/macro-repl-basic.check10
-rw-r--r--test/files/run/macro-repl-basic.scala8
-rw-r--r--test/files/run/macro-repl-dontexpand.check8
-rw-r--r--test/files/run/macro-repl-dontexpand.scala4
-rw-r--r--test/files/run/macro-settings/Impls_Macros_1.scala4
-rw-r--r--test/files/run/macro-sip19-revised/Impls_Macros_1.scala4
-rw-r--r--test/files/run/macro-sip19/Impls_Macros_1.scala4
-rw-r--r--test/files/run/macro-subpatterns/Macro_1.scala4
-rw-r--r--test/files/run/macro-system-properties.check8
-rw-r--r--test/files/run/macro-system-properties.scala4
-rw-r--r--test/files/run/macro-term-declared-in-annotation/Impls_1.scala4
-rw-r--r--test/files/run/macro-term-declared-in-anonymous/Impls_1.scala4
-rw-r--r--test/files/run/macro-term-declared-in-block/Impls_1.scala4
-rw-r--r--test/files/run/macro-term-declared-in-class-class/Impls_1.scala4
-rw-r--r--test/files/run/macro-term-declared-in-class-object/Impls_1.scala4
-rw-r--r--test/files/run/macro-term-declared-in-class/Impls_1.scala4
-rw-r--r--test/files/run/macro-term-declared-in-default-param/Impls_1.scala4
-rw-r--r--test/files/run/macro-term-declared-in-implicit-class/Impls_Macros_1.scala4
-rw-r--r--test/files/run/macro-term-declared-in-method/Impls_1.scala4
-rw-r--r--test/files/run/macro-term-declared-in-object-class/Impls_1.scala4
-rw-r--r--test/files/run/macro-term-declared-in-object-object/Impls_1.scala4
-rw-r--r--test/files/run/macro-term-declared-in-object/Impls_1.scala4
-rw-r--r--test/files/run/macro-term-declared-in-package-object/Impls_1.scala4
-rw-r--r--test/files/run/macro-term-declared-in-refinement/Impls_1.scala4
-rw-r--r--test/files/run/macro-term-declared-in-trait/Impls_1.scala4
-rw-r--r--test/files/run/macro-typecheck-implicitsdisabled/Impls_Macros_1.scala6
-rw-r--r--test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala6
-rw-r--r--test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala6
-rw-r--r--test/files/run/macro-undetparams-consfromsls/Impls_Macros_1.scala6
-rw-r--r--test/files/run/macro-undetparams-macroitself/Impls_Macros_1.scala4
-rw-r--r--test/files/run/macro-vampire-false-warning/Macros_1.scala6
-rw-r--r--test/files/run/macro-whitebox-dynamic-materialization/Macros_1.scala4
-rw-r--r--test/files/run/macro-whitebox-extractor/Macros_1.scala4
-rw-r--r--test/files/run/macro-whitebox-fundep-materialization/Macros_1.scala4
-rw-r--r--test/files/run/macro-whitebox-structural/Impls_Macros_1.scala4
-rw-r--r--test/files/run/macroPlugins-macroArgs/Macros_2.scala4
-rw-r--r--test/files/run/macroPlugins-macroExpand/Macros_2.scala6
-rw-r--r--test/files/run/macroPlugins-macroRuntime/Macros_2.scala4
-rw-r--r--test/files/run/macroPlugins-namerHooks.scala7
-rw-r--r--test/files/run/macroPlugins-typedMacroBody/Macros_2.scala6
-rw-r--r--test/files/run/name-based-patmat.check2
-rw-r--r--test/files/run/name-based-patmat.scala42
-rw-r--r--test/files/run/numbereq.scala27
-rw-r--r--test/files/run/partialfun.scala2
-rw-r--r--test/files/run/patmat-mix-case-extractor.check8
-rw-r--r--test/files/run/patmat-mix-case-extractor.scala110
-rw-r--r--test/files/run/reflection-sync-potpourri.scala32
-rw-r--r--test/files/run/reify_ann3.check4
-rw-r--r--test/files/run/repl-term-macros.check16
-rw-r--r--test/files/run/repl-term-macros.scala8
-rw-r--r--test/files/run/t5256h.check2
-rw-r--r--test/files/run/t5629b.check2
-rw-r--r--test/files/run/t5629b.scala7
-rw-r--r--test/files/run/t5713/Impls_Macros_1.scala4
-rw-r--r--test/files/run/t5753_1/Impls_Macros_1.scala4
-rw-r--r--test/files/run/t5753_2/Impls_Macros_1.scala4
-rw-r--r--test/files/run/t576.check1
-rw-r--r--test/files/run/t5894.scala5
-rw-r--r--test/files/run/t5903a/Macros_1.scala4
-rw-r--r--test/files/run/t5903b/Macros_1.scala4
-rw-r--r--test/files/run/t5903c/Macros_1.scala4
-rw-r--r--test/files/run/t5903d/Macros_1.scala4
-rw-r--r--test/files/run/t5923a/Macros_1.scala4
-rw-r--r--test/files/run/t5923d/Macros_1.scala4
-rw-r--r--test/files/run/t5940.scala6
-rw-r--r--test/files/run/t6187.check10
-rw-r--r--test/files/run/t6187.scala4
-rw-r--r--test/files/run/t6196.scala68
-rw-r--r--test/files/run/t6200.scala68
-rw-r--r--test/files/run/t6221/Macros_1.scala4
-rw-r--r--test/files/run/t6253a.scala64
-rw-r--r--test/files/run/t6253b.scala62
-rw-r--r--test/files/run/t6253c.scala63
-rw-r--r--test/files/run/t6381.check8
-rw-r--r--test/files/run/t6381.scala4
-rw-r--r--test/files/run/t6394a/Macros_1.scala4
-rw-r--r--test/files/run/t6394b/Macros_1.scala4
-rw-r--r--test/files/run/t6662/Macro_1.scala4
-rw-r--r--test/files/run/t6662/Test_2.scala2
-rw-r--r--test/files/run/t6863.check1
-rw-r--r--test/files/run/t6935.check1
-rw-r--r--test/files/run/t6935.scala18
-rw-r--r--test/files/run/t6992/Macros_1.scala2
-rw-r--r--test/files/run/t7008-scala-defined/Impls_Macros_2.scala4
-rw-r--r--test/files/run/t7008/Impls_Macros_2.scala4
-rw-r--r--test/files/run/t7047/Impls_Macros_1.scala4
-rw-r--r--test/files/run/t7157/Impls_Macros_1.scala4
-rw-r--r--test/files/run/t7240/Macros_1.scala4
-rw-r--r--test/files/run/t7326.scala64
-rw-r--r--test/files/run/t7375b/Macros_1.scala4
-rw-r--r--test/files/run/t7617a/Macros_1.scala6
-rw-r--r--test/files/run/t7617b/Macros_1.scala4
-rw-r--r--test/files/run/t7657/Macros_1.scala4
-rw-r--r--test/files/run/t7777/Macros_1.scala4
-rw-r--r--test/files/run/t7871/Macros_1.scala2
-rw-r--r--test/files/run/t8015-ffc.scala7
-rw-r--r--test/files/run/t8046.check2
-rw-r--r--test/files/run/t8046/Test.scala18
-rw-r--r--test/files/run/t8046/t8046c.scala13
-rw-r--r--test/files/run/t8048a/Macros_1.scala4
-rw-r--r--test/files/run/t8048b/Macros_1.scala8
-rw-r--r--test/files/run/t8100.check1
-rw-r--r--test/files/run/t8100.scala8
-rw-r--r--test/files/run/t8104/Macros_1.scala4
-rw-r--r--test/files/run/t8133/A_1.scala5
-rw-r--r--test/files/run/t8133/B_2.scala15
-rw-r--r--test/files/run/t8133b/A_1.scala4
-rw-r--r--test/files/run/t8133b/B_2.scala9
-rw-r--r--test/files/run/toolbox_current_run_compiles.scala4
-rw-r--r--test/files/run/typed-annotated/Macros_1.scala4
191 files changed, 1130 insertions, 451 deletions
diff --git a/test/files/run/bigDecimalTest.check b/test/files/run/bigDecimalTest.check
index 6d11c23fcd..36db6aaafe 100644
--- a/test/files/run/bigDecimalTest.check
+++ b/test/files/run/bigDecimalTest.check
@@ -3,4 +3,4 @@
0
0
0
-14
+15
diff --git a/test/files/run/is-valid-num.scala b/test/files/run/is-valid-num.scala
index d314015dd4..65e8ceeca6 100644
--- a/test/files/run/is-valid-num.scala
+++ b/test/files/run/is-valid-num.scala
@@ -19,25 +19,27 @@ object Test {
assert(!x.isValidChar, x)
assert(!x.isValidShort, x)
assert(!x.isValidByte, x)
-// assert(y.isWhole, y)
+ assert(y.isWhole, y)
assert(!y.isValidShort, y)
assert(y.isValidChar, y)
assert(y.isValidInt, y)
- assert(y.isValidFloat, y)
- assert(y.isValidDouble, y)
+ assert(y.isDecimalFloat, y)
+ assert(y.isDecimalDouble, y)
assert(y.isValidLong, y)
assert(!y.isValidByte, y)
-// assert(!y1.isWhole)
+ assert(!y1.isWhole)
assert(!y1.isValidLong, y1)
- assert(!y1.isValidFloat, y1)
- assert(!y1.isValidDouble, y1)
+ assert(y1.isDecimalFloat, y1)
+ assert(y1.isDecimalDouble, y1)
+ assert(!y1.isExactFloat, y1)
+ assert(!y1.isExactDouble, y1)
assert(!y1.isValidInt, y1)
assert(!y1.isValidChar, y1)
assert(!y1.isValidShort, y1)
assert(!y1.isValidByte, y1)
assert(!y2.isValidLong, y2)
- assert(y2.isValidFloat, y2)
- assert(y2.isValidDouble, y2)
+ assert(y2.isExactFloat, y2)
+ assert(y2.isExactDouble, y2)
assert(!l1.isValidInt && (l1 - 1).isValidInt, l1)
assert(!l2.isValidInt && (l2 + 1).isValidInt, l2)
@@ -170,8 +172,8 @@ object Test {
if (!d.isInfinity) {
val bd = BigDecimal(new java.math.BigDecimal(d))
// assert(!bd.isWhole, bd)
- assert(bd.isValidDouble, bd)
- assert(bd.isValidFloat == isFloat, bd)
+ assert(bd.isExactDouble, bd)
+ assert(bd.isExactFloat == isFloat, bd)
assert(!bd.isValidLong, bd)
assert(!bd.isValidInt, bd)
assert(!bd.isValidChar, bd)
@@ -210,9 +212,9 @@ object Test {
val isFloat = !bi.toFloat.isInfinity && bd.compare(BigDecimal(new java.math.BigDecimal(bi.toFloat))) == 0
val isDouble = !bi.toDouble.isInfinity && bd.compare(BigDecimal(new java.math.BigDecimal(bi.toDouble))) == 0
-// assert(bd.isWhole, bd)
- assert(bd.isValidDouble == isDouble, bd)
- assert(bd.isValidFloat == isFloat, bd)
+ assert(bd.isWhole, bd)
+ assert(bd.isBinaryDouble == isDouble, bd)
+ assert(bd.isBinaryFloat == isFloat, bd)
assert(bd.isValidLong == isLong, bd)
assert(bd.isValidInt == isInt, bd)
assert(bd.isValidChar == isChar, bd)
diff --git a/test/files/run/large_code.check b/test/files/run/large_code.check
new file mode 100644
index 0000000000..6ad50967bc
--- /dev/null
+++ b/test/files/run/large_code.check
@@ -0,0 +1,3 @@
+newSource1.scala:1: error: Could not write class BigEnoughToFail because it exceeds JVM code size limits. Method tooLong's code too large!
+class BigEnoughToFail {
+ ^
diff --git a/test/files/run/large_code.scala b/test/files/run/large_code.scala
new file mode 100644
index 0000000000..f9d7f8c95b
--- /dev/null
+++ b/test/files/run/large_code.scala
@@ -0,0 +1,24 @@
+import scala.tools.partest._
+import java.io.{Console => _, _}
+
+// a cold run of partest takes about 15s for this test on my laptop
+object Test extends DirectTest {
+ override def extraSettings: String = "-usejavacp -d " + testOutput.path
+
+ // test that we hit the code size limit and error out gracefully
+ // 5958 is the magic number (2^16/11 -- each `a(1,2,3,4,5,6)` is 11 bytes of bytecode)
+ override def code
+ = s"""
+ |class BigEnoughToFail {
+ | def a(a: Int, b: Int, c: Int, d: Int, e: Int, f: Int): Unit = {}
+ | def tooLong: Unit = {
+ | ${(1 to 5958) map (_ => "a(1,2,3,4,5,6)") mkString(";")}
+ | }
+ |}""".stripMargin.trim
+
+ override def show(): Unit = {
+ Console.withErr(System.out) {
+ compile()
+ }
+ }
+}
diff --git a/test/files/run/macro-abort-fresh/Macros_1.scala b/test/files/run/macro-abort-fresh/Macros_1.scala
index 350d7b41aa..2b03512efb 100644
--- a/test/files/run/macro-abort-fresh/Macros_1.scala
+++ b/test/files/run/macro-abort-fresh/Macros_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.BlackboxContext
+import scala.reflect.macros.blackbox.Context
object Impls {
- def impl(c: BlackboxContext) = {
+ def impl(c: Context) = {
import c.universe._
println(c.fresh())
println(c.fresh("qwe"))
diff --git a/test/files/run/macro-auto-duplicate/Macros_1.scala b/test/files/run/macro-auto-duplicate/Macros_1.scala
index 255dafd47e..2c910e6af7 100644
--- a/test/files/run/macro-auto-duplicate/Macros_1.scala
+++ b/test/files/run/macro-auto-duplicate/Macros_1.scala
@@ -1,8 +1,8 @@
-import scala.reflect.macros.BlackboxContext
+import scala.reflect.macros.blackbox.Context
import language.experimental.macros
object Macros {
- def impl(c: BlackboxContext) = {
+ def impl(c: Context) = {
import c.universe._
val x = Ident(newTermName("x"))
def defAndUseX(rhs: Tree) = {
diff --git a/test/files/run/macro-basic-ma-md-mi/Impls_1.scala b/test/files/run/macro-basic-ma-md-mi/Impls_1.scala
index c63353164e..fc75b99ef2 100644
--- a/test/files/run/macro-basic-ma-md-mi/Impls_1.scala
+++ b/test/files/run/macro-basic-ma-md-mi/Impls_1.scala
@@ -1,19 +1,19 @@
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = {
+ def foo(c: Context)(x: c.Expr[Int]): c.Expr[Int] = {
import c.universe._
val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(1))))
c.Expr[Int](body)
}
- def bar(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = {
+ def bar(c: Context)(x: c.Expr[Int]): c.Expr[Int] = {
import c.universe._
val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(2))))
c.Expr[Int](body)
}
- def quux(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = {
+ def quux(c: Context)(x: c.Expr[Int]): c.Expr[Int] = {
import c.universe._
val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(3))))
c.Expr[Int](body)
diff --git a/test/files/run/macro-basic-ma-mdmi/Impls_Macros_1.scala b/test/files/run/macro-basic-ma-mdmi/Impls_Macros_1.scala
index 3cdd531316..73a5a971a4 100644
--- a/test/files/run/macro-basic-ma-mdmi/Impls_Macros_1.scala
+++ b/test/files/run/macro-basic-ma-mdmi/Impls_Macros_1.scala
@@ -1,19 +1,19 @@
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = {
+ def foo(c: Context)(x: c.Expr[Int]): c.Expr[Int] = {
import c.universe._
val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(1))))
c.Expr[Int](body)
}
- def bar(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = {
+ def bar(c: Context)(x: c.Expr[Int]): c.Expr[Int] = {
import c.universe._
val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(2))))
c.Expr[Int](body)
}
- def quux(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = {
+ def quux(c: Context)(x: c.Expr[Int]): c.Expr[Int] = {
import c.universe._
val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(3))))
c.Expr[Int](body)
diff --git a/test/files/run/macro-basic-mamd-mi/Impls_1.scala b/test/files/run/macro-basic-mamd-mi/Impls_1.scala
index 3feddd2786..0be915c119 100644
--- a/test/files/run/macro-basic-mamd-mi/Impls_1.scala
+++ b/test/files/run/macro-basic-mamd-mi/Impls_1.scala
@@ -1,17 +1,17 @@
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = {
+ def foo(c: Context)(x: c.Expr[Int]): c.Expr[Int] = {
import c.universe._
c.Expr(Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(1)))))
}
- def bar(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = {
+ def bar(c: Context)(x: c.Expr[Int]): c.Expr[Int] = {
import c.universe._
c.Expr(Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(2)))))
}
- def quux(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = {
+ def quux(c: Context)(x: c.Expr[Int]): c.Expr[Int] = {
import c.universe._
val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(3))))
c.Expr[Int](body)
diff --git a/test/files/run/macro-blackbox-materialization/Macros_1.scala b/test/files/run/macro-blackbox-materialization/Macros_1.scala
index 7c31dd7dc2..ea8d1bed14 100644
--- a/test/files/run/macro-blackbox-materialization/Macros_1.scala
+++ b/test/files/run/macro-blackbox-materialization/Macros_1.scala
@@ -1,6 +1,6 @@
// For the full version of the test, take a look at run/t5923a
-import scala.reflect.macros.BlackboxContext
+import scala.reflect.macros.blackbox.Context
import language.experimental.macros
case class C[T](t: String)
@@ -9,7 +9,7 @@ object C {
}
object Macros {
- def impl[T: c.WeakTypeTag](c: BlackboxContext) = {
+ def impl[T: c.WeakTypeTag](c: Context) = {
import c.universe._
reify(C[T](c.literal(weakTypeOf[T].toString).splice))
}
diff --git a/test/files/run/macro-bodyexpandstoimpl/Impls_1.scala b/test/files/run/macro-bodyexpandstoimpl/Impls_1.scala
index 8506239952..d46af4952d 100644
--- a/test/files/run/macro-bodyexpandstoimpl/Impls_1.scala
+++ b/test/files/run/macro-bodyexpandstoimpl/Impls_1.scala
@@ -1,5 +1,6 @@
import scala.language.experimental.macros
-import scala.reflect.macros.{BlackboxContext, WhiteboxContext}
+import scala.reflect.macros.blackbox.{Context => BlackboxContext}
+import scala.reflect.macros.whitebox.{Context => WhiteboxContext}
object Impls {
def foo(c: BlackboxContext)(x: c.Expr[Int]) = x
diff --git a/test/files/run/macro-bundle-repl.check b/test/files/run/macro-bundle-repl.check
index 8487042d66..4a0b421606 100644
--- a/test/files/run/macro-bundle-repl.check
+++ b/test/files/run/macro-bundle-repl.check
@@ -4,17 +4,17 @@ Type :help for more information.
scala> import scala.language.experimental.macros
import scala.language.experimental.macros
-scala> import scala.reflect.macros.BlackboxMacro
-import scala.reflect.macros.BlackboxMacro
+scala> import scala.reflect.macros.blackbox.Context
+import scala.reflect.macros.blackbox.Context
-scala> trait Bar extends BlackboxMacro { def impl = { import c.universe._; c.Expr[Unit](q"()") } };def bar: Unit = macro Bar.impl
-defined trait Bar
+scala> class Bar(val c: Context) { def impl = { import c.universe._; c.Expr[Unit](q"()") } };def bar: Unit = macro Bar.impl
+defined class Bar
defined term macro bar: Unit
scala> bar
-scala> trait Foo extends BlackboxMacro { def impl = { import c.universe._; c.Expr[Unit](q"()") } }
-defined trait Foo
+scala> class Foo(val c: Context) { def impl = { import c.universe._; c.Expr[Unit](q"()") } }
+defined class Foo
scala> def foo: Unit = macro Foo.impl
defined term macro foo: Unit
diff --git a/test/files/run/macro-bundle-repl.scala b/test/files/run/macro-bundle-repl.scala
index db64f05943..8084418454 100644
--- a/test/files/run/macro-bundle-repl.scala
+++ b/test/files/run/macro-bundle-repl.scala
@@ -3,10 +3,10 @@ import scala.tools.partest.ReplTest
object Test extends ReplTest {
def code = """
import scala.language.experimental.macros
-import scala.reflect.macros.BlackboxMacro
-trait Bar extends BlackboxMacro { def impl = { import c.universe._; c.Expr[Unit](q"()") } };def bar: Unit = macro Bar.impl
+import scala.reflect.macros.blackbox.Context
+class Bar(val c: Context) { def impl = { import c.universe._; c.Expr[Unit](q"()") } };def bar: Unit = macro Bar.impl
bar
-trait Foo extends BlackboxMacro { def impl = { import c.universe._; c.Expr[Unit](q"()") } }
+class Foo(val c: Context) { def impl = { import c.universe._; c.Expr[Unit](q"()") } }
def foo: Unit = macro Foo.impl
foo
"""
diff --git a/test/files/run/macro-bundle-static/Impls_Macros_1.scala b/test/files/run/macro-bundle-static/Impls_Macros_1.scala
index b859411325..0142e5d945 100644
--- a/test/files/run/macro-bundle-static/Impls_Macros_1.scala
+++ b/test/files/run/macro-bundle-static/Impls_Macros_1.scala
@@ -1,8 +1,8 @@
-import scala.reflect.macros.BlackboxMacro
+import scala.reflect.macros.blackbox.Context
import scala.language.experimental.macros
object Enclosing {
- trait Impl extends BlackboxMacro {
+ class Impl(val c: Context) {
def mono = { import c.universe._; c.Expr[Unit](q"()") }
def poly[T: c.WeakTypeTag] = { import c.universe._; c.Expr[String](q"${c.weakTypeOf[T].toString}") }
def weird = macro mono
@@ -16,7 +16,7 @@ object Macros {
package pkg {
object Enclosing {
- trait Impl extends BlackboxMacro {
+ class Impl(val c: Context) {
def mono = { import c.universe._; c.Expr[Boolean](q"true") }
def poly[T: c.WeakTypeTag] = { import c.universe._; c.Expr[String](q"${c.weakTypeOf[T].toString + c.weakTypeOf[T].toString}") }
def weird = macro mono
diff --git a/test/files/run/macro-bundle-static/Test_2.scala b/test/files/run/macro-bundle-static/Test_2.scala
index 72160f6ec2..e35260cdce 100644
--- a/test/files/run/macro-bundle-static/Test_2.scala
+++ b/test/files/run/macro-bundle-static/Test_2.scala
@@ -1,8 +1,8 @@
object Test extends App {
println(Macros.mono)
println(Macros.poly[Int])
- println(new Enclosing.Impl{val c = ???}.weird)
+ println(new Enclosing.Impl(???).weird)
println(pkg.Macros.mono)
println(pkg.Macros.poly[Int])
- println(new pkg.Enclosing.Impl{val c = ???}.weird)
+ println(new pkg.Enclosing.Impl(???).weird)
} \ No newline at end of file
diff --git a/test/files/run/macro-bundle-toplevel/Impls_Macros_1.scala b/test/files/run/macro-bundle-toplevel/Impls_Macros_1.scala
index e026768642..6fd7be3b25 100644
--- a/test/files/run/macro-bundle-toplevel/Impls_Macros_1.scala
+++ b/test/files/run/macro-bundle-toplevel/Impls_Macros_1.scala
@@ -1,6 +1,6 @@
-import scala.reflect.macros.BlackboxMacro
+import scala.reflect.macros.blackbox.Context
-trait Impl extends BlackboxMacro {
+class Impl(val c: Context) {
def mono = { import c.universe._; c.Expr[Unit](q"()") }
def poly[T: c.WeakTypeTag] = { import c.universe._; c.Expr[String](q"${c.weakTypeOf[T].toString}") }
def weird = macro mono
@@ -12,7 +12,7 @@ object Macros {
}
package pkg {
- trait Impl extends BlackboxMacro {
+ class Impl(val c: Context) {
def mono = { import c.universe._; c.Expr[Boolean](q"true") }
def poly[T: c.WeakTypeTag] = { import c.universe._; c.Expr[String](q"${c.weakTypeOf[T].toString + c.weakTypeOf[T].toString}") }
def weird = macro mono
diff --git a/test/files/run/macro-bundle-toplevel/Test_2.scala b/test/files/run/macro-bundle-toplevel/Test_2.scala
index 139cc5bef2..195fb49262 100644
--- a/test/files/run/macro-bundle-toplevel/Test_2.scala
+++ b/test/files/run/macro-bundle-toplevel/Test_2.scala
@@ -1,8 +1,8 @@
object Test extends App {
println(Macros.mono)
println(Macros.poly[Int])
- println(new Impl{val c = ???}.weird)
+ println(new Impl(???).weird)
println(pkg.Macros.mono)
println(pkg.Macros.poly[Int])
- println(new pkg.Impl{val c = ???}.weird)
+ println(new pkg.Impl(???).weird)
} \ No newline at end of file
diff --git a/test/files/run/macro-bundle-whitebox.check b/test/files/run/macro-bundle-whitebox.check
new file mode 100644
index 0000000000..37c8eaf27a
--- /dev/null
+++ b/test/files/run/macro-bundle-whitebox.check
@@ -0,0 +1,6 @@
+()
+Int
+()
+true
+IntInt
+true
diff --git a/test/files/run/macro-bundle-whitebox/Impls_Macros_1.scala b/test/files/run/macro-bundle-whitebox/Impls_Macros_1.scala
new file mode 100644
index 0000000000..5e1b11895d
--- /dev/null
+++ b/test/files/run/macro-bundle-whitebox/Impls_Macros_1.scala
@@ -0,0 +1,26 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.whitebox.Context
+
+class Impl(val c: Context) {
+ def mono = { import c.universe._; c.Expr[Unit](q"()") }
+ def poly[T: c.WeakTypeTag] = { import c.universe._; c.Expr[String](q"${c.weakTypeOf[T].toString}") }
+ def weird = macro mono
+}
+
+object Macros {
+ def mono = macro Impl.mono
+ def poly[T] = macro Impl.poly[T]
+}
+
+package pkg {
+ class Impl(val c: Context) {
+ def mono = { import c.universe._; c.Expr[Boolean](q"true") }
+ def poly[T: c.WeakTypeTag] = { import c.universe._; c.Expr[String](q"${c.weakTypeOf[T].toString + 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-whitebox/Test_2.scala b/test/files/run/macro-bundle-whitebox/Test_2.scala
new file mode 100644
index 0000000000..195fb49262
--- /dev/null
+++ b/test/files/run/macro-bundle-whitebox/Test_2.scala
@@ -0,0 +1,8 @@
+object Test extends App {
+ println(Macros.mono)
+ println(Macros.poly[Int])
+ println(new Impl(???).weird)
+ println(pkg.Macros.mono)
+ println(pkg.Macros.poly[Int])
+ println(new pkg.Impl(???).weird)
+} \ No newline at end of file
diff --git a/test/files/run/macro-def-path-dependent/Test_1.scala b/test/files/run/macro-def-path-dependent/Test_1.scala
index bba97fcae1..4161a64303 100644
--- a/test/files/run/macro-def-path-dependent/Test_1.scala
+++ b/test/files/run/macro-def-path-dependent/Test_1.scala
@@ -2,7 +2,7 @@
// package test1
//
-// import scala.reflect.macros.{BlackboxContext => Ctx}
+// import scala.reflect.macros.blackbox.Context
//
// trait Exprs {
// self: Universe =>
@@ -21,5 +21,5 @@
// trait Universe extends Exprs with Reifiers
//
// object Impls {
-// def reify[T](cc: Ctx{ type PrefixType = Reifiers })(expr: cc.Expr[T]): cc.Expr[cc.prefix.value.Expr[T]] = ???
+// def reify[T](cc: Context{ type PrefixType = Reifiers })(expr: cc.Expr[T]): cc.Expr[cc.prefix.value.Expr[T]] = ???
// }
diff --git a/test/files/run/macro-def-path-dependent/Test_2.scala b/test/files/run/macro-def-path-dependent/Test_2.scala
index c884ab9d0b..75a03b54e7 100644
--- a/test/files/run/macro-def-path-dependent/Test_2.scala
+++ b/test/files/run/macro-def-path-dependent/Test_2.scala
@@ -1,6 +1,6 @@
package test2
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
trait Exprs {
self: Universe =>
@@ -18,5 +18,5 @@ trait Universe extends Exprs with Reifiers {
}
object Impls {
- def reify[T](cc: Ctx{ type PrefixType = Universe })(expr: cc.Expr[T]): cc.Expr[cc.prefix.value.Expr[T]] = ???
+ def reify[T](cc: Context{ type PrefixType = Universe })(expr: cc.Expr[T]): cc.Expr[cc.prefix.value.Expr[T]] = ???
}
diff --git a/test/files/run/macro-def-path-dependent/Test_3.scala b/test/files/run/macro-def-path-dependent/Test_3.scala
index 6d856d1450..1a5da8200b 100644
--- a/test/files/run/macro-def-path-dependent/Test_3.scala
+++ b/test/files/run/macro-def-path-dependent/Test_3.scala
@@ -1,6 +1,6 @@
package test3
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
trait Exprs {
self: Universe =>
@@ -18,5 +18,5 @@ trait Universe extends Exprs with Reifiers {
}
object Impls {
- def reify[T](cc: Ctx{ type PrefixType = Universe })(expr: cc.Expr[T]): cc.Expr[cc.prefix.value.Expr[T]] = ???
+ def reify[T](cc: Context{ type PrefixType = Universe })(expr: cc.Expr[T]): cc.Expr[cc.prefix.value.Expr[T]] = ???
}
diff --git a/test/files/run/macro-def-path-dependent/Test_4.scala b/test/files/run/macro-def-path-dependent/Test_4.scala
index 6562802013..67cb88ee6f 100644
--- a/test/files/run/macro-def-path-dependent/Test_4.scala
+++ b/test/files/run/macro-def-path-dependent/Test_4.scala
@@ -1,11 +1,11 @@
package test4
import scala.reflect.runtime.universe._
-import scala.reflect.macros.BlackboxContext
+import scala.reflect.macros.blackbox.Context
import scala.reflect.api.Universe
object Test {
def materializeTypeTag[T](u: Universe)(e: T): u.TypeTag[T] = macro materializeTypeTag_impl[T]
- def materializeTypeTag_impl[T: c.WeakTypeTag](c: BlackboxContext)(u: c.Expr[Universe])(e: c.Expr[T]): c.Expr[u.value.TypeTag[T]] = ???
+ def materializeTypeTag_impl[T: c.WeakTypeTag](c: Context)(u: c.Expr[Universe])(e: c.Expr[T]): c.Expr[u.value.TypeTag[T]] = ???
} \ No newline at end of file
diff --git a/test/files/run/macro-def-path-dependent/Test_5.scala b/test/files/run/macro-def-path-dependent/Test_5.scala
index 22407b850c..b518ce864c 100644
--- a/test/files/run/macro-def-path-dependent/Test_5.scala
+++ b/test/files/run/macro-def-path-dependent/Test_5.scala
@@ -1,9 +1,9 @@
package test56
import scala.reflect.runtime.universe._
-import scala.reflect.macros.BlackboxContext
+import scala.reflect.macros.blackbox.Context
import scala.reflect.api.Universe
object Impls {
- def materializeTypeTag_impl[T: c.WeakTypeTag](c: BlackboxContext)(u: c.Expr[Universe])(e: c.Expr[T]): c.Expr[u.value.TypeTag[T]] = ???
+ def materializeTypeTag_impl[T: c.WeakTypeTag](c: Context)(u: c.Expr[Universe])(e: c.Expr[T]): c.Expr[u.value.TypeTag[T]] = ???
} \ No newline at end of file
diff --git a/test/files/run/macro-def-path-dependent/Test_6.scala b/test/files/run/macro-def-path-dependent/Test_6.scala
index 011e726b3f..a8b50ce7d2 100644
--- a/test/files/run/macro-def-path-dependent/Test_6.scala
+++ b/test/files/run/macro-def-path-dependent/Test_6.scala
@@ -1,7 +1,7 @@
package test56
import scala.reflect.runtime.universe._
-import scala.reflect.macros.BlackboxContext
+import scala.reflect.macros.blackbox.Context
import scala.reflect.api.Universe
object Macros {
diff --git a/test/files/run/macro-default-params/Macros_1.scala b/test/files/run/macro-default-params/Macros_1.scala
index 47780ea4b8..74588a1cf4 100644
--- a/test/files/run/macro-default-params/Macros_1.scala
+++ b/test/files/run/macro-default-params/Macros_1.scala
@@ -1,11 +1,11 @@
import scala.language.experimental.macros
-import scala.reflect.macros.WhiteboxContext
+import scala.reflect.macros.whitebox.Context
object Macros {
def id[A]: A = null.asInstanceOf[A]
def foo: Any = macro impl
- def impl(c: WhiteboxContext): c.Tree = {
+ def impl(c: Context): c.Tree = {
import c.universe._
import Flag._
diff --git a/test/files/run/macro-divergence-spurious/Impls_Macros_1.scala b/test/files/run/macro-divergence-spurious/Impls_Macros_1.scala
index 4bafa84128..85d0f0bb7e 100644
--- a/test/files/run/macro-divergence-spurious/Impls_Macros_1.scala
+++ b/test/files/run/macro-divergence-spurious/Impls_Macros_1.scala
@@ -1,4 +1,4 @@
-import scala.reflect.macros.BlackboxContext
+import scala.reflect.macros.blackbox.Context
import language.experimental.macros
trait Complex[T]
@@ -7,7 +7,7 @@ class Foo(val bar: Bar)
class Bar(val s: String)
object Complex {
- def impl[T: c.WeakTypeTag](c: BlackboxContext): c.Expr[Complex[T]] = {
+ def impl[T: c.WeakTypeTag](c: Context): 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/run/macro-duplicate/Impls_Macros_1.scala b/test/files/run/macro-duplicate/Impls_Macros_1.scala
index ab852c9e46..84fb2c5b61 100644
--- a/test/files/run/macro-duplicate/Impls_Macros_1.scala
+++ b/test/files/run/macro-duplicate/Impls_Macros_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.BlackboxContext
+import scala.reflect.macros.blackbox.Context
object Macros {
- def impl(c: BlackboxContext) = {
+ def impl(c: Context) = {
import c.universe._
val Expr(Block((cdef: ClassDef) :: Nil, _)) = reify { class C { def x = 2 } }
val cdef1 =
diff --git a/test/files/run/macro-enclosures/Impls_Macros_1.scala b/test/files/run/macro-enclosures/Impls_Macros_1.scala
index dfffb48e73..5b04cf29e9 100644
--- a/test/files/run/macro-enclosures/Impls_Macros_1.scala
+++ b/test/files/run/macro-enclosures/Impls_Macros_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.BlackboxContext
+import scala.reflect.macros.blackbox.Context
object Macros {
- def impl(c: BlackboxContext) = {
+ def impl(c: Context) = {
import c.universe._
reify {
println("enclosingPackage = " + c.Expr[String](Literal(Constant(c.enclosingPackage.toString))).splice)
diff --git a/test/files/run/macro-expand-implicit-argument/Macros_1.scala b/test/files/run/macro-expand-implicit-argument/Macros_1.scala
index 7ac30e3ff2..465f313ef2 100644
--- a/test/files/run/macro-expand-implicit-argument/Macros_1.scala
+++ b/test/files/run/macro-expand-implicit-argument/Macros_1.scala
@@ -5,7 +5,7 @@ import scala.{specialized => spec}
import language.experimental.macros
import scala.reflect.ClassTag
-import scala.reflect.macros.BlackboxContext
+import scala.reflect.macros.blackbox.Context
object Macros {
def alloc[@spec A:ClassTag](src:Array[A], s1:Int, len:Int) = {
@@ -35,7 +35,7 @@ object Macros {
* arr
* }
*/
- def arrayMacro[A:c.WeakTypeTag](c:BlackboxContext)(as:c.Expr[A]*)(ct: c.Expr[ClassTag[A]]): c.Expr[Array[A]] = {
+ def arrayMacro[A:c.WeakTypeTag](c:Context)(as:c.Expr[A]*)(ct: c.Expr[ClassTag[A]]): c.Expr[Array[A]] = {
import c.mirror._
import c.universe._
def const(x:Int) = Literal(Constant(x))
diff --git a/test/files/run/macro-expand-implicit-macro-has-implicit/Impls_1.scala b/test/files/run/macro-expand-implicit-macro-has-implicit/Impls_1.scala
index c56489e61c..18c97956e4 100644
--- a/test/files/run/macro-expand-implicit-macro-has-implicit/Impls_1.scala
+++ b/test/files/run/macro-expand-implicit-macro-has-implicit/Impls_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx)(x: c.Expr[Int]) = {
+ def foo(c: Context)(x: c.Expr[Int]) = {
import c.universe._
val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(x.tree))
c.Expr[Unit](body)
diff --git a/test/files/run/macro-expand-implicit-macro-is-implicit/Impls_1.scala b/test/files/run/macro-expand-implicit-macro-is-implicit/Impls_1.scala
index f93d9100e8..aeceee5a5b 100644
--- a/test/files/run/macro-expand-implicit-macro-is-implicit/Impls_1.scala
+++ b/test/files/run/macro-expand-implicit-macro-is-implicit/Impls_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx)(x: c.Expr[String]): c.Expr[Option[Int]] = {
+ def foo(c: Context)(x: c.Expr[String]): c.Expr[Option[Int]] = {
import c.universe._
val body = Apply(Ident(definitions.SomeModule), List(Select(x.tree, TermName("toInt"))))
c.Expr[Option[Int]](body)
diff --git a/test/files/run/macro-expand-implicit-macro-is-val/Impls_1.scala b/test/files/run/macro-expand-implicit-macro-is-val/Impls_1.scala
index a8b478e9f2..fd267d32c4 100644
--- a/test/files/run/macro-expand-implicit-macro-is-val/Impls_1.scala
+++ b/test/files/run/macro-expand-implicit-macro-is-val/Impls_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx) = {
+ def foo(c: Context) = {
import c.universe._
val body = Literal(Constant(2))
c.Expr[Int](body)
diff --git a/test/files/run/macro-expand-implicit-macro-is-view/Impls_1.scala b/test/files/run/macro-expand-implicit-macro-is-view/Impls_1.scala
index f93d9100e8..aeceee5a5b 100644
--- a/test/files/run/macro-expand-implicit-macro-is-view/Impls_1.scala
+++ b/test/files/run/macro-expand-implicit-macro-is-view/Impls_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx)(x: c.Expr[String]): c.Expr[Option[Int]] = {
+ def foo(c: Context)(x: c.Expr[String]): c.Expr[Option[Int]] = {
import c.universe._
val body = Apply(Ident(definitions.SomeModule), List(Select(x.tree, TermName("toInt"))))
c.Expr[Option[Int]](body)
diff --git a/test/files/run/macro-expand-multiple-arglists/Impls_1.scala b/test/files/run/macro-expand-multiple-arglists/Impls_1.scala
index bc3d768a67..9278633c11 100644
--- a/test/files/run/macro-expand-multiple-arglists/Impls_1.scala
+++ b/test/files/run/macro-expand-multiple-arglists/Impls_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx)(x: c.Expr[Int])(y: c.Expr[Int]) = {
+ def foo(c: Context)(x: c.Expr[Int])(y: c.Expr[Int]) = {
import c.universe._
val sum = Apply(Select(x.tree, TermName("$minus")), List(y.tree))
val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(sum))
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 e0a048046f..9362d6c17a 100644
--- a/test/files/run/macro-expand-nullary-generic/Impls_1.scala
+++ b/test/files/run/macro-expand-nullary-generic/Impls_1.scala
@@ -1,15 +1,15 @@
import scala.reflect.runtime.universe._
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def impl[T: c.WeakTypeTag](c: Ctx)(meth: String) = {
+ def impl[T: c.WeakTypeTag](c: Context)(meth: String) = {
import c.universe._
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)("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")
+ def fooNullary[T: c.WeakTypeTag](c: Context) = impl[T](c)("fooNullary")
+ def fooEmpty[T: c.WeakTypeTag](c: Context)() = impl[T](c)("fooEmpty")
+ def barNullary[T: c.WeakTypeTag](c: Context)(x: c.Expr[Int]) = impl[T](c)("barNullary")
+ def barEmpty[T: c.WeakTypeTag](c: Context)(x: c.Expr[Int])() = impl[T](c)("barEmpty")
} \ No newline at end of file
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 5da33babd3..c8c3d255c4 100644
--- a/test/files/run/macro-expand-nullary-nongeneric/Impls_1.scala
+++ b/test/files/run/macro-expand-nullary-nongeneric/Impls_1.scala
@@ -1,15 +1,15 @@
import scala.reflect.runtime.universe._
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def impl(c: Ctx)(meth: String) = {
+ def impl(c: Context)(meth: String) = {
import c.universe._
val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(meth))))
c.Expr[Unit](body)
}
- 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")
+ def fooNullary(c: Context) = impl(c)("fooNullary")
+ def fooEmpty(c: Context)() = impl(c)("fooEmpty")
+ def barNullary(c: Context)(x: c.Expr[Int]) = impl(c)("barNullary")
+ def barEmpty(c: Context)(x: c.Expr[Int])() = impl(c)("barEmpty")
} \ No newline at end of file
diff --git a/test/files/run/macro-expand-overload/Impls_1.scala b/test/files/run/macro-expand-overload/Impls_1.scala
index ea68e9eb93..ef9d01d4ed 100644
--- a/test/files/run/macro-expand-overload/Impls_1.scala
+++ b/test/files/run/macro-expand-overload/Impls_1.scala
@@ -1,15 +1,15 @@
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def impl(c: Ctx)(tag: String, x: c.Expr[_]) = {
+ def impl(c: Context)(tag: String, x: c.Expr[_]) = {
import c.{prefix => prefix}
import c.universe._
val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(tag)), Literal(Constant(prefix.toString)), x.tree))
c.Expr[Unit](body)
}
- def fooObjectString(c: Ctx)(x: c.Expr[_]) = impl(c)("fooObjectString", x)
- def fooObjectInt(c: Ctx)(x: c.Expr[_]) = impl(c)("fooObjectInt", x)
- def fooClassString(c: Ctx)(x: c.Expr[_]) = impl(c)("fooClassString", x)
- def fooClassInt(c: Ctx)(x: c.Expr[_]) = impl(c)("fooClassInt", x)
+ def fooObjectString(c: Context)(x: c.Expr[_]) = impl(c)("fooObjectString", x)
+ def fooObjectInt(c: Context)(x: c.Expr[_]) = impl(c)("fooObjectInt", x)
+ def fooClassString(c: Context)(x: c.Expr[_]) = impl(c)("fooClassString", x)
+ def fooClassInt(c: Context)(x: c.Expr[_]) = impl(c)("fooClassInt", x)
} \ No newline at end of file
diff --git a/test/files/run/macro-expand-override/Impls_1.scala b/test/files/run/macro-expand-override/Impls_1.scala
index 648641f578..e6ce18f172 100644
--- a/test/files/run/macro-expand-override/Impls_1.scala
+++ b/test/files/run/macro-expand-override/Impls_1.scala
@@ -1,15 +1,15 @@
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def impl(c: Ctx)(tag: String, x: c.Expr[_]) = {
+ def impl(c: Context)(tag: String, x: c.Expr[_]) = {
import c.{prefix => prefix}
import c.universe._
val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(tag)), Literal(Constant(prefix.toString)), x.tree))
c.Expr[Unit](body)
}
- def fooBString(c: Ctx)(x: c.Expr[_]) = impl(c)("fooBString", x)
- def fooBInt(c: Ctx)(x: c.Expr[_]) = impl(c)("fooBInt", x)
- def fooDInt(c: Ctx)(x: c.Expr[_]) = impl(c)("fooDInt", x)
- def fooZString(c: Ctx)(x: c.Expr[_]) = impl(c)("fooZString", x)
+ def fooBString(c: Context)(x: c.Expr[_]) = impl(c)("fooBString", x)
+ def fooBInt(c: Context)(x: c.Expr[_]) = impl(c)("fooBInt", x)
+ def fooDInt(c: Context)(x: c.Expr[_]) = impl(c)("fooDInt", x)
+ def fooZString(c: Context)(x: c.Expr[_]) = impl(c)("fooZString", x)
} \ No newline at end of file
diff --git a/test/files/run/macro-expand-recursive/Impls_1.scala b/test/files/run/macro-expand-recursive/Impls_1.scala
index 8ba1a24540..3def2d2fbe 100644
--- a/test/files/run/macro-expand-recursive/Impls_1.scala
+++ b/test/files/run/macro-expand-recursive/Impls_1.scala
@@ -1,13 +1,13 @@
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx) = {
+ def foo(c: Context) = {
import c.universe._
val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works"))))
c.Expr[Unit](body)
}
- def fooFoo(c: Ctx) = {
+ def fooFoo(c: Context) = {
import c.universe._
val body = Select(Ident(TermName("Macros")), TermName("foo"))
c.Expr[Unit](body)
diff --git a/test/files/run/macro-expand-tparams-bounds/Impls_1.scala b/test/files/run/macro-expand-tparams-bounds/Impls_1.scala
index a255072774..95aaa1c3d7 100644
--- a/test/files/run/macro-expand-tparams-bounds/Impls_1.scala
+++ b/test/files/run/macro-expand-tparams-bounds/Impls_1.scala
@@ -1,12 +1,12 @@
-import scala.reflect.macros.BlackboxContext
+import scala.reflect.macros.blackbox.Context
object Impls1 {
- def foo[U <: String](c: BlackboxContext): c.Expr[Unit] = { import c.universe._; c.Expr[Unit](q"""println("hello")""") }
+ def foo[U <: String](c: Context): c.Expr[Unit] = { import c.universe._; c.Expr[Unit](q"""println("hello")""") }
}
class C
class D extends C
object Impls2 {
- def foo[U <: C](c: BlackboxContext): c.Expr[Unit] = { import c.universe._; c.Expr[Unit](q"""println("hello")""") }
+ def foo[U <: C](c: Context): c.Expr[Unit] = { import c.universe._; c.Expr[Unit](q"""println("hello")""") }
}
diff --git a/test/files/run/macro-expand-tparams-explicit/Impls_1.scala b/test/files/run/macro-expand-tparams-explicit/Impls_1.scala
index e95d61a36a..c33ac6d1b7 100644
--- a/test/files/run/macro-expand-tparams-explicit/Impls_1.scala
+++ b/test/files/run/macro-expand-tparams-explicit/Impls_1.scala
@@ -1,8 +1,8 @@
import scala.reflect.runtime.universe._
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo[U: c.WeakTypeTag](c: Ctx) = {
+ def foo[U: c.WeakTypeTag](c: Context) = {
import c.universe._
val U = implicitly[c.WeakTypeTag[U]]
val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(U.toString))))
diff --git a/test/files/run/macro-expand-tparams-implicit/Impls_1.scala b/test/files/run/macro-expand-tparams-implicit/Impls_1.scala
index 37cf785c0d..32cee0d5fb 100644
--- a/test/files/run/macro-expand-tparams-implicit/Impls_1.scala
+++ b/test/files/run/macro-expand-tparams-implicit/Impls_1.scala
@@ -1,8 +1,8 @@
import scala.reflect.runtime.universe._
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo[U: c.WeakTypeTag](c: Ctx)(x: c.Expr[U]) = {
+ 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))))
diff --git a/test/files/run/macro-expand-tparams-prefix/Impls_1.scala b/test/files/run/macro-expand-tparams-prefix/Impls_1.scala
index 8f85ffff4a..289f07162b 100644
--- a/test/files/run/macro-expand-tparams-prefix/Impls_1.scala
+++ b/test/files/run/macro-expand-tparams-prefix/Impls_1.scala
@@ -1,8 +1,8 @@
import scala.reflect.runtime.universe._
-import scala.reflect.macros.BlackboxContext
+import scala.reflect.macros.blackbox.Context
object Impls1 {
- def foo[U: c.WeakTypeTag](c: BlackboxContext)(x: c.Expr[U]) = {
+ def foo[U: c.WeakTypeTag](c: Context)(x: c.Expr[U]) = {
import c.universe._
val U = implicitly[c.WeakTypeTag[U]]
c.Expr[Unit](q"println(${U.toString})")
@@ -10,7 +10,7 @@ object Impls1 {
}
object Impls2 {
- def foo[T: c.WeakTypeTag, U: c.WeakTypeTag](c: BlackboxContext)(x: c.Expr[U]) = {
+ 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]]
@@ -20,7 +20,7 @@ object Impls2 {
}
object Impls345 {
- def foo[T, U: c.WeakTypeTag, V](c: BlackboxContext)(implicit T: c.WeakTypeTag[T], V: c.WeakTypeTag[V]): c.Expr[Unit] = {
+ 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(q"""
println(${T.toString})
diff --git a/test/files/run/macro-expand-unapply-a/Impls_Macros_1.scala b/test/files/run/macro-expand-unapply-a/Impls_Macros_1.scala
index 7bfff374e2..64f16c6a89 100644
--- a/test/files/run/macro-expand-unapply-a/Impls_Macros_1.scala
+++ b/test/files/run/macro-expand-unapply-a/Impls_Macros_1.scala
@@ -1,11 +1,11 @@
-import scala.reflect.macros.WhiteboxContext
+import scala.reflect.macros.whitebox.Context
object Helper {
def unapplySeq[T](x: List[T]): Option[Seq[T]] = List.unapplySeq[T](x)
}
object Macros {
- def impl[T: c.WeakTypeTag](c: WhiteboxContext)(x: c.Expr[List[T]]) = {
+ def impl[T: c.WeakTypeTag](c: Context)(x: c.Expr[List[T]]) = {
c.universe.reify(Helper.unapplySeq(x.splice))
}
diff --git a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Impls_1.scala b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Impls_1.scala
index 2480af61ad..18af84583a 100644
--- a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Impls_1.scala
+++ b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Impls_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx)(xs: c.Expr[Int]*) = {
+ def foo(c: Context)(xs: c.Expr[Int]*) = {
import c.universe._
val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), xs.map(_.tree).toList)
c.Expr[Unit](body)
diff --git a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good/Impls_1.scala b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good/Impls_1.scala
index a31c92a01c..4bdc5bec00 100644
--- a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good/Impls_1.scala
+++ b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good/Impls_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx)(xs: c.Expr[Int]*) = {
+ def foo(c: Context)(xs: c.Expr[Int]*) = {
import c.universe._
val stripped_xs = xs map (_.tree) toList match {
case List(Typed(stripped, Ident(wildstar))) if wildstar == tpnme.WILDCARD_STAR => List(stripped)
diff --git a/test/files/run/macro-expand-varargs-explicit-over-varargs/Impls_1.scala b/test/files/run/macro-expand-varargs-explicit-over-varargs/Impls_1.scala
index 889240d628..64ab7de02a 100644
--- a/test/files/run/macro-expand-varargs-explicit-over-varargs/Impls_1.scala
+++ b/test/files/run/macro-expand-varargs-explicit-over-varargs/Impls_1.scala
@@ -1,11 +1,11 @@
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
def myprintln(xs: Int*) = {
println(xs)
}
- def foo(c: Ctx)(xs: c.Expr[Int]*) = {
+ def foo(c: Context)(xs: c.Expr[Int]*) = {
import c.universe._
val body = Apply(Select(Ident(TermName("Impls")), TermName("myprintln")), xs.map(_.tree).toList)
c.Expr[Unit](body)
diff --git a/test/files/run/macro-expand-varargs-implicit-over-nonvarargs/Impls_1.scala b/test/files/run/macro-expand-varargs-implicit-over-nonvarargs/Impls_1.scala
index 2480af61ad..18af84583a 100644
--- a/test/files/run/macro-expand-varargs-implicit-over-nonvarargs/Impls_1.scala
+++ b/test/files/run/macro-expand-varargs-implicit-over-nonvarargs/Impls_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx)(xs: c.Expr[Int]*) = {
+ def foo(c: Context)(xs: c.Expr[Int]*) = {
import c.universe._
val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), xs.map(_.tree).toList)
c.Expr[Unit](body)
diff --git a/test/files/run/macro-expand-varargs-implicit-over-varargs/Impls_1.scala b/test/files/run/macro-expand-varargs-implicit-over-varargs/Impls_1.scala
index 889240d628..64ab7de02a 100644
--- a/test/files/run/macro-expand-varargs-implicit-over-varargs/Impls_1.scala
+++ b/test/files/run/macro-expand-varargs-implicit-over-varargs/Impls_1.scala
@@ -1,11 +1,11 @@
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
def myprintln(xs: Int*) = {
println(xs)
}
- def foo(c: Ctx)(xs: c.Expr[Int]*) = {
+ def foo(c: Context)(xs: c.Expr[Int]*) = {
import c.universe._
val body = Apply(Select(Ident(TermName("Impls")), TermName("myprintln")), xs.map(_.tree).toList)
c.Expr[Unit](body)
diff --git a/test/files/run/macro-impl-default-params/Impls_Macros_1.scala b/test/files/run/macro-impl-default-params/Impls_Macros_1.scala
index aa76a410ea..9b1d0eed35 100644
--- a/test/files/run/macro-impl-default-params/Impls_Macros_1.scala
+++ b/test/files/run/macro-impl-default-params/Impls_Macros_1.scala
@@ -1,8 +1,8 @@
import scala.reflect.runtime.universe._
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo_targs[T, U: c.WeakTypeTag](c: Ctx = null)(x: c.Expr[Int] = null) = {
+ def foo_targs[T, U: c.WeakTypeTag](c: Context = null)(x: c.Expr[Int] = null) = {
import c.{prefix => prefix}
import c.universe._
val U = implicitly[c.WeakTypeTag[U]]
diff --git a/test/files/run/macro-impl-relaxed/Macros_1.scala b/test/files/run/macro-impl-relaxed/Macros_1.scala
index 3cf5090ec8..420eb2a399 100644
--- a/test/files/run/macro-impl-relaxed/Macros_1.scala
+++ b/test/files/run/macro-impl-relaxed/Macros_1.scala
@@ -1,11 +1,11 @@
import language.experimental.macros
-import scala.reflect.macros.BlackboxContext
+import scala.reflect.macros.blackbox.Context
object Macros {
- def implUU(c: BlackboxContext)(x: c.Tree): c.Tree = x
- def implTU(c: BlackboxContext)(x: c.Expr[Int]): c.Tree = x.tree
- def implUT(c: BlackboxContext)(x: c.Tree): c.Expr[Int] = c.Expr[Int](x)
- def implTT(c: BlackboxContext)(x: c.Expr[Int]): c.Expr[Int] = x
+ 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
diff --git a/test/files/run/macro-impl-rename-context/Impls_Macros_1.scala b/test/files/run/macro-impl-rename-context/Impls_Macros_1.scala
index c79fc30628..acc47fcde6 100644
--- a/test/files/run/macro-impl-rename-context/Impls_Macros_1.scala
+++ b/test/files/run/macro-impl-rename-context/Impls_Macros_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(unconventionalName: Ctx)(x: unconventionalName.Expr[Int]) = {
+ def foo(unconventionalName: Context)(x: unconventionalName.Expr[Int]) = {
import unconventionalName.universe._
unconventionalName.Expr[Unit](q"""println("invoking foo...")""")
}
diff --git a/test/files/run/macro-impl-tparam-only-in-impl/Impls_1.scala b/test/files/run/macro-impl-tparam-only-in-impl/Impls_1.scala
index 55cf0dcafa..705defb18f 100644
--- a/test/files/run/macro-impl-tparam-only-in-impl/Impls_1.scala
+++ b/test/files/run/macro-impl-tparam-only-in-impl/Impls_1.scala
@@ -1,5 +1,5 @@
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo[U <: String](c: Ctx): c.Expr[Unit] = { import c.universe._; c.Expr[Unit](q"""println("hello world")""") }
+ def foo[U <: String](c: Context): c.Expr[Unit] = { import c.universe._; c.Expr[Unit](q"""println("hello world")""") }
}
diff --git a/test/files/run/macro-impl-tparam-typetag-is-optional/Impls_1.scala b/test/files/run/macro-impl-tparam-typetag-is-optional/Impls_1.scala
index bcc746e39a..fc72e7a979 100644
--- a/test/files/run/macro-impl-tparam-typetag-is-optional/Impls_1.scala
+++ b/test/files/run/macro-impl-tparam-typetag-is-optional/Impls_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo[U](c: Ctx) = {
+ def foo[U](c: Context) = {
import c.universe._
val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("don't know U"))))
c.Expr[Unit](body)
diff --git a/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype/Impls_Macros_1.scala b/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype/Impls_Macros_1.scala
index 5a51d27b24..603500b597 100644
--- a/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype/Impls_Macros_1.scala
+++ b/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype/Impls_Macros_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx): c.Expr[Int] = {
+ def foo(c: Context): c.Expr[Int] = {
import c.universe._
c.Expr(Literal(Constant("42")))
}
diff --git a/test/files/run/macro-invalidret-nontypeable/Impls_Macros_1.scala b/test/files/run/macro-invalidret-nontypeable/Impls_Macros_1.scala
index 44e508a1c6..b6b9611743 100644
--- a/test/files/run/macro-invalidret-nontypeable/Impls_Macros_1.scala
+++ b/test/files/run/macro-invalidret-nontypeable/Impls_Macros_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx) = {
+ def foo(c: Context) = {
import c.universe._
val body = Ident(TermName("IDoNotExist"))
c.Expr[Int](body)
diff --git a/test/files/run/macro-invalidusage-badret/Impls_Macros_1.scala b/test/files/run/macro-invalidusage-badret/Impls_Macros_1.scala
index a54eaa4001..0d4c5755f0 100644
--- a/test/files/run/macro-invalidusage-badret/Impls_Macros_1.scala
+++ b/test/files/run/macro-invalidusage-badret/Impls_Macros_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx)(x: c.Expr[Int]) = x
+ def foo(c: Context)(x: c.Expr[Int]) = x
}
object Macros {
diff --git a/test/files/run/macro-invalidusage-partialapplication-with-tparams/Impls_Macros_1.scala b/test/files/run/macro-invalidusage-partialapplication-with-tparams/Impls_Macros_1.scala
index a67a296335..8b5c59bde8 100644
--- a/test/files/run/macro-invalidusage-partialapplication-with-tparams/Impls_Macros_1.scala
+++ b/test/files/run/macro-invalidusage-partialapplication-with-tparams/Impls_Macros_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo[T: c.WeakTypeTag](c: Ctx)(x: c.Expr[T]) = {
+ def foo[T: c.WeakTypeTag](c: Context)(x: c.Expr[T]) = {
import c.universe._
val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(x.tree.toString))))
c.Expr[Unit](body)
diff --git a/test/files/run/macro-invalidusage-partialapplication/Impls_Macros_1.scala b/test/files/run/macro-invalidusage-partialapplication/Impls_Macros_1.scala
index 88929df27a..6970b4dd7e 100644
--- a/test/files/run/macro-invalidusage-partialapplication/Impls_Macros_1.scala
+++ b/test/files/run/macro-invalidusage-partialapplication/Impls_Macros_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx)(x: c.Expr[Int])(y: c.Expr[Int]) = {
+ def foo(c: Context)(x: c.Expr[Int])(y: c.Expr[Int]) = {
import c.universe._
val sum = Apply(Select(x.tree, TermName("$plus")), List(y.tree))
val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(sum))
diff --git a/test/files/run/macro-openmacros/Impls_Macros_1.scala b/test/files/run/macro-openmacros/Impls_Macros_1.scala
index 22e94f32cd..b60ca90d91 100644
--- a/test/files/run/macro-openmacros/Impls_Macros_1.scala
+++ b/test/files/run/macro-openmacros/Impls_Macros_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.BlackboxContext
+import scala.reflect.macros.blackbox.Context
object Macros {
- def impl(c: BlackboxContext): c.Expr[Unit] = {
+ def impl(c: Context): c.Expr[Unit] = {
// we're macros, so we can reflect against our source path
// so we don't need any partests to clean up after us!
val dir = c.enclosingUnit.source.file.file.getCanonicalFile.getParentFile
diff --git a/test/files/run/macro-parse-position-malformed/Impls_Macros_1.scala b/test/files/run/macro-parse-position-malformed/Impls_Macros_1.scala
index 2417eb6897..b623d8820a 100644
--- a/test/files/run/macro-parse-position-malformed/Impls_Macros_1.scala
+++ b/test/files/run/macro-parse-position-malformed/Impls_Macros_1.scala
@@ -1,8 +1,9 @@
import scala.language.experimental.macros
-import scala.reflect.macros.{Context => Ctx, ParseException}
+import scala.reflect.macros.blackbox.Context
+import scala.reflect.macros.ParseException
object Macros {
- def impl(c: Ctx)() = {
+ def impl(c: Context)() = {
import c.universe._
val out = try {
c.parse("foo(bar")
diff --git a/test/files/run/macro-parse-position/Impls_Macros_1.scala b/test/files/run/macro-parse-position/Impls_Macros_1.scala
index 92f64a8e70..dd20fd291b 100644
--- a/test/files/run/macro-parse-position/Impls_Macros_1.scala
+++ b/test/files/run/macro-parse-position/Impls_Macros_1.scala
@@ -1,8 +1,8 @@
import scala.language.experimental.macros
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Macros {
- def impl(c: Ctx)() = {
+ def impl(c: Context)() = {
import c.universe._
val t = c.parse("foo bar")
val out = s"${t.pos == NoPosition}\n${t.pos}\n${t.pos.source.content.length}\n${new String(t.pos.source.content)}"
diff --git a/test/files/run/macro-quasiinvalidbody-c/Impls_Macros_1.scala b/test/files/run/macro-quasiinvalidbody-c/Impls_Macros_1.scala
index 04aa11b8fe..df189b70d3 100644
--- a/test/files/run/macro-quasiinvalidbody-c/Impls_Macros_1.scala
+++ b/test/files/run/macro-quasiinvalidbody-c/Impls_Macros_1.scala
@@ -1,8 +1,8 @@
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Macros {
object Impls {
- def foo(c: Ctx)(x: c.Expr[Any]) = x
+ def foo(c: Context)(x: c.Expr[Any]) = x
}
def foo(x: Any) = macro Impls.foo
diff --git a/test/files/run/macro-quasiquotes/Macros_1.scala b/test/files/run/macro-quasiquotes/Macros_1.scala
index 81775d98e8..764542a870 100644
--- a/test/files/run/macro-quasiquotes/Macros_1.scala
+++ b/test/files/run/macro-quasiquotes/Macros_1.scala
@@ -1,7 +1,7 @@
import language.experimental.macros
-import scala.reflect.macros.BlackboxMacro
+import scala.reflect.macros.blackbox.Context
-trait Impls extends BlackboxMacro {
+class Impls(val c: Context) {
import c.universe._
def impl1 = q"println(1)"
def impl2 = q"{ println(2); println(3) }"
diff --git a/test/files/run/macro-range/Common_1.scala b/test/files/run/macro-range/Common_1.scala
index 1ad2a6c6eb..0e66815f15 100644
--- a/test/files/run/macro-range/Common_1.scala
+++ b/test/files/run/macro-range/Common_1.scala
@@ -1,4 +1,4 @@
-import reflect.macros.BlackboxContext
+import scala.reflect.macros.blackbox.Context
abstract class RangeDefault {
val from, to: Int
@@ -10,7 +10,7 @@ abstract class RangeDefault {
/** This class should go into reflect.macro once it is a bit more stable. */
abstract class Utils {
- val context: BlackboxContext
+ val context: Context
import context.universe._
class TreeSubstituter(from: List[Symbol], to: List[Tree]) extends Transformer {
diff --git a/test/files/run/macro-range/Expansion_Impossible_2.scala b/test/files/run/macro-range/Expansion_Impossible_2.scala
index fa869a2569..514de6864a 100644
--- a/test/files/run/macro-range/Expansion_Impossible_2.scala
+++ b/test/files/run/macro-range/Expansion_Impossible_2.scala
@@ -1,7 +1,7 @@
-import reflect.macros.BlackboxContext
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foreach(c: BlackboxContext)(f: c.Expr[Int => Unit]): c.Expr[Unit] = {
+ def foreach(c: Context)(f: c.Expr[Int => Unit]): c.Expr[Unit] = {
// todo. read the compiler config and print if -Ydebug is set
//println("macro-expand, _this = "+ _this)
object utils extends Utils { val context: c.type = c }
diff --git a/test/files/run/macro-reflective-ma-normal-mdmi/Impls_Macros_1.scala b/test/files/run/macro-reflective-ma-normal-mdmi/Impls_Macros_1.scala
index 53b96691e9..e964da2106 100644
--- a/test/files/run/macro-reflective-ma-normal-mdmi/Impls_Macros_1.scala
+++ b/test/files/run/macro-reflective-ma-normal-mdmi/Impls_Macros_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx)(x: c.Expr[Int]) = {
+ def foo(c: Context)(x: c.Expr[Int]) = {
import c.universe._
val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(1))))
c.Expr[Int](body)
diff --git a/test/files/run/macro-reflective-mamd-normal-mi/Impls_1.scala b/test/files/run/macro-reflective-mamd-normal-mi/Impls_1.scala
index 81ad5cae0b..89a818d99c 100644
--- a/test/files/run/macro-reflective-mamd-normal-mi/Impls_1.scala
+++ b/test/files/run/macro-reflective-mamd-normal-mi/Impls_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx)(x: c.Expr[Int]) = {
+ def foo(c: Context)(x: c.Expr[Int]) = {
import c.universe._
val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(1))))
c.Expr[Int](body)
diff --git a/test/files/run/macro-reify-basic/Macros_1.scala b/test/files/run/macro-reify-basic/Macros_1.scala
index e1a6d8abfb..1cf2a8a406 100644
--- a/test/files/run/macro-reify-basic/Macros_1.scala
+++ b/test/files/run/macro-reify-basic/Macros_1.scala
@@ -1,10 +1,10 @@
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Macros {
def foo(s: String) = macro Impls.foo
object Impls {
- def foo(c: Ctx)(s: c.Expr[String]) = c.universe.reify {
+ def foo(c: Context)(s: c.Expr[String]) = c.universe.reify {
println("hello " + s.splice)
}
}
diff --git a/test/files/run/macro-reify-freevars/Macros_1.scala b/test/files/run/macro-reify-freevars/Macros_1.scala
index 2cd94f600a..912f602c6c 100644
--- a/test/files/run/macro-reify-freevars/Macros_1.scala
+++ b/test/files/run/macro-reify-freevars/Macros_1.scala
@@ -2,7 +2,7 @@ package scala.collection.slick
object QueryableMacros{
def map[T:c.WeakTypeTag, S:c.WeakTypeTag]
- (c: scala.reflect.macros.BlackboxContext)
+ (c: scala.reflect.macros.blackbox.Context)
(projection: c.Expr[T => S])
: c.Expr[scala.collection.slick.Queryable[S]] = {
import c.universe._
diff --git a/test/files/run/macro-reify-nested-a/Impls_Macros_1.scala b/test/files/run/macro-reify-nested-a/Impls_Macros_1.scala
index 8f7a34a10a..8d2aa1e70a 100644
--- a/test/files/run/macro-reify-nested-a/Impls_Macros_1.scala
+++ b/test/files/run/macro-reify-nested-a/Impls_Macros_1.scala
@@ -1,8 +1,8 @@
import scala.reflect.runtime.universe._
import scala.reflect.runtime.{universe => ru}
-import scala.reflect.macros.BlackboxContext
+import scala.reflect.macros.blackbox.Context
-case class Utils[C <: BlackboxContext]( c:C ) {
+case class Utils[C <: Context]( c:C ) {
import c.universe._
import c.{Tree=>_}
object removeDoubleReify extends c.universe.Transformer {
@@ -21,7 +21,7 @@ case class Utils[C <: BlackboxContext]( c:C ) {
}
}
object QueryableMacros{
- def _helper[C <: BlackboxContext,S:c.WeakTypeTag]( c:C )( name:String, projection:c.Expr[_] ) = {
+ def _helper[C <: Context,S:c.WeakTypeTag]( c:C )( name:String, projection:c.Expr[_] ) = {
import c.universe._
import treeBuild._
val element_type = implicitly[c.WeakTypeTag[S]].tpe
@@ -34,7 +34,7 @@ object QueryableMacros{
c.universe.reify{ Queryable.factory[S]( foo.splice )}
}
def map[T:c.WeakTypeTag, S:c.WeakTypeTag]
- (c: scala.reflect.macros.BlackboxContext)
+ (c: scala.reflect.macros.blackbox.Context)
(projection: c.Expr[T => S]): c.Expr[Queryable[S]] = _helper[c.type,S]( c )( "_map", projection )
}
class Queryable[T]{
diff --git a/test/files/run/macro-reify-nested-b/Impls_Macros_1.scala b/test/files/run/macro-reify-nested-b/Impls_Macros_1.scala
index 8f7a34a10a..8d2aa1e70a 100644
--- a/test/files/run/macro-reify-nested-b/Impls_Macros_1.scala
+++ b/test/files/run/macro-reify-nested-b/Impls_Macros_1.scala
@@ -1,8 +1,8 @@
import scala.reflect.runtime.universe._
import scala.reflect.runtime.{universe => ru}
-import scala.reflect.macros.BlackboxContext
+import scala.reflect.macros.blackbox.Context
-case class Utils[C <: BlackboxContext]( c:C ) {
+case class Utils[C <: Context]( c:C ) {
import c.universe._
import c.{Tree=>_}
object removeDoubleReify extends c.universe.Transformer {
@@ -21,7 +21,7 @@ case class Utils[C <: BlackboxContext]( c:C ) {
}
}
object QueryableMacros{
- def _helper[C <: BlackboxContext,S:c.WeakTypeTag]( c:C )( name:String, projection:c.Expr[_] ) = {
+ def _helper[C <: Context,S:c.WeakTypeTag]( c:C )( name:String, projection:c.Expr[_] ) = {
import c.universe._
import treeBuild._
val element_type = implicitly[c.WeakTypeTag[S]].tpe
@@ -34,7 +34,7 @@ object QueryableMacros{
c.universe.reify{ Queryable.factory[S]( foo.splice )}
}
def map[T:c.WeakTypeTag, S:c.WeakTypeTag]
- (c: scala.reflect.macros.BlackboxContext)
+ (c: scala.reflect.macros.blackbox.Context)
(projection: c.Expr[T => S]): c.Expr[Queryable[S]] = _helper[c.type,S]( c )( "_map", projection )
}
class Queryable[T]{
diff --git a/test/files/run/macro-reify-ref-to-packageless/Impls_1.scala b/test/files/run/macro-reify-ref-to-packageless/Impls_1.scala
index bc0015774e..38ec6f022e 100644
--- a/test/files/run/macro-reify-ref-to-packageless/Impls_1.scala
+++ b/test/files/run/macro-reify-ref-to-packageless/Impls_1.scala
@@ -1,6 +1,6 @@
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
val `Answer to the Ultimate Question of Life, the Universe, and Everything` = 42
- def foo(c: Ctx) = c.universe.reify { `Answer to the Ultimate Question of Life, the Universe, and Everything` }
+ def foo(c: Context) = c.universe.reify { `Answer to the Ultimate Question of Life, the Universe, and Everything` }
}
diff --git a/test/files/run/macro-reify-splice-outside-reify/Impls_Macros_1.scala b/test/files/run/macro-reify-splice-outside-reify/Impls_Macros_1.scala
index d89a5e380d..624479480d 100644
--- a/test/files/run/macro-reify-splice-outside-reify/Impls_Macros_1.scala
+++ b/test/files/run/macro-reify-splice-outside-reify/Impls_Macros_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx)(x: c.Expr[Int]) = {
+ def foo(c: Context)(x: c.Expr[Int]) = {
import c.universe._
val x1 = c.Expr[Int](c.resetAllAttrs(x.tree))
c.Expr[Int](Literal(Constant(c.eval(x1))))
diff --git a/test/files/run/macro-reify-staticXXX/Macros_1.scala b/test/files/run/macro-reify-staticXXX/Macros_1.scala
index 077271d582..2993218bb4 100644
--- a/test/files/run/macro-reify-staticXXX/Macros_1.scala
+++ b/test/files/run/macro-reify-staticXXX/Macros_1.scala
@@ -1,4 +1,4 @@
-import scala.reflect.macros.BlackboxContext
+import scala.reflect.macros.blackbox.Context
object B { override def toString = "object" }
class C { override def toString = "class" }
@@ -14,7 +14,7 @@ object foo {
}
object packageless {
- def impl(c: BlackboxContext) = {
+ def impl(c: Context) = {
import c.universe._
reify {
println(B)
@@ -31,7 +31,7 @@ object packageless {
package packageful {
object Test {
- def impl(c: BlackboxContext) = {
+ def impl(c: Context) = {
import c.universe._
reify {
println(B)
diff --git a/test/files/run/macro-reify-tagful-a/Macros_1.scala b/test/files/run/macro-reify-tagful-a/Macros_1.scala
index 56d43c1c53..6f061fd26a 100644
--- a/test/files/run/macro-reify-tagful-a/Macros_1.scala
+++ b/test/files/run/macro-reify-tagful-a/Macros_1.scala
@@ -1,11 +1,11 @@
import scala.reflect.runtime.universe._
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Macros {
def foo[T](s: T) = macro Impls.foo[T]
object Impls {
- def foo[T: c.WeakTypeTag](c: Ctx)(s: c.Expr[T]) = c.universe.reify {
+ def foo[T: c.WeakTypeTag](c: Context)(s: c.Expr[T]) = c.universe.reify {
List(s.splice)
}
}
diff --git a/test/files/run/macro-reify-tagless-a/Impls_Macros_1.scala b/test/files/run/macro-reify-tagless-a/Impls_Macros_1.scala
index 27acaa1626..faac3e3a31 100644
--- a/test/files/run/macro-reify-tagless-a/Impls_Macros_1.scala
+++ b/test/files/run/macro-reify-tagless-a/Impls_Macros_1.scala
@@ -1,10 +1,10 @@
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Macros {
def foo[T](s: T) = macro Impls.foo[T]
object Impls {
- def foo[T](c: Ctx)(s: c.Expr[T]) = c.universe.reify {
+ def foo[T](c: Context)(s: c.Expr[T]) = c.universe.reify {
List[T](s.splice)
}
}
diff --git a/test/files/run/macro-reify-type/Macros_1.scala b/test/files/run/macro-reify-type/Macros_1.scala
index 04634b649a..bac1744c50 100644
--- a/test/files/run/macro-reify-type/Macros_1.scala
+++ b/test/files/run/macro-reify-type/Macros_1.scala
@@ -1,10 +1,10 @@
-import scala.reflect.macros.BlackboxContext
+import scala.reflect.macros.blackbox.Context
import scala.reflect.runtime.{universe => ru}
object StaticReflect {
def method[A](name: String): ru.Type = macro methodImpl[A]
- def methodImpl[A: c.WeakTypeTag](c: BlackboxContext)(name: c.Expr[String]): c.Expr[ru.Type] = {
+ def methodImpl[A: c.WeakTypeTag](c: Context)(name: c.Expr[String]): c.Expr[ru.Type] = {
import c.universe._
val nameName: TermName = name.tree match {
diff --git a/test/files/run/macro-reify-unreify/Macros_1.scala b/test/files/run/macro-reify-unreify/Macros_1.scala
index 055959018a..6e358eb72d 100644
--- a/test/files/run/macro-reify-unreify/Macros_1.scala
+++ b/test/files/run/macro-reify-unreify/Macros_1.scala
@@ -1,10 +1,10 @@
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Macros {
def foo(s: String) = macro Impls.foo
object Impls {
- def foo(c: Ctx)(s: c.Expr[String]) = {
+ def foo(c: Context)(s: c.Expr[String]) = {
import c.universe._
import treeBuild._
diff --git a/test/files/run/macro-repl-basic.check b/test/files/run/macro-repl-basic.check
index cc974897f2..86b4d472ed 100644
--- a/test/files/run/macro-repl-basic.check
+++ b/test/files/run/macro-repl-basic.check
@@ -4,25 +4,25 @@ Type :help for more information.
scala> import language.experimental.macros
import language.experimental.macros
-scala> import scala.reflect.macros.{BlackboxContext => Ctx}
-import scala.reflect.macros.{BlackboxContext=>Ctx}
+scala> import scala.reflect.macros.blackbox.Context
+import scala.reflect.macros.blackbox.Context
scala>
scala> object Impls {
- def foo(c: Ctx)(x: c.Expr[Int]) = {
+ def foo(c: Context)(x: c.Expr[Int]) = {
import c.universe._
val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(1))))
c.Expr[Int](body)
}
- def bar(c: Ctx)(x: c.Expr[Int]) = {
+ def bar(c: Context)(x: c.Expr[Int]) = {
import c.universe._
val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(2))))
c.Expr[Int](body)
}
- def quux(c: Ctx)(x: c.Expr[Int]) = {
+ def quux(c: Context)(x: c.Expr[Int]) = {
import c.universe._
val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(3))))
c.Expr[Int](body)
diff --git a/test/files/run/macro-repl-basic.scala b/test/files/run/macro-repl-basic.scala
index dea36c481c..217f3bc0eb 100644
--- a/test/files/run/macro-repl-basic.scala
+++ b/test/files/run/macro-repl-basic.scala
@@ -3,22 +3,22 @@ import scala.tools.partest.ReplTest
object Test extends ReplTest {
def code = """
|import language.experimental.macros
- |import scala.reflect.macros.{BlackboxContext => Ctx}
+ |import scala.reflect.macros.blackbox.Context
|
|object Impls {
- | def foo(c: Ctx)(x: c.Expr[Int]) = {
+ | def foo(c: Context)(x: c.Expr[Int]) = {
| import c.universe._
| val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(1))))
| c.Expr[Int](body)
| }
|
- | def bar(c: Ctx)(x: c.Expr[Int]) = {
+ | def bar(c: Context)(x: c.Expr[Int]) = {
| import c.universe._
| val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(2))))
| c.Expr[Int](body)
| }
|
- | def quux(c: Ctx)(x: c.Expr[Int]) = {
+ | def quux(c: Context)(x: c.Expr[Int]) = {
| import c.universe._
| val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(3))))
| c.Expr[Int](body)
diff --git a/test/files/run/macro-repl-dontexpand.check b/test/files/run/macro-repl-dontexpand.check
index 9f538c04b6..20d3b2d702 100644
--- a/test/files/run/macro-repl-dontexpand.check
+++ b/test/files/run/macro-repl-dontexpand.check
@@ -1,14 +1,14 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala> def bar1(c: scala.reflect.macros.BlackboxContext) = ???
-bar1: (c: scala.reflect.macros.BlackboxContext)Nothing
+scala> def bar1(c: scala.reflect.macros.blackbox.Context) = ???
+bar1: (c: scala.reflect.macros.blackbox.Context)Nothing
scala> def foo1 = macro bar1
defined term macro foo1: Nothing
-scala> def bar2(c: scala.reflect.macros.WhiteboxContext) = ???
-bar2: (c: scala.reflect.macros.WhiteboxContext)Nothing
+scala> def bar2(c: scala.reflect.macros.whitebox.Context) = ???
+bar2: (c: scala.reflect.macros.whitebox.Context)Nothing
scala> def foo2 = macro bar2
defined term macro foo2: Nothing
diff --git a/test/files/run/macro-repl-dontexpand.scala b/test/files/run/macro-repl-dontexpand.scala
index 733288e513..920f40084f 100644
--- a/test/files/run/macro-repl-dontexpand.scala
+++ b/test/files/run/macro-repl-dontexpand.scala
@@ -3,9 +3,9 @@ import scala.tools.partest.ReplTest
object Test extends ReplTest {
override def extraSettings = "-language:experimental.macros"
def code = """
- |def bar1(c: scala.reflect.macros.BlackboxContext) = ???
+ |def bar1(c: scala.reflect.macros.blackbox.Context) = ???
|def foo1 = macro bar1
- |def bar2(c: scala.reflect.macros.WhiteboxContext) = ???
+ |def bar2(c: scala.reflect.macros.whitebox.Context) = ???
|def foo2 = macro bar2
|""".stripMargin
}
diff --git a/test/files/run/macro-settings/Impls_Macros_1.scala b/test/files/run/macro-settings/Impls_Macros_1.scala
index c9cecfa99f..851a987206 100644
--- a/test/files/run/macro-settings/Impls_Macros_1.scala
+++ b/test/files/run/macro-settings/Impls_Macros_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.BlackboxContext
+import scala.reflect.macros.blackbox.Context
object Impls {
- def impl(c: BlackboxContext) = {
+ def impl(c: Context) = {
import c.universe._
reify {
println(c.Expr[String](Literal(Constant(c.settings.toString))).splice)
diff --git a/test/files/run/macro-sip19-revised/Impls_Macros_1.scala b/test/files/run/macro-sip19-revised/Impls_Macros_1.scala
index 3acc52dbe0..ded4d85cfc 100644
--- a/test/files/run/macro-sip19-revised/Impls_Macros_1.scala
+++ b/test/files/run/macro-sip19-revised/Impls_Macros_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.WhiteboxContext
+import scala.reflect.macros.whitebox.Context
object Macros {
- def impl(c: WhiteboxContext) = {
+ def impl(c: Context) = {
import c.universe._
val inscope = c.inferImplicitValue(c.mirror.staticClass("SourceLocation").toType)
diff --git a/test/files/run/macro-sip19/Impls_Macros_1.scala b/test/files/run/macro-sip19/Impls_Macros_1.scala
index f830d2af0d..f66ab71479 100644
--- a/test/files/run/macro-sip19/Impls_Macros_1.scala
+++ b/test/files/run/macro-sip19/Impls_Macros_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.WhiteboxContext
+import scala.reflect.macros.whitebox.Context
object Macros {
- def impl(c: WhiteboxContext) = {
+ def impl(c: Context) = {
import c.universe._
val Apply(fun, args) = c.enclosingImplicits(0).tree
val fileName = fun.pos.source.file.file.getName
diff --git a/test/files/run/macro-subpatterns/Macro_1.scala b/test/files/run/macro-subpatterns/Macro_1.scala
index d8e86e27c6..2de6b4da9d 100644
--- a/test/files/run/macro-subpatterns/Macro_1.scala
+++ b/test/files/run/macro-subpatterns/Macro_1.scala
@@ -1,9 +1,9 @@
-import scala.reflect.macros.WhiteboxContext
+import scala.reflect.macros.whitebox.Context
import language.experimental.macros
object Extractor {
def unapply(x: Any): Any = macro unapplyImpl
- def unapplyImpl(c: WhiteboxContext)(x: c.Tree) = {
+ def unapplyImpl(c: Context)(x: c.Tree) = {
val st = c.universe.asInstanceOf[reflect.internal.SymbolTable]
import st._
val subpatterns = x.attachments.get[SubpatternsAttachment].get.patterns
diff --git a/test/files/run/macro-system-properties.check b/test/files/run/macro-system-properties.check
index ceed1079b2..ffbd5a8aa8 100644
--- a/test/files/run/macro-system-properties.check
+++ b/test/files/run/macro-system-properties.check
@@ -1,14 +1,14 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala> import language.experimental._, reflect.macros.BlackboxContext
-import language.experimental._
-import reflect.macros.BlackboxContext
+scala> import scala.language.experimental._, scala.reflect.macros.blackbox.Context
+import scala.language.experimental._
+import scala.reflect.macros.blackbox.Context
scala> object GrabContext {
def lastContext = Option(System.getProperties.get("lastContext").asInstanceOf[reflect.macros.runtime.Context])
// System.properties lets you stash true globals (unlike statics which are classloader scoped)
- def impl(c: BlackboxContext)() = { import c.universe._; System.getProperties.put("lastContext", c); c.Expr[Unit](q"()") }
+ def impl(c: Context)() = { import c.universe._; System.getProperties.put("lastContext", c); c.Expr[Unit](q"()") }
def grab(): Unit = macro impl
}
defined object GrabContext
diff --git a/test/files/run/macro-system-properties.scala b/test/files/run/macro-system-properties.scala
index 3325c1747a..db88eb7df6 100644
--- a/test/files/run/macro-system-properties.scala
+++ b/test/files/run/macro-system-properties.scala
@@ -3,11 +3,11 @@ import scala.tools.partest.ReplTest
object Test extends ReplTest {
def code = """
- import language.experimental._, reflect.macros.BlackboxContext
+ import scala.language.experimental._, scala.reflect.macros.blackbox.Context
object GrabContext {
def lastContext = Option(System.getProperties.get("lastContext").asInstanceOf[reflect.macros.runtime.Context])
// System.properties lets you stash true globals (unlike statics which are classloader scoped)
- def impl(c: BlackboxContext)() = { import c.universe._; System.getProperties.put("lastContext", c); c.Expr[Unit](q"()") }
+ def impl(c: Context)() = { import c.universe._; System.getProperties.put("lastContext", c); c.Expr[Unit](q"()") }
def grab(): Unit = macro impl
}
object Test { class C(implicit a: Any) { GrabContext.grab } }
diff --git a/test/files/run/macro-term-declared-in-annotation/Impls_1.scala b/test/files/run/macro-term-declared-in-annotation/Impls_1.scala
index df3509731b..c4bcfbc1ba 100644
--- a/test/files/run/macro-term-declared-in-annotation/Impls_1.scala
+++ b/test/files/run/macro-term-declared-in-annotation/Impls_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx) = {
+ def foo(c: Context) = {
import c.{prefix => prefix}
import c.universe._
val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix))))
diff --git a/test/files/run/macro-term-declared-in-anonymous/Impls_1.scala b/test/files/run/macro-term-declared-in-anonymous/Impls_1.scala
index d69422872b..c43f5f3f53 100644
--- a/test/files/run/macro-term-declared-in-anonymous/Impls_1.scala
+++ b/test/files/run/macro-term-declared-in-anonymous/Impls_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx) = {
+ def foo(c: Context) = {
import c.{prefix => prefix}
import c.universe._
val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix))))
diff --git a/test/files/run/macro-term-declared-in-block/Impls_1.scala b/test/files/run/macro-term-declared-in-block/Impls_1.scala
index d69422872b..c43f5f3f53 100644
--- a/test/files/run/macro-term-declared-in-block/Impls_1.scala
+++ b/test/files/run/macro-term-declared-in-block/Impls_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx) = {
+ def foo(c: Context) = {
import c.{prefix => prefix}
import c.universe._
val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix))))
diff --git a/test/files/run/macro-term-declared-in-class-class/Impls_1.scala b/test/files/run/macro-term-declared-in-class-class/Impls_1.scala
index d69422872b..c43f5f3f53 100644
--- a/test/files/run/macro-term-declared-in-class-class/Impls_1.scala
+++ b/test/files/run/macro-term-declared-in-class-class/Impls_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx) = {
+ def foo(c: Context) = {
import c.{prefix => prefix}
import c.universe._
val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix))))
diff --git a/test/files/run/macro-term-declared-in-class-object/Impls_1.scala b/test/files/run/macro-term-declared-in-class-object/Impls_1.scala
index d69422872b..c43f5f3f53 100644
--- a/test/files/run/macro-term-declared-in-class-object/Impls_1.scala
+++ b/test/files/run/macro-term-declared-in-class-object/Impls_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx) = {
+ def foo(c: Context) = {
import c.{prefix => prefix}
import c.universe._
val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix))))
diff --git a/test/files/run/macro-term-declared-in-class/Impls_1.scala b/test/files/run/macro-term-declared-in-class/Impls_1.scala
index d69422872b..c43f5f3f53 100644
--- a/test/files/run/macro-term-declared-in-class/Impls_1.scala
+++ b/test/files/run/macro-term-declared-in-class/Impls_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx) = {
+ def foo(c: Context) = {
import c.{prefix => prefix}
import c.universe._
val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix))))
diff --git a/test/files/run/macro-term-declared-in-default-param/Impls_1.scala b/test/files/run/macro-term-declared-in-default-param/Impls_1.scala
index 4fae9b200f..ef0f136139 100644
--- a/test/files/run/macro-term-declared-in-default-param/Impls_1.scala
+++ b/test/files/run/macro-term-declared-in-default-param/Impls_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx) = {
+ def foo(c: Context) = {
import c.{prefix => prefix}
import c.universe._
val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix))))
diff --git a/test/files/run/macro-term-declared-in-implicit-class/Impls_Macros_1.scala b/test/files/run/macro-term-declared-in-implicit-class/Impls_Macros_1.scala
index 053af625a2..ef00f6ff32 100644
--- a/test/files/run/macro-term-declared-in-implicit-class/Impls_Macros_1.scala
+++ b/test/files/run/macro-term-declared-in-implicit-class/Impls_Macros_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def toOptionOfInt(c: Ctx) = {
+ def toOptionOfInt(c: Context) = {
import c.{prefix => prefix}
import c.universe._
val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix))))
diff --git a/test/files/run/macro-term-declared-in-method/Impls_1.scala b/test/files/run/macro-term-declared-in-method/Impls_1.scala
index d69422872b..c43f5f3f53 100644
--- a/test/files/run/macro-term-declared-in-method/Impls_1.scala
+++ b/test/files/run/macro-term-declared-in-method/Impls_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx) = {
+ def foo(c: Context) = {
import c.{prefix => prefix}
import c.universe._
val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix))))
diff --git a/test/files/run/macro-term-declared-in-object-class/Impls_1.scala b/test/files/run/macro-term-declared-in-object-class/Impls_1.scala
index d69422872b..c43f5f3f53 100644
--- a/test/files/run/macro-term-declared-in-object-class/Impls_1.scala
+++ b/test/files/run/macro-term-declared-in-object-class/Impls_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx) = {
+ def foo(c: Context) = {
import c.{prefix => prefix}
import c.universe._
val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix))))
diff --git a/test/files/run/macro-term-declared-in-object-object/Impls_1.scala b/test/files/run/macro-term-declared-in-object-object/Impls_1.scala
index d69422872b..c43f5f3f53 100644
--- a/test/files/run/macro-term-declared-in-object-object/Impls_1.scala
+++ b/test/files/run/macro-term-declared-in-object-object/Impls_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx) = {
+ def foo(c: Context) = {
import c.{prefix => prefix}
import c.universe._
val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix))))
diff --git a/test/files/run/macro-term-declared-in-object/Impls_1.scala b/test/files/run/macro-term-declared-in-object/Impls_1.scala
index d69422872b..c43f5f3f53 100644
--- a/test/files/run/macro-term-declared-in-object/Impls_1.scala
+++ b/test/files/run/macro-term-declared-in-object/Impls_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx) = {
+ def foo(c: Context) = {
import c.{prefix => prefix}
import c.universe._
val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix))))
diff --git a/test/files/run/macro-term-declared-in-package-object/Impls_1.scala b/test/files/run/macro-term-declared-in-package-object/Impls_1.scala
index d69422872b..c43f5f3f53 100644
--- a/test/files/run/macro-term-declared-in-package-object/Impls_1.scala
+++ b/test/files/run/macro-term-declared-in-package-object/Impls_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx) = {
+ def foo(c: Context) = {
import c.{prefix => prefix}
import c.universe._
val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix))))
diff --git a/test/files/run/macro-term-declared-in-refinement/Impls_1.scala b/test/files/run/macro-term-declared-in-refinement/Impls_1.scala
index d69422872b..c43f5f3f53 100644
--- a/test/files/run/macro-term-declared-in-refinement/Impls_1.scala
+++ b/test/files/run/macro-term-declared-in-refinement/Impls_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx) = {
+ def foo(c: Context) = {
import c.{prefix => prefix}
import c.universe._
val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix))))
diff --git a/test/files/run/macro-term-declared-in-trait/Impls_1.scala b/test/files/run/macro-term-declared-in-trait/Impls_1.scala
index d69422872b..c43f5f3f53 100644
--- a/test/files/run/macro-term-declared-in-trait/Impls_1.scala
+++ b/test/files/run/macro-term-declared-in-trait/Impls_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx) = {
+ def foo(c: Context) = {
import c.{prefix => prefix}
import c.universe._
val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix))))
diff --git a/test/files/run/macro-typecheck-implicitsdisabled/Impls_Macros_1.scala b/test/files/run/macro-typecheck-implicitsdisabled/Impls_Macros_1.scala
index ce937671cc..956331cfae 100644
--- a/test/files/run/macro-typecheck-implicitsdisabled/Impls_Macros_1.scala
+++ b/test/files/run/macro-typecheck-implicitsdisabled/Impls_Macros_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.BlackboxContext
+import scala.reflect.macros.blackbox.Context
object Macros {
- def impl_with_implicits_enabled(c: BlackboxContext) = {
+ def impl_with_implicits_enabled(c: Context) = {
import c.universe._
val tree1 = Apply(Select(Literal(Constant(1)), TermName("$minus$greater")), List(Literal(Constant(2))))
@@ -11,7 +11,7 @@ object Macros {
def foo_with_implicits_enabled = macro impl_with_implicits_enabled
- def impl_with_implicits_disabled(c: BlackboxContext) = {
+ def impl_with_implicits_disabled(c: Context) = {
import c.universe._
try {
diff --git a/test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala b/test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala
index 45b9a4fcc8..eb558f49b5 100644
--- a/test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala
+++ b/test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.BlackboxContext
+import scala.reflect.macros.blackbox.Context
object Macros {
- def impl_with_macros_enabled(c: BlackboxContext) = {
+ def impl_with_macros_enabled(c: Context) = {
import c.universe._
val ru = Select(Select(Select(Select(Ident(TermName("scala")), TermName("reflect")), TermName("runtime")), TermName("package")), TermName("universe"))
@@ -12,7 +12,7 @@ object Macros {
def foo_with_macros_enabled = macro impl_with_macros_enabled
- def impl_with_macros_disabled(c: BlackboxContext) = {
+ def impl_with_macros_disabled(c: Context) = {
import c.universe._
val rupkg = c.mirror.staticModule("scala.reflect.runtime.package")
diff --git a/test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala b/test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala
index d37a654957..3412f5c88f 100644
--- a/test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala
+++ b/test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.BlackboxContext
+import scala.reflect.macros.blackbox.Context
object Macros {
- def impl_with_macros_enabled(c: BlackboxContext) = {
+ def impl_with_macros_enabled(c: Context) = {
import c.universe._
val ru = Select(Select(Select(Select(Ident(TermName("scala")), TermName("reflect")), TermName("runtime")), TermName("package")), TermName("universe"))
@@ -12,7 +12,7 @@ object Macros {
def foo_with_macros_enabled = macro impl_with_macros_enabled
- def impl_with_macros_disabled(c: BlackboxContext) = {
+ def impl_with_macros_disabled(c: Context) = {
import c.universe._
val rupkg = c.mirror.staticModule("scala.reflect.runtime.package")
diff --git a/test/files/run/macro-undetparams-consfromsls/Impls_Macros_1.scala b/test/files/run/macro-undetparams-consfromsls/Impls_Macros_1.scala
index 1af0579abc..5df5f96aa8 100644
--- a/test/files/run/macro-undetparams-consfromsls/Impls_Macros_1.scala
+++ b/test/files/run/macro-undetparams-consfromsls/Impls_Macros_1.scala
@@ -1,8 +1,8 @@
import scala.reflect.runtime.universe._
-import scala.reflect.macros.BlackboxContext
+import scala.reflect.macros.blackbox.Context
object Macros {
- def cons_impl[A: c.WeakTypeTag](c: BlackboxContext)(x: c.Expr[A], xs: c.Expr[List[A]]): c.Expr[List[A]] = {
+ def cons_impl[A: c.WeakTypeTag](c: Context)(x: c.Expr[A], xs: c.Expr[List[A]]): c.Expr[List[A]] = {
import c.universe._
reify {
println("A = " + c.Expr[String](Literal(Constant(implicitly[c.WeakTypeTag[A]].toString))).splice)
@@ -10,7 +10,7 @@ object Macros {
}
}
- def nil_impl[B: c.WeakTypeTag](c: BlackboxContext): c.Expr[List[B]] = {
+ def nil_impl[B: c.WeakTypeTag](c: Context): c.Expr[List[B]] = {
import c.universe._
reify {
println("B = " + c.Expr[String](Literal(Constant(implicitly[c.WeakTypeTag[B]].toString))).splice)
diff --git a/test/files/run/macro-undetparams-macroitself/Impls_Macros_1.scala b/test/files/run/macro-undetparams-macroitself/Impls_Macros_1.scala
index f698320579..1eb257e1d9 100644
--- a/test/files/run/macro-undetparams-macroitself/Impls_Macros_1.scala
+++ b/test/files/run/macro-undetparams-macroitself/Impls_Macros_1.scala
@@ -1,8 +1,8 @@
import scala.reflect.runtime.universe._
-import scala.reflect.macros.BlackboxContext
+import scala.reflect.macros.blackbox.Context
object Macros {
- def impl[T: c.WeakTypeTag](c: BlackboxContext)(foo: c.Expr[T]): c.Expr[Unit] = {
+ def impl[T: c.WeakTypeTag](c: Context)(foo: c.Expr[T]): c.Expr[Unit] = {
import c.universe._
reify { println(c.Expr[String](Literal(Constant(implicitly[c.WeakTypeTag[T]].toString))).splice) }
}
diff --git a/test/files/run/macro-vampire-false-warning/Macros_1.scala b/test/files/run/macro-vampire-false-warning/Macros_1.scala
index bf75e924e8..0912bfba0c 100644
--- a/test/files/run/macro-vampire-false-warning/Macros_1.scala
+++ b/test/files/run/macro-vampire-false-warning/Macros_1.scala
@@ -1,20 +1,20 @@
// As per http://meta.plasm.us/posts/2013/08/31/feeding-our-vampires/
import scala.annotation.StaticAnnotation
-import scala.reflect.macros.WhiteboxContext
+import scala.reflect.macros.whitebox.Context
import scala.language.experimental.macros
class body(tree: Any) extends StaticAnnotation
object Macros {
- def selFieldImpl(c: WhiteboxContext) = {
+ def selFieldImpl(c: Context) = {
import c.universe._
val field = c.macroApplication.symbol
val bodyAnn = field.annotations.filter(_.tpe <:< typeOf[body]).head
c.Expr[Any](bodyAnn.scalaArgs.head)
}
- def mkObjectImpl(c: WhiteboxContext)(xs: c.Expr[Any]*) = {
+ def mkObjectImpl(c: Context)(xs: c.Expr[Any]*) = {
import c.universe._
import Flag._
// val kvps = xs.toList map { case q"${_}(${Literal(Constant(name: String))}).->[${_}]($value)" => name -> value }
diff --git a/test/files/run/macro-whitebox-dynamic-materialization/Macros_1.scala b/test/files/run/macro-whitebox-dynamic-materialization/Macros_1.scala
index 87cd310b09..60a8d011f1 100644
--- a/test/files/run/macro-whitebox-dynamic-materialization/Macros_1.scala
+++ b/test/files/run/macro-whitebox-dynamic-materialization/Macros_1.scala
@@ -1,4 +1,4 @@
-import scala.reflect.macros.WhiteboxContext
+import scala.reflect.macros.whitebox.Context
import scala.language.experimental.macros
trait Foo[T]
@@ -15,7 +15,7 @@ object Foo extends LowPriority {
}
object Macros {
- def impl[T: c.WeakTypeTag](c: WhiteboxContext) = {
+ def impl[T: c.WeakTypeTag](c: Context) = {
import c.universe._
val tpe = weakTypeOf[T]
if (tpe.members.exists(_.typeSignature =:= typeOf[Int]))
diff --git a/test/files/run/macro-whitebox-extractor/Macros_1.scala b/test/files/run/macro-whitebox-extractor/Macros_1.scala
index 64053b8a24..d394c0241a 100644
--- a/test/files/run/macro-whitebox-extractor/Macros_1.scala
+++ b/test/files/run/macro-whitebox-extractor/Macros_1.scala
@@ -1,4 +1,4 @@
-import scala.reflect.macros.WhiteboxContext
+import scala.reflect.macros.whitebox.Context
import language.experimental.macros
object Extractor {
@@ -6,7 +6,7 @@ object Extractor {
}
object Macros {
- def unapplyImpl(c: WhiteboxContext)(x: c.Tree) = {
+ def unapplyImpl(c: Context)(x: c.Tree) = {
import c.universe._
q"""
new {
diff --git a/test/files/run/macro-whitebox-fundep-materialization/Macros_1.scala b/test/files/run/macro-whitebox-fundep-materialization/Macros_1.scala
index 671a4fff4e..a8309e35b0 100644
--- a/test/files/run/macro-whitebox-fundep-materialization/Macros_1.scala
+++ b/test/files/run/macro-whitebox-fundep-materialization/Macros_1.scala
@@ -1,5 +1,5 @@
import scala.language.experimental.macros
-import scala.reflect.macros.WhiteboxContext
+import scala.reflect.macros.whitebox.Context
trait Iso[T, U] {
def to(t : T) : U
@@ -8,7 +8,7 @@ trait Iso[T, U] {
object Iso {
implicit def materializeIso[T, U]: Iso[T, U] = macro impl[T, U]
- def impl[T: c.WeakTypeTag, U: c.WeakTypeTag](c: WhiteboxContext): c.Expr[Iso[T, U]] = {
+ def impl[T: c.WeakTypeTag, U: c.WeakTypeTag](c: Context): c.Expr[Iso[T, U]] = {
import c.universe._
import definitions._
import Flag._
diff --git a/test/files/run/macro-whitebox-structural/Impls_Macros_1.scala b/test/files/run/macro-whitebox-structural/Impls_Macros_1.scala
index b8d0c042be..45fdb79c30 100644
--- a/test/files/run/macro-whitebox-structural/Impls_Macros_1.scala
+++ b/test/files/run/macro-whitebox-structural/Impls_Macros_1.scala
@@ -1,8 +1,8 @@
-import scala.reflect.macros.WhiteboxContext
+import scala.reflect.macros.whitebox.Context
import scala.language.experimental.macros
object Macros {
- def impl(c: WhiteboxContext) = {
+ def impl(c: Context) = {
import c.universe._
q"""
trait Foo {
diff --git a/test/files/run/macroPlugins-macroArgs/Macros_2.scala b/test/files/run/macroPlugins-macroArgs/Macros_2.scala
index d6521dfbcb..b19b8f18dc 100644
--- a/test/files/run/macroPlugins-macroArgs/Macros_2.scala
+++ b/test/files/run/macroPlugins-macroArgs/Macros_2.scala
@@ -1,8 +1,8 @@
import scala.language.experimental.macros
-import scala.reflect.macros.BlackboxContext
+import scala.reflect.macros.blackbox.Context
object Macros {
- def impl(c: BlackboxContext)(arg: c.Tree) = {
+ def impl(c: Context)(arg: c.Tree) = {
import c.universe._
q"""println($arg)"""
}
diff --git a/test/files/run/macroPlugins-macroExpand/Macros_2.scala b/test/files/run/macroPlugins-macroExpand/Macros_2.scala
index f16503b415..c9c88ad2fd 100644
--- a/test/files/run/macroPlugins-macroExpand/Macros_2.scala
+++ b/test/files/run/macroPlugins-macroExpand/Macros_2.scala
@@ -1,13 +1,13 @@
import scala.language.experimental.macros
-import scala.reflect.macros.BlackboxContext
+import scala.reflect.macros.blackbox.Context
object Macros {
- def impl1(c: BlackboxContext) = {
+ def impl1(c: Context) = {
import c.universe._
q"""println("impl1")"""
}
- def impl2(c: BlackboxContext) = {
+ def impl2(c: Context) = {
import c.universe._
q"""println("impl2")"""
}
diff --git a/test/files/run/macroPlugins-macroRuntime/Macros_2.scala b/test/files/run/macroPlugins-macroRuntime/Macros_2.scala
index d6521dfbcb..b19b8f18dc 100644
--- a/test/files/run/macroPlugins-macroRuntime/Macros_2.scala
+++ b/test/files/run/macroPlugins-macroRuntime/Macros_2.scala
@@ -1,8 +1,8 @@
import scala.language.experimental.macros
-import scala.reflect.macros.BlackboxContext
+import scala.reflect.macros.blackbox.Context
object Macros {
- def impl(c: BlackboxContext)(arg: c.Tree) = {
+ def impl(c: Context)(arg: c.Tree) = {
import c.universe._
q"""println($arg)"""
}
diff --git a/test/files/run/macroPlugins-namerHooks.scala b/test/files/run/macroPlugins-namerHooks.scala
index a71d685f7f..302429b19e 100644
--- a/test/files/run/macroPlugins-namerHooks.scala
+++ b/test/files/run/macroPlugins-namerHooks.scala
@@ -14,19 +14,20 @@ object Test extends DirectTest {
import analyzer._
val output = collection.mutable.ListBuffer[String]()
+ def log(what: String) = output += what.replace(String.format("%n"), " ")
object macroPlugin extends MacroPlugin {
override def pluginsEnterSym(namer: Namer, tree: Tree): Boolean = {
- output += s"enterSym(${tree.toString.replace('\n', ' ')})"
+ log(s"enterSym($tree)")
namer.standardEnterSym(tree)
true
}
override def pluginsEnsureCompanionObject(namer: Namer, cdef: ClassDef, creator: ClassDef => Tree = companionModuleDef(_)): Option[Symbol] = {
- output += s"ensureCompanionObject(${cdef.toString.replace('\n', ' ')}, ...)"
+ log(s"ensureCompanionObject($cdef, ...)")
Some(namer.standardEnsureCompanionObject(cdef, creator))
}
override def pluginsEnterStats(typer: Typer, stats: List[Tree]): List[Tree] = {
- stats.foreach(stat => output += s"enterStat(${stat.toString.replace('\n', ' ')})")
+ stats.foreach(stat => log(s"enterStat($stat)"))
stats
}
}
diff --git a/test/files/run/macroPlugins-typedMacroBody/Macros_2.scala b/test/files/run/macroPlugins-typedMacroBody/Macros_2.scala
index fa8522e729..80acfec659 100644
--- a/test/files/run/macroPlugins-typedMacroBody/Macros_2.scala
+++ b/test/files/run/macroPlugins-typedMacroBody/Macros_2.scala
@@ -1,13 +1,13 @@
import scala.language.experimental.macros
-import scala.reflect.macros.BlackboxContext
+import scala.reflect.macros.blackbox.Context
object Macros {
- def impl1(c: BlackboxContext) = {
+ def impl1(c: Context) = {
import c.universe._
q"""println("impl1")"""
}
- def impl2(c: BlackboxContext) = {
+ def impl2(c: Context) = {
import c.universe._
q"""println("impl2")"""
}
diff --git a/test/files/run/name-based-patmat.check b/test/files/run/name-based-patmat.check
index 1cc605ea3d..3d5fc40ed7 100644
--- a/test/files/run/name-based-patmat.check
+++ b/test/files/run/name-based-patmat.check
@@ -1,3 +1,5 @@
+`catdog only` has 11 chars
+`catdog only, no product` has 23 chars
catdog
2 catdogs! A ha ha!
3 catdogs! A ha ha!
diff --git a/test/files/run/name-based-patmat.scala b/test/files/run/name-based-patmat.scala
index 2c429c141f..8e20940100 100644
--- a/test/files/run/name-based-patmat.scala
+++ b/test/files/run/name-based-patmat.scala
@@ -1,5 +1,33 @@
final class MiniSome[T](val get: T) extends AnyVal { def isEmpty = false }
+package p0 {
+ class Single(val x: Any) extends AnyRef with Product1[String] {
+ private def s = "" + x
+ override def canEqual(x: Any) = this eq x.asInstanceOf[AnyRef]
+ def isEmpty = false
+ def get = this
+ def _1 = s + " only"
+
+ override def toString = s"Single(${_1})"
+ }
+
+ object Single {
+ def unapply(x: Any): Single = new Single(x)
+ }
+
+ class SingleNoProduct(val x: Any) extends AnyRef {
+ private def s = "" + x
+ def isEmpty = false
+ def get = s + " only, no product"
+
+ override def toString = s"SingleNoProduct($get)"
+ }
+
+ object SingleNoProduct {
+ def unapply(x: Any): SingleNoProduct = new SingleNoProduct(x)
+ }
+}
+
package p1 {
class Triple(val x: Any) extends AnyRef with Product3[String, String, String] {
private def s = "" + x
@@ -49,14 +77,16 @@ package p3 {
}
object Test {
-
- // def f(x: Any) = x match {
- // case p1.Foo(x, y, z) => println((x, y, z))
- // case x => println(x)
- // }
-
def main(args: Array[String]): Unit = {
"catdog" match {
+ case p0.Single(x) => println(s"`${x._1}` has ${x._1.length} chars")
+ case x => println("fail: " + x)
+ }
+ "catdog" match {
+ case p0.SingleNoProduct(x) => println(s"`$x` has ${x.length} chars")
+ case x => println("fail: " + x)
+ }
+ "catdog" match {
case p1.Triple(x, y, z) => List(x, y, z) foreach println
case x => println("fail: " + x)
}
diff --git a/test/files/run/numbereq.scala b/test/files/run/numbereq.scala
index d50db6d049..7ce4b23cf8 100644
--- a/test/files/run/numbereq.scala
+++ b/test/files/run/numbereq.scala
@@ -31,6 +31,24 @@ object Test {
).flatten
}
+ // Don't necessarily expect BigDecimal created from BigInt to agree with Double here.
+ def isIffy(x: Any, y: Any, canSwap: Boolean = true): Boolean = x match {
+ case bd: BigDecimal => y match {
+ case _: Float | _: Double => bd.toString.length > 15
+ case _ => false
+ }
+ case _ => canSwap && isIffy(y, x, false)
+ }
+
+ // Don't necessarily expect BigInt to agree with Float/Double beyond a Long
+ def isIffyB(x: Any, y: Any, canSwap: Boolean = true): Boolean = x match {
+ case bi: BigInt => y match {
+ case _: Float | _: Double => bi < Long.MinValue || bi > Long.MaxValue
+ case _ => false
+ }
+ case _ => canSwap && isIffyB(y, x, false)
+ }
+
def main(args: Array[String]): Unit = {
val ints = (0 to 15).toList map (Short.MinValue >> _)
val ints2 = ints map (x => -x)
@@ -46,7 +64,6 @@ object Test {
val sets = setneg1 ++ setneg2 ++ List(zero) ++ setpos1 ++ setpos2
for (set <- sets ; x <- set ; y <- set) {
- // println("'%s' == '%s' (%s == %s) (%s == %s)".format(x, y, x.hashCode, y.hashCode, x.##, y.##))
assert(x == y, "%s/%s != %s/%s".format(x, x.getClass, y, y.getClass))
assert(x.## == y.##, "%s != %s".format(x.getClass, y.getClass))
}
@@ -64,9 +81,11 @@ object Test {
val sets2 = setneg1 ++ setneg1b ++ setneg2 ++ setneg2b ++ List(zero) ++ setpos1 ++ setpos1b ++ setpos2 ++ setpos2b
for (set <- sets2 ; x <- set ; y <- set) {
-// println("'%s' == '%s' (%s == %s) (%s == %s)".format(x, y, x.hashCode, y.hashCode, x.##, y.##))
- assert(x == y, "%s/%s != %s/%s".format(x, x.getClass, y, y.getClass))
-// assert(x.## == y.##, "%s != %s".format(x.getClass, y.getClass)) Disable until Double.## is fixed (SI-5640)
+ if (!isIffy(x,y)) {
+ assert(x == y, "%s/%s != %s/%s".format(x, x.getClass, y, y.getClass))
+ // The following is blocked by SI-8150
+ // if (!isIffyB(x,y)) assert(x.## == y.##, "%x/%s != %x/%s from %s.## and %s.##".format(x.##, x.getClass, y.##, y.getClass, x, y))
+ }
}
}
}
diff --git a/test/files/run/partialfun.scala b/test/files/run/partialfun.scala
index f3c53b94ae..71c7d3e61c 100644
--- a/test/files/run/partialfun.scala
+++ b/test/files/run/partialfun.scala
@@ -76,7 +76,7 @@ object Test {
}
val chained = pf0 orElse pf1 orElse pf2
- chained()
+ chained(())
}
def main(args: Array[String]): Unit = {
diff --git a/test/files/run/patmat-mix-case-extractor.check b/test/files/run/patmat-mix-case-extractor.check
new file mode 100644
index 0000000000..a6e1bd23df
--- /dev/null
+++ b/test/files/run/patmat-mix-case-extractor.check
@@ -0,0 +1,8 @@
+-1
+6
+4
+18
+-1
+1006
+1004
+1018
diff --git a/test/files/run/patmat-mix-case-extractor.scala b/test/files/run/patmat-mix-case-extractor.scala
new file mode 100644
index 0000000000..964e6f743c
--- /dev/null
+++ b/test/files/run/patmat-mix-case-extractor.scala
@@ -0,0 +1,110 @@
+trait CaseClass
+trait ProdCaseClass extends CaseClass { def x: Int }
+trait SeqCaseClass extends CaseClass { def xs: Seq[Int] }
+
+case class CaseClass1() extends CaseClass
+case class CaseClass2(xs: Int*) extends SeqCaseClass
+case class CaseClass3(x: Int) extends ProdCaseClass
+case class CaseClass4(x: Int, xs: Int*) extends ProdCaseClass with SeqCaseClass
+
+object Extractor1 { def unapply(x: CaseClass): Boolean = false }
+object Extractor2 { def unapplySeq(x: SeqCaseClass): Option[Seq[Int]] = Some(x.xs) }
+object Extractor3 { def unapply(x: ProdCaseClass): Option[Int] = Some(x.x) }
+object Extractor4 { def unapplySeq(x: ProdCaseClass with SeqCaseClass): Option[(Int, Seq[Int])] = Some(x.x, x.xs) }
+
+class A {
+ def f1(x: Any) = x match {
+ case CaseClass1() => -1
+ case CaseClass2(xs @ _*) => xs.sum
+ case CaseClass3(x) => x
+ case CaseClass4(x, xs @ _*) => x + xs.sum
+ case Extractor4(x, xs @ _*) => 1000 + x + xs.sum
+ case Extractor3(x) => 1000 + x
+ case Extractor2(xs @ _*) => 1000 + xs.sum
+ case Extractor1() => -3
+ case _ => -2
+ }
+ def f2(x: Any) = x match {
+ case Extractor4(x, xs @ _*) => 1000 + x + xs.sum
+ case Extractor3(x) => 1000 + x
+ case Extractor2(xs @ _*) => 1000 + xs.sum
+ case Extractor1() => -3
+ case CaseClass1() => -1
+ case CaseClass2(xs @ _*) => xs.sum
+ case CaseClass3(x) => x
+ case CaseClass4(x, xs @ _*) => x + xs.sum
+ case _ => -2
+ }
+ def run() {
+ List(
+ f1(CaseClass1()),
+ f1(CaseClass2(1, 2, 3)),
+ f1(CaseClass3(4)),
+ f1(CaseClass4(5, 6, 7)),
+ f2(CaseClass1()),
+ f2(CaseClass2(1, 2, 3)),
+ f2(CaseClass3(4)),
+ f2(CaseClass4(5, 6, 7))
+ ) foreach println
+ }
+}
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ (new A).run
+ }
+}
+
+
+class B {
+ case class CaseClass0()
+ case class CaseClass0v(xs: Int*)
+
+ case class CaseClass(x: Int, y: Int)
+ object Extractor { def unapply(x: Any): Option[(Int, Int)] = Some((1, 1)) }
+
+ case class CaseSeq(x: Char, y: Double, zs: Int*)
+ object ExtractorSeq { def unapplySeq(x: Any): Option[(Int, Int, Seq[Int])] = Some((1, 1, List(1))) }
+
+ def f1(x: CaseClass) = x match { case CaseClass(y, z) => y }
+ def f2(x: Any) = x match { case Extractor(y, z) => y }
+
+ def f3(x: CaseSeq) = x match {
+ case CaseSeq(x, y) => y
+ case CaseSeq(x, y, z) => z
+ }
+ def f4(x: CaseSeq) = x match {
+ case CaseSeq(x, y, z) => z :: Nil
+ case CaseSeq(x, y, z @ _*) => z
+ }
+
+ def f5(x: Any) = x match { case ExtractorSeq(x, y, z) => z }
+ def f6(x: Any) = x match { case ExtractorSeq(x, y, z @ _*) => z }
+
+ def g1(x: CaseClass0) = x match {
+ case CaseClass0() => true
+ }
+ def g2(x: CaseClass0v) = x match {
+ case CaseClass0v() => true
+ case CaseClass0v(5) => true
+ case CaseClass0v(x) => true
+ case CaseClass0v(xs @ _*) => false
+ }
+}
+
+package p1 {
+ trait _X {
+ case class _Foo();
+ object _Bar {
+ def unapply(foo: _Foo): Boolean = true;
+ }
+ }
+
+ object Y extends _X {
+ val foo = _Foo()
+ foo match {
+ case _Bar() =>
+ case _ => assert(false)
+ }
+ }
+}
diff --git a/test/files/run/reflection-sync-potpourri.scala b/test/files/run/reflection-sync-potpourri.scala
deleted file mode 100644
index 0ad5f2ab66..0000000000
--- a/test/files/run/reflection-sync-potpourri.scala
+++ /dev/null
@@ -1,32 +0,0 @@
-import scala.reflect.runtime.universe._
-
-// this test checks that under heavily multithreaded conditions:
-// 1) scala.reflect.runtime.universe, its rootMirror and definitions are initialized correctly
-// 2) symbols are correctly materialized into PackageScopes (no dupes)
-// 3) unpickling works okay even we unpickle the same symbol a lot of times
-
-object Test extends App {
- def foo[T: TypeTag](x: T) = typeOf[T].toString
- val n = 1000
- val rng = new scala.util.Random()
- val types = List(
- () => typeOf[java.lang.reflect.Method],
- () => typeOf[java.lang.annotation.Annotation],
- () => typeOf[scala.io.BufferedSource],
- () => typeOf[scala.io.Codec])
- val perms = types.permutations.toList
- def force(lazytpe: () => Type): String = {
- lazytpe().typeSymbol.typeSignature
- lazytpe().toString
- }
- val diceRolls = List.fill(n)(rng.nextInt(perms.length))
- val threads = (1 to n) map (i => new Thread(s"Reflector-$i") {
- override def run(): Unit = {
- val s1 = foo("42")
- val s2 = perms(diceRolls(i - 1)).map(x => force(x)).sorted.mkString(", ")
- assert(s1 == "java.lang.String")
- assert(s2 == "java.lang.annotation.Annotation, java.lang.reflect.Method, scala.io.BufferedSource, scala.io.Codec")
- }
- })
- threads foreach (_.start)
-} \ No newline at end of file
diff --git a/test/files/run/reify_ann3.check b/test/files/run/reify_ann3.check
index d4cf660758..4f1c61cf0e 100644
--- a/test/files/run/reify_ann3.check
+++ b/test/files/run/reify_ann3.check
@@ -1,5 +1,5 @@
{
- class Tree[A, B] extends AnyRef {
+ class Tree[A, +B] extends AnyRef {
@new inline @getter() final <paramaccessor> val key: A = _;
def <init>(key: A) = {
super.<init>();
@@ -9,7 +9,7 @@
()
}
{
- class Tree[A, B] extends AnyRef {
+ class Tree[A, +B] extends AnyRef {
final <paramaccessor> private[this] val key: A = _;
@inline @scala.annotation.meta.getter final <stable> <accessor> <paramaccessor> def key: A = Tree.this.key;
def <init>(key: A): Tree[A,B] = {
diff --git a/test/files/run/repl-term-macros.check b/test/files/run/repl-term-macros.check
index f73abb5dc3..3580bfe1f1 100644
--- a/test/files/run/repl-term-macros.check
+++ b/test/files/run/repl-term-macros.check
@@ -1,16 +1,16 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala> import scala.reflect.macros.BlackboxContext
-import scala.reflect.macros.BlackboxContext
+scala> import scala.reflect.macros.blackbox.Context
+import scala.reflect.macros.blackbox.Context
scala> import language.experimental.macros
import language.experimental.macros
scala>
-scala> def impl1(c: BlackboxContext) = { import c.universe._; c.Expr[Unit](q"()") }
-impl1: (c: scala.reflect.macros.BlackboxContext)c.Expr[Unit]
+scala> def impl1(c: Context) = { import c.universe._; c.Expr[Unit](q"()") }
+impl1: (c: scala.reflect.macros.blackbox.Context)c.Expr[Unit]
scala> def foo1: Unit = macro impl1
defined term macro foo1: Unit
@@ -19,8 +19,8 @@ scala> foo1
scala>
-scala> def impl2(c: BlackboxContext)() = { import c.universe._; c.Expr[Unit](q"()") }
-impl2: (c: scala.reflect.macros.BlackboxContext)()c.Expr[Unit]
+scala> def impl2(c: Context)() = { import c.universe._; c.Expr[Unit](q"()") }
+impl2: (c: scala.reflect.macros.blackbox.Context)()c.Expr[Unit]
scala> def foo2(): Unit = macro impl2
defined term macro foo2: ()Unit
@@ -29,8 +29,8 @@ scala> foo2()
scala>
-scala> def impl3(c: BlackboxContext)(x: c.Expr[Int])(y: c.Expr[Int]) = { import c.universe._; c.Expr[Unit](q"()") }
-impl3: (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Int])(y: c.Expr[Int])c.Expr[Unit]
+scala> def impl3(c: Context)(x: c.Expr[Int])(y: c.Expr[Int]) = { import c.universe._; c.Expr[Unit](q"()") }
+impl3: (c: scala.reflect.macros.blackbox.Context)(x: c.Expr[Int])(y: c.Expr[Int])c.Expr[Unit]
scala> def foo3(x: Int)(y: Int): Unit = macro impl3
defined term macro foo3: (x: Int)(y: Int)Unit
diff --git a/test/files/run/repl-term-macros.scala b/test/files/run/repl-term-macros.scala
index b4660e258e..32892b7314 100644
--- a/test/files/run/repl-term-macros.scala
+++ b/test/files/run/repl-term-macros.scala
@@ -2,18 +2,18 @@ import scala.tools.partest.ReplTest
object Test extends ReplTest {
def code = """
- import scala.reflect.macros.BlackboxContext
+ import scala.reflect.macros.blackbox.Context
import language.experimental.macros
-def impl1(c: BlackboxContext) = { import c.universe._; c.Expr[Unit](q"()") }
+def impl1(c: Context) = { import c.universe._; c.Expr[Unit](q"()") }
def foo1: Unit = macro impl1
foo1
-def impl2(c: BlackboxContext)() = { import c.universe._; c.Expr[Unit](q"()") }
+def impl2(c: Context)() = { import c.universe._; c.Expr[Unit](q"()") }
def foo2(): Unit = macro impl2
foo2()
-def impl3(c: BlackboxContext)(x: c.Expr[Int])(y: c.Expr[Int]) = { import c.universe._; c.Expr[Unit](q"()") }
+def impl3(c: Context)(x: c.Expr[Int])(y: c.Expr[Int]) = { import c.universe._; c.Expr[Unit](q"()") }
def foo3(x: Int)(y: Int): Unit = macro impl3
foo3(2)(3)
"""
diff --git a/test/files/run/t5256h.check b/test/files/run/t5256h.check
index 1a4a92a684..dc3e919897 100644
--- a/test/files/run/t5256h.check
+++ b/test/files/run/t5256h.check
@@ -3,5 +3,5 @@ Test.$anon$1
java.lang.Object {
final private val x: Int
def x(): Int
- def <init>(): java.lang.Object{def x(): Int}
+ def <init>(): $anon$1
}
diff --git a/test/files/run/t5629b.check b/test/files/run/t5629b.check
index 1bc0248c3d..e0f25f0b05 100644
--- a/test/files/run/t5629b.check
+++ b/test/files/run/t5629b.check
@@ -2,7 +2,7 @@
MySmartPF.apply entered...
newPF.applyOrElse entered...
default
-scala.MatchError: () (of class scala.runtime.BoxedUnit)
+scala.MatchError: 1 (of class java.lang.Integer)
=== pf(42):
MySmartPF.apply entered...
newPF.applyOrElse entered...
diff --git a/test/files/run/t5629b.scala b/test/files/run/t5629b.scala
index 9ff29c8d89..5d402201ae 100644
--- a/test/files/run/t5629b.scala
+++ b/test/files/run/t5629b.scala
@@ -1,8 +1,3 @@
-
-
-
-
-
object Test extends App {
trait MyPF[@specialized(Int) -A] extends (A => Unit) {
@@ -16,7 +11,7 @@ object Test extends App {
trait MySmartPF[@specialized(Int) -A] extends MyPF[A] {
def apply(x: A): Unit = {
println("MySmartPF.apply entered...")
- applyOrElse(x, { _: Any => throw new MatchError })
+ applyOrElse(x, { default: Any => throw new MatchError(default) })
}
}
diff --git a/test/files/run/t5713/Impls_Macros_1.scala b/test/files/run/t5713/Impls_Macros_1.scala
index bfe2fc4efd..7b04197cfa 100644
--- a/test/files/run/t5713/Impls_Macros_1.scala
+++ b/test/files/run/t5713/Impls_Macros_1.scala
@@ -1,7 +1,7 @@
package m
import language.experimental.macros
-import scala.reflect.macros.BlackboxContext
+import scala.reflect.macros.blackbox.Context
object Level extends Enumeration {
val Error = Value(5)
@@ -13,7 +13,7 @@ object Logger {
private object LoggerMacros {
- type LoggerContext = BlackboxContext { type PrefixType = Logger.type }
+ type LoggerContext = Context { type PrefixType = Logger.type }
def error(c: LoggerContext)(message: c.Expr[String]): c.Expr[Unit] =
log(c)(c.universe.reify(Level.Error), message)
diff --git a/test/files/run/t5753_1/Impls_Macros_1.scala b/test/files/run/t5753_1/Impls_Macros_1.scala
index 3ddff56c38..ce07138852 100644
--- a/test/files/run/t5753_1/Impls_Macros_1.scala
+++ b/test/files/run/t5753_1/Impls_Macros_1.scala
@@ -1,8 +1,8 @@
-import scala.reflect.macros.BlackboxContext
+import scala.reflect.macros.blackbox.Context
import language.experimental.macros
trait Impls {
- def impl(c: BlackboxContext)(x: c.Expr[Any]) = x
+ def impl(c: Context)(x: c.Expr[Any]) = x
}
object Macros extends Impls {
diff --git a/test/files/run/t5753_2/Impls_Macros_1.scala b/test/files/run/t5753_2/Impls_Macros_1.scala
index c95c9a41b3..d446d37bdf 100644
--- a/test/files/run/t5753_2/Impls_Macros_1.scala
+++ b/test/files/run/t5753_2/Impls_Macros_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.{BlackboxContext => Ctx}
+import scala.reflect.macros.blackbox.Context
trait Macro_T {
- def foo[T](c: Ctx)(s: c.Expr[T]) = s
+ def foo[T](c: Context)(s: c.Expr[T]) = s
}
object Macros {
diff --git a/test/files/run/t576.check b/test/files/run/t576.check
index 8a1218a102..6458d5d743 100644
--- a/test/files/run/t576.check
+++ b/test/files/run/t576.check
@@ -1,3 +1,4 @@
+warning: there were 1 deprecation warning(s); re-run with -deprecation for details
1
2
3
diff --git a/test/files/run/t5894.scala b/test/files/run/t5894.scala
index 5d482333f5..6e118fd396 100644
--- a/test/files/run/t5894.scala
+++ b/test/files/run/t5894.scala
@@ -1,10 +1,11 @@
-import language.experimental.macros
+import scala.reflect.macros.blackbox.Context
+import scala.language.experimental.macros
class Test
object Test {
def foo: Unit = macro fooImpl
- def fooImpl(c: reflect.macros.BlackboxContext) = { import c.universe._; c.Expr[Unit](q"()") }
+ def fooImpl(c: Context) = { import c.universe._; c.Expr[Unit](q"()") }
def main(args: Array[String]) {
try {
diff --git a/test/files/run/t5903a/Macros_1.scala b/test/files/run/t5903a/Macros_1.scala
index ce1b035260..5d084ceed5 100644
--- a/test/files/run/t5903a/Macros_1.scala
+++ b/test/files/run/t5903a/Macros_1.scala
@@ -1,4 +1,4 @@
-import scala.reflect.macros.WhiteboxContext
+import scala.reflect.macros.whitebox.Context
import language.experimental.macros
trait Tree
@@ -13,7 +13,7 @@ object NewQuasiquotes {
}
object QuasiquoteMacros {
- def unapplyImpl(c: WhiteboxContext)(t: c.Tree) = {
+ def unapplyImpl(c: Context)(t: c.Tree) = {
import c.universe._
q"""
new {
diff --git a/test/files/run/t5903b/Macros_1.scala b/test/files/run/t5903b/Macros_1.scala
index 97f15cec3b..29a05f7fec 100644
--- a/test/files/run/t5903b/Macros_1.scala
+++ b/test/files/run/t5903b/Macros_1.scala
@@ -1,4 +1,4 @@
-import scala.reflect.macros.WhiteboxContext
+import scala.reflect.macros.whitebox.Context
import language.experimental.macros
object Interpolation {
@@ -10,7 +10,7 @@ object Interpolation {
}
object Macros {
- def unapplyImpl[T: c.WeakTypeTag](c: WhiteboxContext)(x: c.Tree) = {
+ def unapplyImpl[T: c.WeakTypeTag](c: Context)(x: c.Tree) = {
import c.universe._
q"""
new {
diff --git a/test/files/run/t5903c/Macros_1.scala b/test/files/run/t5903c/Macros_1.scala
index 979284a263..34fe1d8808 100644
--- a/test/files/run/t5903c/Macros_1.scala
+++ b/test/files/run/t5903c/Macros_1.scala
@@ -1,4 +1,4 @@
-import scala.reflect.macros.WhiteboxContext
+import scala.reflect.macros.whitebox.Context
import language.experimental.macros
object Interpolation {
@@ -10,7 +10,7 @@ object Interpolation {
}
object Macros {
- def unapplyImpl[T: c.WeakTypeTag](c: WhiteboxContext)(x: c.Tree) = {
+ def unapplyImpl[T: c.WeakTypeTag](c: Context)(x: c.Tree) = {
import c.universe._
q"""
new {
diff --git a/test/files/run/t5903d/Macros_1.scala b/test/files/run/t5903d/Macros_1.scala
index dc1989462b..f1f8dc1fde 100644
--- a/test/files/run/t5903d/Macros_1.scala
+++ b/test/files/run/t5903d/Macros_1.scala
@@ -1,4 +1,4 @@
-import scala.reflect.macros.WhiteboxContext
+import scala.reflect.macros.whitebox.Context
import language.experimental.macros
object Interpolation {
@@ -10,7 +10,7 @@ object Interpolation {
}
object Macros {
- def unapplyImpl(c: WhiteboxContext)(x: c.Tree) = {
+ def unapplyImpl(c: Context)(x: c.Tree) = {
import c.universe._
q"""
new {
diff --git a/test/files/run/t5923a/Macros_1.scala b/test/files/run/t5923a/Macros_1.scala
index 445392ff95..9aa7a02708 100644
--- a/test/files/run/t5923a/Macros_1.scala
+++ b/test/files/run/t5923a/Macros_1.scala
@@ -1,4 +1,4 @@
-import scala.reflect.macros.WhiteboxContext
+import scala.reflect.macros.whitebox.Context
import language.experimental.macros
case class C[T](t: String)
@@ -7,7 +7,7 @@ object C {
}
object Macros {
- def impl[T](c: WhiteboxContext)(ttag: c.WeakTypeTag[T]) = {
+ def impl[T](c: Context)(ttag: c.WeakTypeTag[T]) = {
import c.universe._
val ttag0 = ttag;
{
diff --git a/test/files/run/t5923d/Macros_1.scala b/test/files/run/t5923d/Macros_1.scala
index b6e7134b95..1400674d4b 100644
--- a/test/files/run/t5923d/Macros_1.scala
+++ b/test/files/run/t5923d/Macros_1.scala
@@ -1,9 +1,9 @@
import scala.language.experimental.macros
-import scala.reflect.macros.BlackboxContext
+import scala.reflect.macros.blackbox.Context
trait MappedRow
trait RowMapper[T <: MappedRow]
object RowMapper {
implicit def mapper[T <: MappedRow]: RowMapper[T] = macro impl[T]
- def impl[T <: MappedRow : c.WeakTypeTag](c: BlackboxContext) = c.universe.reify(new RowMapper[T]{})
+ def impl[T <: MappedRow : c.WeakTypeTag](c: Context) = c.universe.reify(new RowMapper[T]{})
} \ No newline at end of file
diff --git a/test/files/run/t5940.scala b/test/files/run/t5940.scala
index 062f11c467..7b025b43af 100644
--- a/test/files/run/t5940.scala
+++ b/test/files/run/t5940.scala
@@ -4,15 +4,15 @@ object Test extends DirectTest {
def code = ???
def macros_1 = """
- import scala.reflect.macros.BlackboxContext
+ import scala.reflect.macros.blackbox.Context
object Impls {
- def impl(c: BlackboxContext) = { import c.universe._; c.Expr[Unit](q"()") }
+ def impl(c: Context) = { import c.universe._; c.Expr[Unit](q"()") }
}
object Macros {
//import Impls._
- def impl(c: BlackboxContext) = { import c.universe._; c.Expr[Unit](q"()") }
+ def impl(c: Context) = { import c.universe._; c.Expr[Unit](q"()") }
def foo: Unit = macro impl
}
"""
diff --git a/test/files/run/t6187.check b/test/files/run/t6187.check
index c833b45443..97ee68271a 100644
--- a/test/files/run/t6187.check
+++ b/test/files/run/t6187.check
@@ -1,15 +1,15 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala> import language.experimental.macros, reflect.macros.BlackboxContext
-import language.experimental.macros
-import reflect.macros.BlackboxContext
+scala> import scala.language.experimental.macros, scala.reflect.macros.blackbox.Context
+import scala.language.experimental.macros
+import scala.reflect.macros.blackbox.Context
-scala> def macroImpl[T: c.WeakTypeTag](c: BlackboxContext)(t: c.Expr[T]): c.Expr[List[T]] = {
+scala> def macroImpl[T: c.WeakTypeTag](c: Context)(t: c.Expr[T]): c.Expr[List[T]] = {
val r = c.universe.reify { List(t.splice) }
c.Expr[List[T]]( c.resetLocalAttrs(r.tree) )
}
-macroImpl: [T](c: scala.reflect.macros.BlackboxContext)(t: c.Expr[T])(implicit evidence$1: c.WeakTypeTag[T])c.Expr[List[T]]
+macroImpl: [T](c: scala.reflect.macros.blackbox.Context)(t: c.Expr[T])(implicit evidence$1: c.WeakTypeTag[T])c.Expr[List[T]]
scala> def demo[T](t: T): List[T] = macro macroImpl[T]
defined term macro demo: [T](t: T)List[T]
diff --git a/test/files/run/t6187.scala b/test/files/run/t6187.scala
index fc6fa6e9a7..7d84419b8a 100644
--- a/test/files/run/t6187.scala
+++ b/test/files/run/t6187.scala
@@ -2,8 +2,8 @@ import scala.tools.partest.ReplTest
object Test extends ReplTest {
override def code = """
-import language.experimental.macros, reflect.macros.BlackboxContext
-def macroImpl[T: c.WeakTypeTag](c: BlackboxContext)(t: c.Expr[T]): c.Expr[List[T]] = {
+import scala.language.experimental.macros, scala.reflect.macros.blackbox.Context
+def macroImpl[T: c.WeakTypeTag](c: Context)(t: c.Expr[T]): c.Expr[List[T]] = {
val r = c.universe.reify { List(t.splice) }
c.Expr[List[T]]( c.resetLocalAttrs(r.tree) )
}
diff --git a/test/files/run/t6196.scala b/test/files/run/t6196.scala
new file mode 100644
index 0000000000..16c2c7409d
--- /dev/null
+++ b/test/files/run/t6196.scala
@@ -0,0 +1,68 @@
+import scala.collection.immutable.HashSet
+
+object Test extends App {
+
+ case class Collision(value: Int) extends Ordered[Collision] {
+ def compare(that:Collision) = value compare that.value
+
+ override def hashCode = value / 5
+ }
+
+ def testCorrectness[T : Ordering](n: Int, mkKey: Int => T) {
+ val o = implicitly[Ordering[T]]
+ val s = HashSet.empty[T] ++ (0 until n).map(mkKey)
+ for (i <- 0 until n) {
+ val ki = mkKey(i)
+ val a = s.filter(o.lt(_,ki))
+ val b = s.filterNot(o.lt(_,ki))
+ require(a.size == i && (0 until i).forall(i => a.contains(mkKey(i))))
+ require(b.size == n - i && (i until n).forall(i => b.contains(mkKey(i))))
+ }
+ }
+
+ // this tests the structural sharing of the new filter
+ // I could not come up with a simple test that tests structural sharing when only parts are reused, but
+ // at least this fails with the old and passes with the new implementation
+ def testSharing() {
+ val s = HashSet.empty[Int] ++ (0 until 100)
+ require(s.filter(_ => true) eq s)
+ require(s.filterNot(_ => false) eq s)
+ }
+
+ // this tests that neither hashCode nor equals are called during filter
+ def testNoHashing() {
+ var hashCount = 0
+ var equalsCount = 0
+ case class HashCounter(value:Int) extends Ordered[HashCounter] {
+ def compare(that:HashCounter) = value compare that.value
+
+ override def hashCode = {
+ hashCount += 1
+ value
+ }
+
+ override def equals(that:Any) = {
+ equalsCount += 1
+ this match {
+ case HashCounter(value) => this.value == value
+ case _ => false
+ }
+ }
+ }
+
+ val s = HashSet.empty[HashCounter] ++ (0 until 100).map(HashCounter)
+ val hashCount0 = hashCount
+ val equalsCount0 = equalsCount
+ val t = s.filter(_<HashCounter(50))
+ require(hashCount == hashCount0)
+ require(equalsCount == equalsCount0)
+ }
+
+ // this tests correctness of filter and filterNot for integer keys
+ testCorrectness[Int](100, identity _)
+ // this tests correctness of filter and filterNot for keys with lots of collisions
+ // this is necessary because usually collisions are rare so the collision-related code is not thoroughly tested
+ testCorrectness[Collision](100, Collision.apply _)
+ testSharing()
+ testNoHashing()
+}
diff --git a/test/files/run/t6200.scala b/test/files/run/t6200.scala
new file mode 100644
index 0000000000..9a5d91e042
--- /dev/null
+++ b/test/files/run/t6200.scala
@@ -0,0 +1,68 @@
+import scala.collection.immutable.HashMap
+
+object Test extends App {
+
+ case class Collision(value: Int) extends Ordered[Collision] {
+ def compare(that: Collision) = value compare that.value
+
+ override def hashCode = value / 5
+ }
+
+ def testCorrectness[T: Ordering](n: Int, mkKey: Int => T) {
+ val o = implicitly[Ordering[T]]
+ val s = HashMap.empty[T, Unit] ++ (0 until n).map(x => mkKey(x) -> (()))
+ for (i <- 0 until n) {
+ val ki = mkKey(i)
+ val a = s.filter(kv => o.lt(kv._1, ki))
+ val b = s.filterNot(kv => o.lt(kv._1, ki))
+ require(a.size == i && (0 until i).forall(i => a.contains(mkKey(i))))
+ require(b.size == n - i && (i until n).forall(i => b.contains(mkKey(i))))
+ }
+ }
+
+ // this tests the structural sharing of the new filter
+ // I could not come up with a simple test that tests structural sharing when only parts are reused, but
+ // at least this fails with the old and passes with the new implementation
+ def testSharing() {
+ val s = HashMap.empty[Int, Unit] ++ (0 until 100).map(_ -> (()))
+ require(s.filter(_ => true) eq s)
+ require(s.filterNot(_ => false) eq s)
+ }
+
+ // this tests that neither hashCode nor equals are called during filter
+ def testNoHashing() {
+ var hashCount = 0
+ var equalsCount = 0
+ case class HashCounter(value: Int) extends Ordered[HashCounter] {
+ def compare(that: HashCounter) = value compare that.value
+
+ override def hashCode = {
+ hashCount += 1
+ value
+ }
+
+ override def equals(that: Any) = {
+ equalsCount += 1
+ this match {
+ case HashCounter(value) => this.value == value
+ case _ => false
+ }
+ }
+ }
+
+ val s = HashMap.empty[HashCounter, Unit] ++ (0 until 100).map(k => HashCounter(k) -> (()))
+ val hashCount0 = hashCount
+ val equalsCount0 = equalsCount
+ val t = s.filter(_._1 < HashCounter(50))
+ require(hashCount == hashCount0)
+ require(equalsCount == equalsCount0)
+ }
+
+ // this tests correctness of filter and filterNot for integer keys
+ testCorrectness[Int](100, identity _)
+ // this tests correctness of filter and filterNot for keys with lots of collisions
+ // this is necessary because usually collisions are rare so the collision-related code is not thoroughly tested
+ testCorrectness[Collision](100, Collision.apply _)
+ testSharing()
+ testNoHashing()
+}
diff --git a/test/files/run/t6221/Macros_1.scala b/test/files/run/t6221/Macros_1.scala
index 60ed0aa3e3..b5c28360fa 100644
--- a/test/files/run/t6221/Macros_1.scala
+++ b/test/files/run/t6221/Macros_1.scala
@@ -1,6 +1,6 @@
import language.experimental.macros
import language.implicitConversions
-import scala.reflect.macros.BlackboxContext
+import scala.reflect.macros.blackbox.Context
import scala.reflect.runtime.universe.Tree
class ReflectiveClosure[A, B](val tree: Tree, fn: A => B) extends (A => B) {
@@ -12,7 +12,7 @@ object ReflectiveClosure {
}
object Macros {
- def reflectiveClosureImpl[A, B](c: BlackboxContext)(f: c.Expr[A => B]): c.Expr[ReflectiveClosure[A, B]] = {
+ def reflectiveClosureImpl[A, B](c: Context)(f: c.Expr[A => B]): c.Expr[ReflectiveClosure[A, B]] = {
import c.universe._
val u = treeBuild.mkRuntimeUniverseRef
val m = EmptyTree
diff --git a/test/files/run/t6253a.scala b/test/files/run/t6253a.scala
new file mode 100644
index 0000000000..efa3230df6
--- /dev/null
+++ b/test/files/run/t6253a.scala
@@ -0,0 +1,64 @@
+import scala.collection.immutable.HashSet
+
+object Test extends App {
+
+ var hashCount = 0
+
+ /**
+ * A key that produces lots of hash collisions, to exercise the part of the code that deals with those
+ */
+ case class Collision(value: Int) {
+
+ override def hashCode = {
+ // we do not check hash counts for Collision keys because ListSet.++ uses a mutable hashset internally,
+ // so when we have hash collisions, union will call key.hashCode.
+ // hashCount += 1
+ value / 5
+ }
+ }
+
+ /**
+ * A key that is identical to int other than that it counts hashCode invocations
+ */
+ case class HashCounter(value: Int) {
+
+ override def hashCode = {
+ hashCount += 1
+ value
+ }
+ }
+
+ def testUnion[T](sizes: Seq[Int], offsets: Seq[Double], keyType: String, mkKey: Int => T) {
+ for {
+ i <- sizes
+ o <- offsets
+ } {
+ val e = HashSet.empty[T]
+ val j = (i * o).toInt
+ // create two sets of size i with overlap o
+ val a = e ++ (0 until i).map(mkKey)
+ require(a.size == i, s"Building HashSet of size $i failed. Key type $keyType.")
+ val b = e ++ (j until (i + j)).map(mkKey)
+ require(b.size == i, s"Building HashSet of size $i failed. Key type $keyType.")
+ val as = e ++ (0 until j).map(mkKey)
+ require(as.size == j, s"Building HashSet of size $j failed. Key type $keyType.")
+ val hashCount0 = hashCount
+ val u = a union b
+ require(hashCount == hashCount0, s"key.hashCode should not be called, but has been called ${hashCount - hashCount0} times. Key type $keyType.")
+ require(u == (a union scala.collection.mutable.HashSet(b.toSeq: _*)), s"Operation must still work for other sets!")
+ require(u.size == i + j, s"Expected size ${i+j}. Real size ${u.size}. Key type $keyType.")
+ for (x <- 0 until i + j)
+ require(u.contains(mkKey(x)), s"Key type $keyType. Set (0 until ${i + j}) should contain $x but does not.")
+ val a_as = a union as
+ val as_a = as union a
+ require((a_as eq a) || (a_as eq as), s"No structural sharing in a union as. Key type $keyType, a=(0 until $i) as=(0 until $j)")
+ require((as_a eq a) || (as_a eq as), s"No structural sharing in as union a. Key type $keyType, a=(0 until $i) as=(0 until $j)")
+ }
+ }
+
+ val sizes = Seq(1, 10, 100, 1000, 10000, 100000)
+ val offsets = Seq(0.0, 0.25, 0.5, 0.75, 1.0)
+ testUnion(sizes, offsets, "int", identity[Int])
+ testUnion(sizes, offsets, "hashcounter", HashCounter.apply)
+ testUnion(sizes, offsets, "collision", Collision.apply)
+}
diff --git a/test/files/run/t6253b.scala b/test/files/run/t6253b.scala
new file mode 100644
index 0000000000..9cbfefd49e
--- /dev/null
+++ b/test/files/run/t6253b.scala
@@ -0,0 +1,62 @@
+import scala.collection.immutable.HashSet
+
+object Test extends App {
+
+ var hashCount = 0
+
+ /**
+ * A key that produces lots of hash collisions, to exercise the part of the code that deals with those
+ */
+ case class Collision(value: Int) {
+
+ override def hashCode = {
+ hashCount += 1
+ value / 5
+ }
+ }
+
+ /**
+ * A key that is identical to int other than that it counts hashCode invocations
+ */
+ case class HashCounter(value: Int) {
+
+ override def hashCode = {
+ hashCount += 1
+ value
+ }
+ }
+
+ def testIntersect[T](sizes: Seq[Int], offsets: Seq[Double], keyType: String, mkKey: Int => T) {
+ for {
+ i <- sizes
+ o <- offsets
+ } {
+ val e = HashSet.empty[T]
+ val j = (i * o).toInt
+ // create two sets of size i with overlap o
+ val a = e ++ (0 until i).map(mkKey)
+ require(a.size == i, s"Building HashSet of size $i failed. Key type $keyType.")
+ val b = e ++ (j until (i + j)).map(mkKey)
+ require(b.size == i, s"Building HashSet of size $i failed. Key type $keyType.")
+ val as = e ++ (0 until j).map(mkKey)
+ require(as.size == j, s"Building HashSet of size $j failed. Key type $keyType.")
+ val hashCount0 = hashCount
+ val u = a intersect b
+ require(hashCount == hashCount0, s"key.hashCode should not be called, but has been called ${hashCount - hashCount0} times. Key type $keyType.")
+ require(u == (a intersect scala.collection.mutable.HashSet(b.toSeq: _*)), s"Operation must still work for other sets!")
+ require(u.size == i - j, s"Expected size ${i + j}. Real size ${u.size}. Key type $keyType.")
+ for (x <- j until i)
+ require(u.contains(mkKey(x)), s"Key type $keyType. Set (0 until ${i + j}) should contain $x but does not.")
+ val a_as = a intersect as
+ val as_a = as intersect a
+ require((a_as eq as) || (a_as eq a), s"No structural sharing in a intersect as. Key type $keyType, a=(0 until $i) as=(0 until $j)")
+ require((as_a eq as) || (as_a eq a), s"No structural sharing in as intersect a. Key type $keyType, a=(0 until $i) as=(0 until $j)")
+ }
+ }
+
+ val sizes = Seq(1, 10, 100, 1000, 10000, 100000)
+ val offsets = Seq(0.0, 0.25, 0.5, 0.75, 1.0)
+ testIntersect(sizes, offsets, "int", identity[Int])
+ testIntersect(sizes, offsets, "hashcounter", HashCounter.apply)
+ testIntersect(sizes, offsets, "collision", Collision.apply)
+}
diff --git a/test/files/run/t6253c.scala b/test/files/run/t6253c.scala
new file mode 100644
index 0000000000..71dfe1473e
--- /dev/null
+++ b/test/files/run/t6253c.scala
@@ -0,0 +1,63 @@
+import scala.collection.immutable.HashSet
+
+object Test extends App {
+
+ var hashCount = 0
+
+ /**
+ * A key that produces lots of hash collisions, to exercise the part of the code that deals with those
+ */
+ case class Collision(value: Int) {
+
+ override def hashCode = {
+ hashCount += 1
+ value / 5
+ }
+ }
+
+ /**
+ * A key that is identical to int other than that it counts hashCode invocations
+ */
+ case class HashCounter(value: Int) {
+
+ override def hashCode = {
+ hashCount += 1
+ value
+ }
+ }
+
+ def testDiff[T](sizes: Seq[Int], offsets: Seq[Double], keyType: String, mkKey: Int => T) {
+ for {
+ i <- sizes
+ o <- offsets
+ } {
+ val e = HashSet.empty[T]
+ val j = (i * o).toInt
+ // create two sets of size i with overlap o
+ val a = e ++ (0 until i).map(mkKey)
+ require(a.size == i, s"Building HashSet of size $i failed. Key type $keyType.")
+ val b = e ++ (j until (i + j)).map(mkKey)
+ require(b.size == i, s"Building HashSet of size $i failed. Key type $keyType.")
+ val as = e ++ (0 until j).map(mkKey)
+ require(as.size == j, s"Building HashSet of size $j failed. Key type $keyType.")
+ val hashCount0 = hashCount
+ val u = a diff b
+ require(hashCount == hashCount0, s"key.hashCode should not be called, but has been called ${hashCount - hashCount0} times. Key type $keyType.")
+ require(u == (a diff scala.collection.mutable.HashSet(b.toSeq: _*)), s"Operation must still work for other sets!")
+ require(u.size == j, s"Expected size $j. Real size ${u.size}. Key type $keyType.")
+ for (x <- 0 until j)
+ require(u.contains(mkKey(x)), s"Key type $keyType. Set (0 until ${i + j}) should contain $x but does not.")
+ require((as intersect b).isEmpty)
+ val b_as = b diff as
+ val as_b = as diff b
+ require((b_as eq b) || (b_as eq as), s"No structural sharing in b diff as. Key type $keyType, b=($j until ${i + j}) as=(0 until $j)")
+ require((as_b eq b) || (as_b eq as), s"No structural sharing in as diff b. Key type $keyType, b=($j until ${i + j}) as=(0 until $j)")
+ }
+ }
+
+ val sizes = Seq(1, 10, 100, 1000, 10000, 100000)
+ val offsets = Seq(0.0, 0.25, 0.5, 0.75, 1.0)
+ testDiff(sizes, offsets, "int", identity[Int])
+ testDiff(sizes, offsets, "hashCounter", HashCounter.apply)
+ testDiff(sizes, offsets, "collision", Collision.apply)
+}
diff --git a/test/files/run/t6381.check b/test/files/run/t6381.check
index ef08d0da09..4ed11d59ff 100644
--- a/test/files/run/t6381.check
+++ b/test/files/run/t6381.check
@@ -1,14 +1,14 @@
Type in expressions to have them evaluated.
Type :help for more information.
-scala> import language.experimental.macros
-import language.experimental.macros
+scala> import scala.language.experimental.macros
+import scala.language.experimental.macros
-scala> def pos_impl(c: reflect.macros.BlackboxContext): c.Expr[String] = {
+scala> def pos_impl(c: scala.reflect.macros.blackbox.Context): c.Expr[String] = {
import c.universe._
c.Expr[String](Literal(Constant(c.enclosingPosition.getClass.toString)))
}
-pos_impl: (c: scala.reflect.macros.BlackboxContext)c.Expr[String]
+pos_impl: (c: scala.reflect.macros.blackbox.Context)c.Expr[String]
scala> def pos: String = macro pos_impl
defined term macro pos: String
diff --git a/test/files/run/t6381.scala b/test/files/run/t6381.scala
index c78dc13ed7..5a687c10c1 100644
--- a/test/files/run/t6381.scala
+++ b/test/files/run/t6381.scala
@@ -2,8 +2,8 @@ import scala.tools.partest.ReplTest
object Test extends ReplTest {
def code = """
- |import language.experimental.macros
- |def pos_impl(c: reflect.macros.BlackboxContext): c.Expr[String] = {
+ |import scala.language.experimental.macros
+ |def pos_impl(c: scala.reflect.macros.blackbox.Context): c.Expr[String] = {
| import c.universe._
| c.Expr[String](Literal(Constant(c.enclosingPosition.getClass.toString)))
|}
diff --git a/test/files/run/t6394a/Macros_1.scala b/test/files/run/t6394a/Macros_1.scala
index b934b5ebb1..376d85ba67 100644
--- a/test/files/run/t6394a/Macros_1.scala
+++ b/test/files/run/t6394a/Macros_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.BlackboxContext
+import scala.reflect.macros.blackbox.Context
object Macros {
- def impl(c:BlackboxContext): c.Expr[Any] = {
+ def impl(c:Context): c.Expr[Any] = {
import c.universe._
val selfTree = This(c.enclosingImpl.symbol.asModule.moduleClass)
diff --git a/test/files/run/t6394b/Macros_1.scala b/test/files/run/t6394b/Macros_1.scala
index 01fbc4f09e..53215e63aa 100644
--- a/test/files/run/t6394b/Macros_1.scala
+++ b/test/files/run/t6394b/Macros_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.BlackboxContext
+import scala.reflect.macros.blackbox.Context
object Macros {
- def impl(c:BlackboxContext): c.Expr[Any] = {
+ def impl(c:Context): c.Expr[Any] = {
import c.universe._
val selfTree = This(tpnme.EMPTY)
diff --git a/test/files/run/t6662/Macro_1.scala b/test/files/run/t6662/Macro_1.scala
index cecf242f66..419859772d 100644
--- a/test/files/run/t6662/Macro_1.scala
+++ b/test/files/run/t6662/Macro_1.scala
@@ -1,8 +1,8 @@
import language.experimental.macros
-import scala.reflect.macros.BlackboxContext
+import scala.reflect.macros.blackbox.Context
object Demo {
def id[T](a: T): T = macro idImpl[T]
- def idImpl[T: c.WeakTypeTag](c: BlackboxContext)(a: c.Expr[T]): c.Expr[T] = a
+ def idImpl[T: c.WeakTypeTag](c: Context)(a: c.Expr[T]): c.Expr[T] = a
}
diff --git a/test/files/run/t6662/Test_2.scala b/test/files/run/t6662/Test_2.scala
index 03a80b655a..82ac54cb46 100644
--- a/test/files/run/t6662/Test_2.scala
+++ b/test/files/run/t6662/Test_2.scala
@@ -2,7 +2,7 @@
object Test {
def main(args: Array[String]) {
- val s = Demo id ()
+ val s = Demo id (())
println(s)
}
}
diff --git a/test/files/run/t6863.check b/test/files/run/t6863.check
index 030cb8b265..fea22b582f 100644
--- a/test/files/run/t6863.check
+++ b/test/files/run/t6863.check
@@ -10,3 +10,4 @@ t6863.scala:46: warning: comparing values of types Unit and Unit using `==' will
t6863.scala:59: warning: comparing values of types Unit and Unit using `==' will always yield true
assert({ () => x }.apply == ())
^
+warning: there were 4 deprecation warning(s); re-run with -deprecation for details
diff --git a/test/files/run/t6935.check b/test/files/run/t6935.check
new file mode 100644
index 0000000000..844ca54682
--- /dev/null
+++ b/test/files/run/t6935.check
@@ -0,0 +1 @@
+warning: there were 1 deprecation warning(s); re-run with -deprecation for details
diff --git a/test/files/run/t6935.scala b/test/files/run/t6935.scala
index dea2d7f2e2..fdaf02e5ce 100644
--- a/test/files/run/t6935.scala
+++ b/test/files/run/t6935.scala
@@ -1,14 +1,14 @@
object Test {
def main(args: Array[String]): Unit = {
- import java.io._
- val bytes = new ByteArrayOutputStream()
- val out = new ObjectOutputStream(bytes)
- out.writeObject(())
- out.close()
- val buf = bytes.toByteArray
- val in = new ObjectInputStream(new ByteArrayInputStream(buf))
- val unit = in.readObject()
- assert(unit == ())
+ import java.io._
+ val bytes = new ByteArrayOutputStream()
+ val out = new ObjectOutputStream(bytes)
+ out.writeObject(())
+ out.close()
+ val buf = bytes.toByteArray
+ val in = new ObjectInputStream(new ByteArrayInputStream(buf))
+ val unit = in.readObject()
+ assert(unit == ())
}
}
diff --git a/test/files/run/t6992/Macros_1.scala b/test/files/run/t6992/Macros_1.scala
index 25566dddbf..d101efdda3 100644
--- a/test/files/run/t6992/Macros_1.scala
+++ b/test/files/run/t6992/Macros_1.scala
@@ -1,5 +1,5 @@
import scala.language.experimental.macros
-import scala.reflect.macros.Context
+import scala.reflect.macros.whitebox.Context
object Macros {
def foo(name: String): Any = macro foo_impl
diff --git a/test/files/run/t7008-scala-defined/Impls_Macros_2.scala b/test/files/run/t7008-scala-defined/Impls_Macros_2.scala
index 0ce5daf0d0..7049ed6490 100644
--- a/test/files/run/t7008-scala-defined/Impls_Macros_2.scala
+++ b/test/files/run/t7008-scala-defined/Impls_Macros_2.scala
@@ -1,8 +1,8 @@
import language.experimental.macros
-import scala.reflect.macros.BlackboxContext
+import scala.reflect.macros.blackbox.Context
object Macros {
- def impl(c: BlackboxContext) = {
+ def impl(c: Context) = {
import c.universe._
val decls = c.typeOf[ScalaClassWithCheckedExceptions_1[_]].declarations.toList
val s = decls.sortBy(_.name.toString).map(decl => (s"${decl.name}: ${decl.annotations}")).mkString(scala.compat.Platform.EOL)
diff --git a/test/files/run/t7008/Impls_Macros_2.scala b/test/files/run/t7008/Impls_Macros_2.scala
index 6da9dca913..9dfa66a20a 100644
--- a/test/files/run/t7008/Impls_Macros_2.scala
+++ b/test/files/run/t7008/Impls_Macros_2.scala
@@ -1,8 +1,8 @@
import language.experimental.macros
-import scala.reflect.macros.BlackboxContext
+import scala.reflect.macros.blackbox.Context
object Macros {
- def impl(c: BlackboxContext) = {
+ def impl(c: Context) = {
import c.universe._
val decls = c.typeOf[JavaClassWithCheckedExceptions_1[_]].declarations.toList
val s = decls.sortBy(_.name.toString).map(decl => (s"${decl.name}: ${decl.annotations}")).mkString(scala.compat.Platform.EOL)
diff --git a/test/files/run/t7047/Impls_Macros_1.scala b/test/files/run/t7047/Impls_Macros_1.scala
index 0d64729791..787ea6cfe8 100644
--- a/test/files/run/t7047/Impls_Macros_1.scala
+++ b/test/files/run/t7047/Impls_Macros_1.scala
@@ -1,10 +1,10 @@
-import scala.reflect.macros.BlackboxContext
+import scala.reflect.macros.blackbox.Context
import language.experimental.macros
class Foo
object Macros {
- def impl(c: BlackboxContext) = {
+ def impl(c: Context) = {
import c.universe._
try {
c.inferImplicitValue(typeOf[Foo], silent = false)
diff --git a/test/files/run/t7157/Impls_Macros_1.scala b/test/files/run/t7157/Impls_Macros_1.scala
index e48fbcaed3..cc258b016a 100644
--- a/test/files/run/t7157/Impls_Macros_1.scala
+++ b/test/files/run/t7157/Impls_Macros_1.scala
@@ -1,9 +1,9 @@
-import scala.reflect.macros.BlackboxContext
+import scala.reflect.macros.blackbox.Context
import language.experimental.macros
object Macros {
object AImpl {
- def a(ctx: BlackboxContext)(args: ctx.Expr[Any]*): ctx.Expr[Unit] = {
+ 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)))))
}
diff --git a/test/files/run/t7240/Macros_1.scala b/test/files/run/t7240/Macros_1.scala
index 84ad231043..019ddf7cd6 100644
--- a/test/files/run/t7240/Macros_1.scala
+++ b/test/files/run/t7240/Macros_1.scala
@@ -1,7 +1,7 @@
package bakery
import scala.language.experimental.macros
-import scala.reflect.macros.BlackboxContext
+import scala.reflect.macros.blackbox.Context
trait FailureCake {
implicit def liftAnyFails[T: Manifest]: Any = ???
@@ -13,7 +13,7 @@ trait FailureCake {
object Bakery {
def failure: Any = macro failureImpl
- def failureImpl(c: BlackboxContext): c.Expr[Any] = {
+ def failureImpl(c: Context): c.Expr[Any] = {
import c.universe._
def dslTrait(dslName: String) = {
diff --git a/test/files/run/t7326.scala b/test/files/run/t7326.scala
new file mode 100644
index 0000000000..ed9471ea8e
--- /dev/null
+++ b/test/files/run/t7326.scala
@@ -0,0 +1,64 @@
+import scala.collection.immutable.ListSet
+import scala.collection.immutable.HashSet
+
+object Test extends App {
+
+ def testCorrectness() {
+ // a key that has many hashCode collisions
+ case class Collision(i: Int) { override def hashCode = i / 5 }
+
+ def subsetTest[T](emptyA:Set[T], emptyB:Set[T], mkKey:Int => T, n:Int) {
+ val outside = mkKey(n + 1)
+ for(i <- 0 to n) {
+ val a = emptyA ++ (0 until i).map(mkKey)
+ // every set must be a subset of itself
+ require(a.subsetOf(a), "A set must be the subset of itself")
+ for(k <- 0 to i) {
+ // k <= i, so b is definitely a subset
+ val b = emptyB ++ (0 until k).map(mkKey)
+ // c has less elements than a, but contains a value that is not in a
+ // so it is not a subset, but that is not immediately obvious due to size
+ val c = b + outside
+ require(b.subsetOf(a), s"$b must be a subset of $a")
+ require(!c.subsetOf(a), s"$c must not be a subset of $a")
+ }
+ }
+ }
+
+ // test the HashSet/HashSet case
+ subsetTest(HashSet.empty[Int], HashSet.empty[Int], identity, 100)
+
+ // test the HashSet/other set case
+ subsetTest(HashSet.empty[Int], ListSet.empty[Int], identity, 100)
+
+ // test the HashSet/HashSet case for Collision keys
+ subsetTest(HashSet.empty[Collision], HashSet.empty[Collision], Collision, 100)
+
+ // test the HashSet/other set case for Collision keys
+ subsetTest(HashSet.empty[Collision], ListSet.empty[Collision], Collision, 100)
+ }
+
+ /**
+ * A main performance benefit of the new subsetOf is that we do not have to call hashCode during subsetOf
+ * since we already have the hash codes in the HashSet1 nodes.
+ */
+ def testNoHashCodeInvocationsDuringSubsetOf() = {
+ var count = 0
+
+ case class HashCodeCounter(i:Int) {
+ override def hashCode = {
+ count += 1
+ i
+ }
+ }
+
+ val a = HashSet.empty ++ (0 until 100).map(HashCodeCounter)
+ val b = HashSet.empty ++ (0 until 50).map(HashCodeCounter)
+ val count0 = count
+ val result = b.subsetOf(a)
+ require(count == count0, "key.hashCode must not be called during subsetOf of two HashSets")
+ result
+ }
+ testCorrectness()
+ testNoHashCodeInvocationsDuringSubsetOf()
+}
diff --git a/test/files/run/t7375b/Macros_1.scala b/test/files/run/t7375b/Macros_1.scala
index bcd8e52172..b6090e730b 100644
--- a/test/files/run/t7375b/Macros_1.scala
+++ b/test/files/run/t7375b/Macros_1.scala
@@ -1,5 +1,5 @@
import language.experimental.macros
-import scala.reflect.macros.BlackboxContext
+import scala.reflect.macros.blackbox.Context
class C1(val n: Int) extends AnyVal
class C2(val n: Int) extends AnyRef
@@ -9,7 +9,7 @@ object Macros {
type F2 = C2
def foo = macro impl
- def impl(c: BlackboxContext) = {
+ def impl(c: Context) = {
import c.universe._
def test[T: c.TypeTag] = reify(println(c.Expr[String](Literal(Constant(c.reifyRuntimeClass(c.typeOf[T]).toString))).splice)).tree
def tests = Block(List(test[C1], test[C2], test[F1], test[F2]), Literal(Constant(())))
diff --git a/test/files/run/t7617a/Macros_1.scala b/test/files/run/t7617a/Macros_1.scala
index d19f112bf4..77b18c20e2 100644
--- a/test/files/run/t7617a/Macros_1.scala
+++ b/test/files/run/t7617a/Macros_1.scala
@@ -1,12 +1,12 @@
-import scala.reflect.macros.BlackboxContext
+import scala.reflect.macros.blackbox.Context
import language.experimental.macros
object Macros {
- def getValueImpl[T](c: BlackboxContext): c.Expr[T] = {
+ def getValueImpl[T](c: Context): c.Expr[T] = {
import c.universe._
c.Expr[T](Apply(Select(c.prefix.tree, newTermName("getVal")), Nil))
}
- def setValueImpl[T](c: BlackboxContext)(value: c.Expr[T]): c.Expr[Unit] = {
+ def setValueImpl[T](c: Context)(value: c.Expr[T]): c.Expr[Unit] = {
import c.universe._
c.Expr[Unit](Apply(Select(c.prefix.tree, newTermName("setVal")), List(value.tree)))
}
diff --git a/test/files/run/t7617b/Macros_1.scala b/test/files/run/t7617b/Macros_1.scala
index b1406f30bb..90fcfda47d 100644
--- a/test/files/run/t7617b/Macros_1.scala
+++ b/test/files/run/t7617b/Macros_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.BlackboxContext
+import scala.reflect.macros.blackbox.Context
object Macros {
- def impl(c: BlackboxContext)(name: c.Expr[String])(value: c.Expr[Any]) = {
+ def impl(c: Context)(name: c.Expr[String])(value: c.Expr[Any]) = {
import c.universe._
reify(println(s"${name.splice} = ${value.splice}"))
}
diff --git a/test/files/run/t7657/Macros_1.scala b/test/files/run/t7657/Macros_1.scala
index 9aac02031d..a883f76bc3 100644
--- a/test/files/run/t7657/Macros_1.scala
+++ b/test/files/run/t7657/Macros_1.scala
@@ -1,8 +1,8 @@
-import scala.reflect.macros.BlackboxContext
+import scala.reflect.macros.blackbox.Context
import language.experimental.macros
trait T { def t(): Unit }
abstract class A extends T { override def t(): Unit = () }
-object Macro { def t(c: BlackboxContext)(): c.Expr[Unit] = c.universe.reify(()) }
+object Macro { def t(c: Context)(): c.Expr[Unit] = c.universe.reify(()) }
class C extends A { override def t(): Unit = macro Macro.t }
diff --git a/test/files/run/t7777/Macros_1.scala b/test/files/run/t7777/Macros_1.scala
index 459ab3edbb..1dc6d6740c 100644
--- a/test/files/run/t7777/Macros_1.scala
+++ b/test/files/run/t7777/Macros_1.scala
@@ -1,6 +1,6 @@
import scala.language.experimental.macros
import scala.language.dynamics
-import scala.reflect.macros.WhiteboxContext
+import scala.reflect.macros.whitebox.Context
class DynMacro extends Dynamic {
def applyDynamic(s: String)(xs: Any*): DynMacro =
@@ -8,7 +8,7 @@ class DynMacro extends Dynamic {
}
object DynMacro extends DynMacro {
- def applyDynamicMacro(c: WhiteboxContext)(s: c.Expr[String])(xs: c.Expr[Any]*): c.Expr[DynMacro] = {
+ def applyDynamicMacro(c: Context)(s: c.Expr[String])(xs: c.Expr[Any]*): c.Expr[DynMacro] = {
import c.universe._
val Literal(Constant(n: String)) = s.tree
val args = xs.map(_.tree.toString).mkString("(", ", ", ")")
diff --git a/test/files/run/t7871/Macros_1.scala b/test/files/run/t7871/Macros_1.scala
index 801a6af4e7..dca2508128 100644
--- a/test/files/run/t7871/Macros_1.scala
+++ b/test/files/run/t7871/Macros_1.scala
@@ -1,4 +1,4 @@
-import scala.reflect.macros.Context
+import scala.reflect.macros.whitebox.Context
import language.experimental.macros
trait Tree
diff --git a/test/files/run/t8015-ffc.scala b/test/files/run/t8015-ffc.scala
new file mode 100644
index 0000000000..fe6781be42
--- /dev/null
+++ b/test/files/run/t8015-ffc.scala
@@ -0,0 +1,7 @@
+
+object Test extends App {
+ val ms = """This is a long multiline string
+ with \u000d\u000a CRLF embedded."""
+ assert(ms.lines.size == 3, s"lines.size ${ms.lines.size}")
+ assert(ms contains "\r\n CRLF", "no CRLF")
+}
diff --git a/test/files/run/t8046.check b/test/files/run/t8046.check
new file mode 100644
index 0000000000..905b0b35ca
--- /dev/null
+++ b/test/files/run/t8046.check
@@ -0,0 +1,2 @@
+List(trait Op, trait Function1, class Object, class Any)
+BTS(T,Three.this.Op[Int],Int => Int,Object,Any)
diff --git a/test/files/run/t8046/Test.scala b/test/files/run/t8046/Test.scala
new file mode 100644
index 0000000000..f6b525d1b5
--- /dev/null
+++ b/test/files/run/t8046/Test.scala
@@ -0,0 +1,18 @@
+import scala.tools.partest._
+
+object Test extends DirectTest {
+ override def code = ""
+ override def extraSettings: String = "-usejavacp"
+
+ override def show() {
+ val c = newCompiler()
+ new c.Run
+ import c._
+
+ val f4 = typeOf[Three].member(newTermName("f4"))
+ val f4ParamInfo = f4.paramss.head.head.info
+ println(f4ParamInfo.baseClasses)
+ println(f4ParamInfo.baseTypeSeq)
+ }
+}
+
diff --git a/test/files/run/t8046/t8046c.scala b/test/files/run/t8046/t8046c.scala
new file mode 100644
index 0000000000..0b484da530
--- /dev/null
+++ b/test/files/run/t8046/t8046c.scala
@@ -0,0 +1,13 @@
+import language._
+
+trait One {
+ type Op[A]
+ type Alias[A] = Op[A]
+}
+
+trait Three extends One {
+ trait Op[A] extends (A => A)
+
+ def f4[T <: Alias[Int]](f: T) = 0
+}
+
diff --git a/test/files/run/t8048a/Macros_1.scala b/test/files/run/t8048a/Macros_1.scala
index f48e84f1de..d13e851d90 100644
--- a/test/files/run/t8048a/Macros_1.scala
+++ b/test/files/run/t8048a/Macros_1.scala
@@ -1,8 +1,8 @@
-import scala.reflect.macros.WhiteboxContext
+import scala.reflect.macros.whitebox.Context
import scala.language.experimental.macros
object Macros {
- def impl(c: WhiteboxContext) = {
+ def impl(c: Context) = {
import c.universe._
q"if (true) Some(2) else None"
}
diff --git a/test/files/run/t8048b/Macros_1.scala b/test/files/run/t8048b/Macros_1.scala
index b113af86ea..520a6fac06 100644
--- a/test/files/run/t8048b/Macros_1.scala
+++ b/test/files/run/t8048b/Macros_1.scala
@@ -6,10 +6,10 @@
// * https://groups.google.com/forum/#!topic/scala-internals/eXQt-BPm4i8
import scala.language.experimental.macros
-import scala.reflect.macros.WhiteboxContext
+import scala.reflect.macros.whitebox.Context
object Macros {
- def impl1(c: WhiteboxContext) = {
+ def impl1(c: Context) = {
import c.universe._
q"""
trait Foo { def x = 2 }
@@ -18,7 +18,7 @@ object Macros {
}
def foo1: Any = macro impl1
- def impl2(c: WhiteboxContext) = {
+ def impl2(c: Context) = {
import c.universe._
q"""
class Foo { def x = 2 }
@@ -27,7 +27,7 @@ object Macros {
}
def foo2: Any = macro impl2
- def impl3(c: WhiteboxContext) = {
+ def impl3(c: Context) = {
import c.universe._
q"""
new { def x = 2 }
diff --git a/test/files/run/t8100.check b/test/files/run/t8100.check
new file mode 100644
index 0000000000..cdd927fd88
--- /dev/null
+++ b/test/files/run/t8100.check
@@ -0,0 +1 @@
+Success(0)
diff --git a/test/files/run/t8100.scala b/test/files/run/t8100.scala
new file mode 100644
index 0000000000..b9d0fe5003
--- /dev/null
+++ b/test/files/run/t8100.scala
@@ -0,0 +1,8 @@
+object Test {
+ import scala.util.Try
+
+ def main(args: Array[String]): Unit = {
+ def stream = Stream.from(0).take(100000).map(n => None)
+ println(Try(stream.flatten.length))
+ }
+}
diff --git a/test/files/run/t8104/Macros_1.scala b/test/files/run/t8104/Macros_1.scala
index 21d81a3687..2ad4bc5a99 100644
--- a/test/files/run/t8104/Macros_1.scala
+++ b/test/files/run/t8104/Macros_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.WhiteboxContext
+import scala.reflect.macros.whitebox.Context
object Macros {
- def impl[T](c: WhiteboxContext)(implicit T: c.WeakTypeTag[T]) = {
+ def impl[T](c: Context)(implicit T: c.WeakTypeTag[T]) = {
import c.universe._
import definitions._
val fields = T.tpe.declarations.toList.collect{ case x: TermSymbol if x.isVal && x.isCaseAccessor => x }
diff --git a/test/files/run/t8133/A_1.scala b/test/files/run/t8133/A_1.scala
new file mode 100644
index 0000000000..a2836cdb3a
--- /dev/null
+++ b/test/files/run/t8133/A_1.scala
@@ -0,0 +1,5 @@
+// a.scala
+package object pkg {
+ class AnyOps(val x: Any) extends AnyVal
+ def AnyOps(x: Any) = new AnyOps(x)
+}
diff --git a/test/files/run/t8133/B_2.scala b/test/files/run/t8133/B_2.scala
new file mode 100644
index 0000000000..b80e10952d
--- /dev/null
+++ b/test/files/run/t8133/B_2.scala
@@ -0,0 +1,15 @@
+package pkg {
+ package object other
+ package other {
+ class Crash {
+ AnyOps(0)
+ ()
+ }
+ }
+}
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ new pkg.other.Crash
+ }
+}
diff --git a/test/files/run/t8133b/A_1.scala b/test/files/run/t8133b/A_1.scala
new file mode 100644
index 0000000000..24bbfc118d
--- /dev/null
+++ b/test/files/run/t8133b/A_1.scala
@@ -0,0 +1,4 @@
+package object pkg {
+ def foo(x: Int): String = "a"
+ def foo(x: String): String = "b"
+}
diff --git a/test/files/run/t8133b/B_2.scala b/test/files/run/t8133b/B_2.scala
new file mode 100644
index 0000000000..865ca0c0b0
--- /dev/null
+++ b/test/files/run/t8133b/B_2.scala
@@ -0,0 +1,9 @@
+// b.scala
+package pkg {
+ package object other
+ package other { class Crash { foo("") } }
+}
+
+object Test {
+ def main(args: Array[String]): Unit = new pkg.other.Crash
+}
diff --git a/test/files/run/toolbox_current_run_compiles.scala b/test/files/run/toolbox_current_run_compiles.scala
index 31e0a45eea..6ec7074643 100644
--- a/test/files/run/toolbox_current_run_compiles.scala
+++ b/test/files/run/toolbox_current_run_compiles.scala
@@ -1,9 +1,9 @@
package pkg {
- import scala.reflect.macros.BlackboxContext
+ import scala.reflect.macros.blackbox.Context
import scala.language.experimental.macros
object Macros {
- def impl[T: c.WeakTypeTag](c: BlackboxContext) = {
+ def impl[T: c.WeakTypeTag](c: Context) = {
import c.universe._
val sym = c.weakTypeOf[T].typeSymbol
val g = c.universe.asInstanceOf[scala.tools.nsc.Global]
diff --git a/test/files/run/typed-annotated/Macros_1.scala b/test/files/run/typed-annotated/Macros_1.scala
index 42478cb988..d805d82f39 100644
--- a/test/files/run/typed-annotated/Macros_1.scala
+++ b/test/files/run/typed-annotated/Macros_1.scala
@@ -1,10 +1,10 @@
-import scala.reflect.macros.BlackboxContext
+import scala.reflect.macros.blackbox.Context
import language.experimental.macros
class ann extends scala.annotation.StaticAnnotation
object Macros {
- def impl(c: BlackboxContext) = {
+ def impl(c: Context) = {
import c.universe._
// val tpt = Annotated(Apply(Select(New(Ident(newTypeName("ann"))), nme.CONSTRUCTOR), List()), Ident(newTypeName("Int")))
val tpt = Annotated(Apply(Select(New(Ident(newTypeName("ann"))), nme.CONSTRUCTOR), List()), TypeTree(weakTypeOf[Int]))