summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/reflect/macros/compiler/Errors.scala21
-rw-r--r--src/compiler/scala/reflect/macros/util/Helpers.scala7
-rw-r--r--src/compiler/scala/tools/nsc/Global.scala2
-rw-r--r--src/compiler/scala/tools/nsc/transform/patmat/Logic.scala5
-rw-r--r--src/compiler/scala/tools/nsc/transform/patmat/Solving.scala14
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Macros.scala2
-rw-r--r--src/compiler/scala/tools/reflect/quasiquotes/Quasiquotes.scala2
-rw-r--r--src/library/scala/collection/IterableLike.scala2
-rw-r--r--src/library/scala/collection/convert/Wrappers.scala9
-rw-r--r--src/library/scala/concurrent/ExecutionContext.scala2
-rw-r--r--src/reflect/scala/reflect/api/Quasiquotes.scala2
-rw-r--r--src/reflect/scala/reflect/internal/Types.scala6
-rw-r--r--src/reflect/scala/reflect/macros/ExprUtils.scala13
-rw-r--r--src/reflect/scala/reflect/macros/Parsers.scala3
-rw-r--r--src/reflect/scala/reflect/macros/TreeBuilder.scala19
-rw-r--r--src/reflect/scala/reflect/macros/Universe.scala1
-rw-r--r--src/reflect/scala/reflect/runtime/JavaMirrors.scala42
-rw-r--r--src/reflect/scala/reflect/runtime/ReflectionUtils.scala14
-rw-r--r--src/reflect/scala/reflect/runtime/SymbolLoaders.scala4
-rw-r--r--src/scaladoc/scala/tools/nsc/doc/html/resource/lib/index.js71
-rw-r--r--test/disabled/presentation/ide-bug-1000450.check0
-rw-r--r--test/disabled/presentation/ide-bug-1000545.check0
-rw-r--r--test/disabled/run/reflection-sync-subtypes.scala (renamed from test/files/run/reflection-sync-subtypes.scala)0
-rw-r--r--test/disabled/run/t4602.scala (renamed from test/files/disabled/run/t4602.scala)0
-rw-r--r--test/files/continuations-run/z1673.check0
-rw-r--r--test/files/filters3
-rw-r--r--test/files/jvm/t1116.check0
-rw-r--r--test/files/jvm/t1143.check0
-rw-r--r--test/files/jvm/t1948.check0
-rw-r--r--test/files/jvm/t2104.check0
-rw-r--r--test/files/jvm/t2570.check0
-rw-r--r--test/files/jvm/t2585.check0
-rw-r--r--test/files/jvm/t680.check0
-rw-r--r--test/files/neg/macro-basic-mamdmi.check2
-rw-r--r--test/files/neg/macro-basic-mamdmi/Impls_Macros_Test_1.scala9
-rw-r--r--test/files/neg/macro-bundle-object.check1
-rw-r--r--test/files/neg/macro-divergence-controlled/Impls_Macros_1.scala2
-rw-r--r--test/files/neg/macro-invalidimpl.check2
-rw-r--r--test/files/neg/macro-invalidimpl/Impls_1.scala3
-rw-r--r--test/files/neg/macro-invalidret.check2
-rw-r--r--test/files/neg/macro-invalidshape/Macros_Test_2.scala2
-rw-r--r--test/files/neg/macro-invalidsig-params-badtype.check1
-rw-r--r--test/files/neg/macro-invalidsig.check11
-rw-r--r--test/files/neg/macro-invalidsig/Impls_1.scala22
-rw-r--r--test/files/neg/macro-invalidusage-badbounds/Impls_1.scala2
-rw-r--r--test/files/neg/macro-invalidusage-methodvaluesyntax/Impls_1.scala3
-rw-r--r--test/files/neg/macro-invalidusage-presuper/Impls_1.scala2
-rw-r--r--test/files/neg/macro-override-method-overrides-macro/Impls_1.scala3
-rw-r--r--test/files/neg/macro-quasiquotes.check3
-rw-r--r--test/files/neg/macro-without-xmacros-a/Impls_1.scala6
-rw-r--r--test/files/neg/macro-without-xmacros-b/Impls_1.scala6
-rw-r--r--test/files/neg/t3871.check7
-rw-r--r--test/files/neg/t3871.scala11
-rw-r--r--test/files/neg/t3871b.check97
-rw-r--r--test/files/neg/t3871b.scala127
-rw-r--r--test/files/neg/t5689.check1
-rw-r--r--test/files/neg/t6123-explaintypes-macros.check1
-rwxr-xr-xtest/files/neg/t6446-additional.check2
-rwxr-xr-xtest/files/neg/t6446-missing.check2
-rw-r--r--test/files/neg/t6446-show-phases.check2
-rw-r--r--test/files/neg/t6680b.flags1
-rw-r--r--test/files/neg/t6680c.check6
-rw-r--r--test/files/neg/t6680c.flags1
-rw-r--r--test/files/neg/t7020.check (renamed from test/files/disabled/t7020.check)8
-rw-r--r--test/files/neg/t7020.flags (renamed from test/files/disabled/t7020.flags)0
-rw-r--r--test/files/neg/t7020.scala (renamed from test/files/disabled/t7020.scala)0
-rw-r--r--test/files/neg/t7157/Impls_Macros_1.scala24
-rw-r--r--test/files/neg/t7494-no-options.check2
-rw-r--r--test/files/neg/t7519-b.check6
-rw-r--r--test/files/neg/t7519-b/Mac_1.scala14
-rw-r--r--test/files/neg/t7519-b/Use_2.scala8
-rw-r--r--test/files/neg/t7694b.check7
-rw-r--r--test/files/pos/annotated-treecopy.check0
-rw-r--r--test/files/pos/annotated-treecopy/Impls_Macros_1.scala6
-rw-r--r--test/files/pos/attachments-typed-another-ident.check0
-rw-r--r--test/files/pos/attachments-typed-ident.check0
-rw-r--r--test/files/pos/macro-qmarkqmarkqmark.check0
-rw-r--r--test/files/pos/t5692a/Macros_1.scala2
-rw-r--r--test/files/pos/t5692b/Macros_1.scala2
-rw-r--r--test/files/pos/t5692c.check0
-rw-r--r--test/files/pos/t5845.check0
-rw-r--r--test/files/pos/t7461.check0
-rw-r--r--test/files/pos/t7461/Macros_1.scala2
-rw-r--r--test/files/pos/t7649.scala2
-rw-r--r--test/files/pos/t7928.scala16
-rw-r--r--test/files/pos/virtpatmat_anonfun_for.flags0
-rw-r--r--test/files/presentation/partial-fun/partial-fun.check1
-rw-r--r--test/files/run/dead-code-elimination.check0
-rw-r--r--test/files/run/exoticnames.check0
-rw-r--r--test/files/run/intmap.check0
-rw-r--r--test/files/run/longmap.check0
-rw-r--r--test/files/run/macro-bundle-repl.check4
-rw-r--r--test/files/run/macro-bundle-repl.scala4
-rw-r--r--test/files/run/macro-bundle-static/Impls_Macros_1.scala8
-rw-r--r--test/files/run/macro-bundle-toplevel/Impls_Macros_1.scala8
-rw-r--r--test/files/run/macro-divergence-spurious/Impls_Macros_1.scala2
-rw-r--r--test/files/run/macro-enclosures/Impls_Macros_1.scala17
-rw-r--r--test/files/run/macro-expand-tparams-bounds.check0
-rw-r--r--test/files/run/macro-expand-tparams-bounds/Impls_1.scala4
-rw-r--r--test/files/run/macro-expand-tparams-prefix/Impls_1.scala15
-rw-r--r--test/files/run/macro-impl-default-params/Impls_Macros_1.scala13
-rw-r--r--test/files/run/macro-impl-rename-context/Impls_Macros_1.scala5
-rw-r--r--test/files/run/macro-impl-tparam-only-in-impl/Impls_1.scala2
-rw-r--r--test/files/run/macro-openmacros/Impls_Macros_1.scala4
-rw-r--r--test/files/run/macro-reify-nested-a.check0
-rw-r--r--test/files/run/macro-reify-nested-b.check0
-rw-r--r--test/files/run/macro-reify-splice-outside-reify/Impls_Macros_1.scala4
-rw-r--r--test/files/run/macro-settings/Impls_Macros_1.scala7
-rw-r--r--test/files/run/macro-sip19-revised/Impls_Macros_1.scala3
-rw-r--r--test/files/run/macro-sip19/Impls_Macros_1.scala3
-rw-r--r--test/files/run/macro-system-properties.check2
-rw-r--r--test/files/run/macro-system-properties.scala2
-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.scala4
-rw-r--r--test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala4
-rw-r--r--test/files/run/macro-undetparams-consfromsls/Impls_Macros_1.scala18
-rw-r--r--test/files/run/macro-undetparams-macroitself/Impls_Macros_1.scala5
-rw-r--r--test/files/run/programmatic-main.check2
-rw-r--r--test/files/run/range.check0
-rw-r--r--test/files/run/reflection-fancy-java-classes.check12
-rw-r--r--test/files/run/reflection-fancy-java-classes/Foo_1.java5
-rw-r--r--test/files/run/reflection-fancy-java-classes/Test_2.scala20
-rw-r--r--test/files/run/reflection-sync-potpourri.check0
-rw-r--r--test/files/run/reflection-sync-subtypes.check0
-rw-r--r--test/files/run/reify_for1.check0
-rw-r--r--test/files/run/reify_fors_oldpatmat.flags0
-rw-r--r--test/files/run/reify_maps_oldpatmat.flags0
-rw-r--r--test/files/run/repl-term-macros.check6
-rw-r--r--test/files/run/repl-term-macros.scala6
-rw-r--r--test/files/run/t0668.check0
-rw-r--r--test/files/run/t1829.check0
-rw-r--r--test/files/run/t2594_tcpoly.check0
-rw-r--r--test/files/run/t3346b.check0
-rw-r--r--test/files/run/t3346c.check0
-rw-r--r--test/files/run/t3346d.check0
-rw-r--r--test/files/run/t5229_1.check0
-rw-r--r--test/files/run/t5271_4.check0
-rw-r--r--test/files/run/t5272_1_oldpatmat.flags0
-rw-r--r--test/files/run/t5272_2_oldpatmat.flags0
-rw-r--r--test/files/run/t5273_1_oldpatmat.flags0
-rw-r--r--test/files/run/t5273_2a_oldpatmat.flags0
-rw-r--r--test/files/run/t5273_2b_oldpatmat.flags0
-rw-r--r--test/files/run/t5415.check0
-rw-r--r--test/files/run/t5418.check0
-rw-r--r--test/files/run/t5545.check0
-rw-r--r--test/files/run/t5894.scala2
-rw-r--r--test/files/run/t5923a/Macros_1.scala2
-rw-r--r--test/files/run/t5923d.check0
-rw-r--r--test/files/run/t5940.scala4
-rw-r--r--test/files/run/t5942.check0
-rw-r--r--test/files/run/t6197.check0
-rw-r--r--test/files/run/t6198.check0
-rw-r--r--test/files/run/t6199-toolbox.scala2
-rw-r--r--test/files/run/t6240-universe-code-gen.check0
-rw-r--r--test/files/run/t6381.check6
-rw-r--r--test/files/run/t6381.scala6
-rw-r--r--test/files/run/t7008-scala-defined/Impls_Macros_2.scala3
-rw-r--r--test/files/run/t7008/Impls_Macros_2.scala3
-rw-r--r--test/files/run/t7047/Impls_Macros_1.scala2
-rw-r--r--test/files/run/t7240.check0
-rw-r--r--test/files/run/t7341.check0
-rw-r--r--test/files/run/t7375b/Macros_1.scala2
-rw-r--r--test/files/run/t7510.check0
-rw-r--r--test/files/run/t7852.check0
-rw-r--r--test/files/run/typetags_without_scala_reflect_manifest_lookup.check0
-rw-r--r--test/files/scalacheck/quasiquotes/TermConstructionProps.scala9
-rw-r--r--test/junit/scala/collection/convert/MapWrapperTest.scala49
-rw-r--r--test/pending/run/macro-term-declared-in-anonymous-explicit-import.check0
-rw-r--r--test/pending/run/virtpatmat_anonfun_underscore.check0
169 files changed, 717 insertions, 252 deletions
diff --git a/src/compiler/scala/reflect/macros/compiler/Errors.scala b/src/compiler/scala/reflect/macros/compiler/Errors.scala
index 9b56e417e2..45bb87fc47 100644
--- a/src/compiler/scala/reflect/macros/compiler/Errors.scala
+++ b/src/compiler/scala/reflect/macros/compiler/Errors.scala
@@ -44,14 +44,18 @@ trait Errors extends Traces {
message + suffix
}
- private def abbreviateCoreAliases(s: String): String = List("WeakTypeTag", "Expr").foldLeft(s)((res, x) => res.replace("c.universe." + x, "c." + x))
+ private def abbreviateCoreAliases(s: String): String = {
+ val coreAliases = List("WeakTypeTag", "Expr", "Tree")
+ coreAliases.foldLeft(s)((res, x) => res.replace("c.universe." + x, "c." + x))
+ }
- private def showMeth(pss: List[List[Symbol]], restpe: Type, abbreviate: Boolean) = {
- var argsPart = (pss map (ps => ps map (_.defString) mkString ("(", ", ", ")"))).mkString
- if (abbreviate) argsPart = abbreviateCoreAliases(argsPart)
- var retPart = restpe.toString
+ private def showMeth(pss: List[List[Symbol]], restpe: Type, abbreviate: Boolean, untype: Boolean) = {
+ def preprocess(tpe: Type) = if (untype) untypeMetalevel(tpe) else tpe
+ var pssPart = (pss map (ps => ps map (p => p.defStringSeenAs(preprocess(p.info))) mkString ("(", ", ", ")"))).mkString
+ if (abbreviate) pssPart = abbreviateCoreAliases(pssPart)
+ var retPart = preprocess(restpe).toString
if (abbreviate || macroDdef.tpt.tpe == null) retPart = abbreviateCoreAliases(retPart)
- argsPart + ": " + retPart
+ pssPart + ": " + retPart
}
// not exactly an error generator, but very related
@@ -86,8 +90,9 @@ trait Errors extends Traces {
private def compatibilityError(message: String) =
implRefError(
"macro implementation has wrong shape:"+
- "\n required: " + showMeth(rparamss, rret, abbreviate = true) +
- "\n found : " + showMeth(aparamss, aret, abbreviate = false) +
+ "\n required: " + showMeth(rparamss, rret, abbreviate = true, untype = false) +
+ "\n or : " + showMeth(rparamss, rret, abbreviate = true, untype = true) +
+ "\n found : " + showMeth(aparamss, aret, abbreviate = false, untype = false) +
"\n" + message)
def MacroImplNonTagImplicitParameters(params: List[Symbol]) = compatibilityError("macro implementations cannot have implicit parameters other than WeakTypeTag evidences")
diff --git a/src/compiler/scala/reflect/macros/util/Helpers.scala b/src/compiler/scala/reflect/macros/util/Helpers.scala
index f40c6bb7e6..dd23b0fc32 100644
--- a/src/compiler/scala/reflect/macros/util/Helpers.scala
+++ b/src/compiler/scala/reflect/macros/util/Helpers.scala
@@ -55,6 +55,13 @@ trait Helpers {
case tp => typeRef(pre, MacroContextExprClass, List(tp))
}
+ /** Transforms c.Expr[T] types into c.Tree and leaves the rest unchanged.
+ */
+ def untypeMetalevel(tp: Type): Type = transparentShallowTransform(RepeatedParamClass, tp) {
+ case ExprClassOf(_) => typeRef(tp.prefix, TreesTreeType, Nil)
+ case tp => tp
+ }
+
/** Decreases metalevel of the type, i.e. transforms:
* * c.Expr[T] to T
* * Anything else to Any
diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala
index 1c5354502b..e765c9165a 100644
--- a/src/compiler/scala/tools/nsc/Global.scala
+++ b/src/compiler/scala/tools/nsc/Global.scala
@@ -688,7 +688,7 @@ class Global(var currentSettings: Settings, var reporter: Reporter)
uncurry -> "uncurry, translate function values to anonymous classes",
tailCalls -> "replace tail calls by jumps",
specializeTypes -> "@specialized-driven class and method specialization",
- explicitOuter -> "this refs to outer pointers, translate patterns",
+ explicitOuter -> "this refs to outer pointers",
erasure -> "erase types, add interfaces for traits",
postErasure -> "clean up erased inline classes",
lazyVals -> "allocate bitmaps, translate lazy vals into lazified defs",
diff --git a/src/compiler/scala/tools/nsc/transform/patmat/Logic.scala b/src/compiler/scala/tools/nsc/transform/patmat/Logic.scala
index f7b194a6ca..8a4e565ced 100644
--- a/src/compiler/scala/tools/nsc/transform/patmat/Logic.scala
+++ b/src/compiler/scala/tools/nsc/transform/patmat/Logic.scala
@@ -113,7 +113,7 @@ trait Logic extends Debugging {
// symbols are propositions
abstract case class Sym(variable: Var, const: Const) extends Prop {
- private[this] val id = Sym.nextSymId
+ private val id: Int = Sym.nextSymId
override def toString = variable +"="+ const +"#"+ id
}
@@ -125,6 +125,7 @@ trait Logic extends Debugging {
(uniques findEntryOrUpdate newSym)
}
private def nextSymId = {_symId += 1; _symId}; private var _symId = 0
+ implicit val SymOrdering: Ordering[Sym] = Ordering.by(_.id)
}
def /\(props: Iterable[Prop]) = if (props.isEmpty) True else props.reduceLeft(And(_, _))
@@ -279,7 +280,7 @@ trait Logic extends Debugging {
def eqFreePropToSolvable(p: Prop): Formula
def cnfString(f: Formula): String
- type Model = Map[Sym, Boolean]
+ type Model = collection.immutable.SortedMap[Sym, Boolean]
val EmptyModel: Model
val NoModel: Model
diff --git a/src/compiler/scala/tools/nsc/transform/patmat/Solving.scala b/src/compiler/scala/tools/nsc/transform/patmat/Solving.scala
index 6267585ea8..1902606d86 100644
--- a/src/compiler/scala/tools/nsc/transform/patmat/Solving.scala
+++ b/src/compiler/scala/tools/nsc/transform/patmat/Solving.scala
@@ -26,9 +26,12 @@ trait Solving extends Logic {
type Formula = FormulaBuilder
def formula(c: Clause*): Formula = ArrayBuffer(c: _*)
- type Clause = Set[Lit]
+ type Clause = collection.Set[Lit]
// a clause is a disjunction of distinct literals
- def clause(l: Lit*): Clause = l.toSet
+ def clause(l: Lit*): Clause = (
+ // neg/t7020.scala changes output 1% of the time, the non-determinism is quelled with this linked set
+ mutable.LinkedHashSet(l: _*)
+ )
type Lit
def Lit(sym: Sym, pos: Boolean = true): Lit
@@ -134,7 +137,7 @@ trait Solving extends Logic {
def cnfString(f: Formula) = alignAcrossRows(f map (_.toList) toList, "\\/", " /\\\n")
// adapted from http://lara.epfl.ch/w/sav10:simple_sat_solver (original by Hossein Hojjat)
- val EmptyModel = Map.empty[Sym, Boolean]
+ val EmptyModel = collection.immutable.SortedMap.empty[Sym, Boolean]
val NoModel: Model = null
// returns all solutions, if any (TODO: better infinite recursion backstop -- detect fixpoint??)
@@ -229,9 +232,8 @@ trait Solving extends Logic {
}
}
- if (Statistics.canEnable) Statistics.stopTimer(patmatAnaDPLL, start)
-
- satisfiableWithModel
+ if (Statistics.canEnable) Statistics.stopTimer(patmatAnaDPLL, start)
+ satisfiableWithModel
}
}
}
diff --git a/src/compiler/scala/tools/nsc/typechecker/Macros.scala b/src/compiler/scala/tools/nsc/typechecker/Macros.scala
index 4765c301dd..d1045757a5 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Macros.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Macros.scala
@@ -111,7 +111,7 @@ trait Macros extends FastTrack with MacroRuntimes with Traces with Helpers {
* with synthetic content that carries the payload described in `MacroImplBinding`.
*
* For example, for a pair of macro definition and macro implementation:
- * def impl(c: scala.reflect.macros.Context): c.Expr[Unit] = c.literalUnit;
+ * def impl(c: scala.reflect.macros.Context): c.Expr[Unit] = ???
* def foo: Unit = macro impl
*
* We will have the following annotation added on the macro definition `foo`:
diff --git a/src/compiler/scala/tools/reflect/quasiquotes/Quasiquotes.scala b/src/compiler/scala/tools/reflect/quasiquotes/Quasiquotes.scala
index 9e98dcbc8b..f4d6b39d02 100644
--- a/src/compiler/scala/tools/reflect/quasiquotes/Quasiquotes.scala
+++ b/src/compiler/scala/tools/reflect/quasiquotes/Quasiquotes.scala
@@ -15,7 +15,7 @@ abstract class Quasiquotes extends Parsers
if (settings.Yquasiquotedebug.value) println(msg)
lazy val (universe: Tree, args, parts, parse, reify, method) = c.macroApplication match {
- case Apply(Select(Select(Apply(Select(universe0, _), List(Apply(_, parts0))), interpolator0), method0), args0) =>
+ case Apply(build.SyntacticTypeApplied(Select(Select(Apply(Select(universe0, _), List(Apply(_, parts0))), interpolator0), method0), _), args0) =>
debug(s"\nparse prefix:\nuniverse=$universe0\nparts=$parts0\ninterpolator=$interpolator0\nmethod=$method0\nargs=$args0\n")
val parts1 = parts0.map {
case lit @ Literal(Constant(s: String)) => s -> lit.pos
diff --git a/src/library/scala/collection/IterableLike.scala b/src/library/scala/collection/IterableLike.scala
index f79b5afce9..a621572061 100644
--- a/src/library/scala/collection/IterableLike.scala
+++ b/src/library/scala/collection/IterableLike.scala
@@ -152,7 +152,7 @@ self =>
*
* @param size the number of elements per group
* @return An iterator producing ${coll}s of size `size`, except the
- * last will be truncated if the elements don't divide evenly.
+ * last will be less than size `size` if the elements don't divide evenly.
*/
def grouped(size: Int): Iterator[Repr] =
for (xs <- iterator grouped size) yield {
diff --git a/src/library/scala/collection/convert/Wrappers.scala b/src/library/scala/collection/convert/Wrappers.scala
index 4410ddc7d8..56f1802509 100644
--- a/src/library/scala/collection/convert/Wrappers.scala
+++ b/src/library/scala/collection/convert/Wrappers.scala
@@ -212,6 +212,15 @@ private[collection] trait Wrappers {
}
}
}
+
+ override def containsKey(key: AnyRef): Boolean = try {
+ // Note: Subclass of collection.Map with specific key type may redirect generic
+ // contains to specific contains, which will throw a ClassCastException if the
+ // wrong type is passed. This is why we need a type cast to A inside a try/catch.
+ underlying.contains(key.asInstanceOf[A])
+ } catch {
+ case ex: ClassCastException => false
+ }
}
case class MutableMapWrapper[A, B](underlying: mutable.Map[A, B]) extends MapWrapper[A, B](underlying) {
diff --git a/src/library/scala/concurrent/ExecutionContext.scala b/src/library/scala/concurrent/ExecutionContext.scala
index fa264e5d7f..d3c5a6b019 100644
--- a/src/library/scala/concurrent/ExecutionContext.scala
+++ b/src/library/scala/concurrent/ExecutionContext.scala
@@ -16,7 +16,7 @@ import scala.util.Try
/**
* An `ExecutionContext` is an abstraction over an entity that can execute program logic.
*/
-@implicitNotFound("Cannot find an implicit ExecutionContext, either require one yourself or import ExecutionContext.Implicits.global")
+@implicitNotFound("Cannot find an implicit ExecutionContext, either import scala.concurrent.ExecutionContext.Implicits.global or use a custom one")
trait ExecutionContext {
/** Runs a block of code on this execution context.
diff --git a/src/reflect/scala/reflect/api/Quasiquotes.scala b/src/reflect/scala/reflect/api/Quasiquotes.scala
index 8e993af382..3687ccba63 100644
--- a/src/reflect/scala/reflect/api/Quasiquotes.scala
+++ b/src/reflect/scala/reflect/api/Quasiquotes.scala
@@ -7,7 +7,7 @@ trait Quasiquotes { self: Universe =>
// using the mechanism implemented in `scala.tools.reflect.FastTrack`
implicit class Quasiquote(ctx: StringContext) {
protected trait api {
- def apply(args: Any*): Any = macro ???
+ def apply[T](args: T*): Any = macro ???
def unapply(scrutinee: Any): Any = macro ???
}
object q extends api
diff --git a/src/reflect/scala/reflect/internal/Types.scala b/src/reflect/scala/reflect/internal/Types.scala
index 204a2e7088..59d1e13142 100644
--- a/src/reflect/scala/reflect/internal/Types.scala
+++ b/src/reflect/scala/reflect/internal/Types.scala
@@ -3385,7 +3385,11 @@ trait Types
/** Rebind symbol `sym` to an overriding member in type `pre`. */
private def rebind(pre: Type, sym: Symbol): Symbol = {
if (!sym.isOverridableMember || sym.owner == pre.typeSymbol) sym
- else pre.nonPrivateMember(sym.name).suchThat(sym => sym.isType || (sym.isStable && !sym.hasVolatileType)) orElse sym
+ else pre.nonPrivateMember(sym.name).suchThat(sym =>
+ // SI-7928 `isModuleNotMethod` is here to avoid crashing with overloaded module accessor and module symbols
+ // after refchecks eliminates a ModuleDef that implements and interface.
+ sym.isType || (!sym.isModuleNotMethod && sym.isStable && !sym.hasVolatileType)
+ ) orElse sym
}
/** Convert a `super` prefix to a this-type if `sym` is abstract or final. */
diff --git a/src/reflect/scala/reflect/macros/ExprUtils.scala b/src/reflect/scala/reflect/macros/ExprUtils.scala
index af11bd6efc..76a8392b9c 100644
--- a/src/reflect/scala/reflect/macros/ExprUtils.scala
+++ b/src/reflect/scala/reflect/macros/ExprUtils.scala
@@ -12,41 +12,54 @@ trait ExprUtils {
self: Context =>
/** Shorthand for `Literal(Constant(null))` in the underlying `universe`. */
+ @deprecated("Use quasiquotes instead", "2.11.0")
def literalNull: Expr[Null]
/** Shorthand for `Literal(Constant(()))` in the underlying `universe`. */
+ @deprecated("Use quasiquotes instead", "2.11.0")
def literalUnit: Expr[Unit]
/** Shorthand for `Literal(Constant(true))` in the underlying `universe`. */
+ @deprecated("Use quasiquotes instead", "2.11.0")
def literalTrue: Expr[Boolean]
/** Shorthand for `Literal(Constant(false))` in the underlying `universe`. */
+ @deprecated("Use quasiquotes instead", "2.11.0")
def literalFalse: Expr[Boolean]
/** Shorthand for `Literal(Constant(x: Boolean))` in the underlying `universe`. */
+ @deprecated("Use quasiquotes instead", "2.11.0")
def literal(x: Boolean): Expr[Boolean]
/** Shorthand for `Literal(Constant(x: Byte))` in the underlying `universe`. */
+ @deprecated("Use quasiquotes instead", "2.11.0")
def literal(x: Byte): Expr[Byte]
/** Shorthand for `Literal(Constant(x: Short))` in the underlying `universe`. */
+ @deprecated("Use quasiquotes instead", "2.11.0")
def literal(x: Short): Expr[Short]
/** Shorthand for `Literal(Constant(x: Int))` in the underlying `universe`. */
+ @deprecated("Use quasiquotes instead", "2.11.0")
def literal(x: Int): Expr[Int]
/** Shorthand for `Literal(Constant(x: Long))` in the underlying `universe`. */
+ @deprecated("Use quasiquotes instead", "2.11.0")
def literal(x: Long): Expr[Long]
/** Shorthand for `Literal(Constant(x: Float))` in the underlying `universe`. */
+ @deprecated("Use quasiquotes instead", "2.11.0")
def literal(x: Float): Expr[Float]
/** Shorthand for `Literal(Constant(x: Double))` in the underlying `universe`. */
+ @deprecated("Use quasiquotes instead", "2.11.0")
def literal(x: Double): Expr[Double]
/** Shorthand for `Literal(Constant(x: String))` in the underlying `universe`. */
+ @deprecated("Use quasiquotes instead", "2.11.0")
def literal(x: String): Expr[String]
/** Shorthand for `Literal(Constant(x: Char))` in the underlying `universe`. */
+ @deprecated("Use quasiquotes instead", "2.11.0")
def literal(x: Char): Expr[Char]
}
diff --git a/src/reflect/scala/reflect/macros/Parsers.scala b/src/reflect/scala/reflect/macros/Parsers.scala
index 3b25309614..4232b05f8c 100644
--- a/src/reflect/scala/reflect/macros/Parsers.scala
+++ b/src/reflect/scala/reflect/macros/Parsers.scala
@@ -8,6 +8,7 @@ package macros
* A slice of [[scala.reflect.macros.Context the Scala macros context]] that
* exposes functions to parse strings with Scala code into trees.
*/
+@deprecated("Use quasiquotes instead", "2.11.0")
trait Parsers {
self: Context =>
@@ -15,9 +16,11 @@ trait Parsers {
* Only works for expressions, i.e. parsing a package declaration will fail.
* @throws [[scala.reflect.macros.ParseException]]
*/
+ @deprecated("Use quasiquotes instead", "2.11.0")
def parse(code: String): Tree
}
/** Indicates an error during [[scala.reflect.macros.Parsers#parse]].
*/
+ @deprecated("Use quasiquotes instead", "2.11.0")
case class ParseException(pos: scala.reflect.api.Position, msg: String) extends Exception(msg)
diff --git a/src/reflect/scala/reflect/macros/TreeBuilder.scala b/src/reflect/scala/reflect/macros/TreeBuilder.scala
index 427b4f70d1..7f57274347 100644
--- a/src/reflect/scala/reflect/macros/TreeBuilder.scala
+++ b/src/reflect/scala/reflect/macros/TreeBuilder.scala
@@ -8,6 +8,7 @@ package macros
* A helper available in [[scala.reflect.macros.Universe]] that defines shorthands for the
* most common tree-creating functions.
*/
+@deprecated("Use quasiquotes instead", "2.11.0")
abstract class TreeBuilder {
val global: Universe
@@ -17,6 +18,7 @@ abstract class TreeBuilder {
* The type must be suitable for this. For example, it
* must not be a TypeRef pointing to an abstract type variable.
*/
+ @deprecated("Use quasiquotes instead", "2.11.0")
def mkAttributedQualifier(tpe: Type): Tree
/** Builds a reference to value whose type is given stable prefix.
@@ -25,27 +27,35 @@ abstract class TreeBuilder {
* termSym as the Ident's symbol. In that case, termSym must
* not be NoSymbol.
*/
+ @deprecated("Use quasiquotes instead", "2.11.0")
def mkAttributedQualifier(tpe: Type, termSym: Symbol): Tree
/** Builds a typed reference to given symbol with given stable prefix. */
+ @deprecated("Use quasiquotes instead", "2.11.0")
def mkAttributedRef(pre: Type, sym: Symbol): RefTree
/** Builds a typed reference to given symbol. */
+ @deprecated("Use quasiquotes instead", "2.11.0")
def mkAttributedRef(sym: Symbol): RefTree
/** Builds an untyped reference to given symbol. Requires the symbol to be static. */
+ @deprecated("Use quasiquotes instead", "2.11.0")
def mkUnattributedRef(sym: Symbol): RefTree
/** Builds an untyped reference to symbol with given name. Requires the symbol to be static. */
+ @deprecated("Use quasiquotes instead", "2.11.0")
def mkUnattributedRef(fullName: Name): RefTree
/** Builds a typed This reference to given symbol. */
+ @deprecated("Use quasiquotes instead", "2.11.0")
def mkAttributedThis(sym: Symbol): This
/** Builds a typed Ident with an underlying symbol. */
+ @deprecated("Use quasiquotes instead", "2.11.0")
def mkAttributedIdent(sym: Symbol): RefTree
/** Builds a typed Select with an underlying symbol. */
+ @deprecated("Use quasiquotes instead", "2.11.0")
def mkAttributedSelect(qual: Tree, sym: Symbol): RefTree
/** A creator for method calls, e.g. fn[T1, T2, ...](v1, v2, ...)
@@ -57,22 +67,31 @@ abstract class TreeBuilder {
* @param args value arguments
* @return the newly created trees.
*/
+ @deprecated("Use quasiquotes instead", "2.11.0")
def mkMethodCall(receiver: Symbol, methodName: Name, targs: List[Type], args: List[Tree]): Tree
+ @deprecated("Use quasiquotes instead", "2.11.0")
def mkMethodCall(method: Symbol, targs: List[Type], args: List[Tree]): Tree
+ @deprecated("Use quasiquotes instead", "2.11.0")
def mkMethodCall(method: Symbol, args: List[Tree]): Tree
+ @deprecated("Use quasiquotes instead", "2.11.0")
def mkMethodCall(target: Tree, args: List[Tree]): Tree
+ @deprecated("Use quasiquotes instead", "2.11.0")
def mkMethodCall(receiver: Symbol, methodName: Name, args: List[Tree]): Tree
+ @deprecated("Use quasiquotes instead", "2.11.0")
def mkMethodCall(receiver: Tree, method: Symbol, targs: List[Type], args: List[Tree]): Tree
+ @deprecated("Use quasiquotes instead", "2.11.0")
def mkMethodCall(target: Tree, targs: List[Type], args: List[Tree]): Tree
+ @deprecated("Use quasiquotes instead", "2.11.0")
def mkNullaryCall(method: Symbol, targs: List[Type]): Tree
/** A tree that refers to the runtime reflexive universe, `scala.reflect.runtime.universe`. */
+ @deprecated("Use quasiquotes instead", "2.11.0")
def mkRuntimeUniverseRef: Tree
}
diff --git a/src/reflect/scala/reflect/macros/Universe.scala b/src/reflect/scala/reflect/macros/Universe.scala
index d1d90f53c9..297bac2999 100644
--- a/src/reflect/scala/reflect/macros/Universe.scala
+++ b/src/reflect/scala/reflect/macros/Universe.scala
@@ -20,6 +20,7 @@ abstract class Universe extends scala.reflect.api.Universe {
/** A factory that encapsulates common tree-building functions.
* @group Macros
*/
+ @deprecated("Use quasiquotes instead", "2.11.0")
val treeBuild: TreeBuilder { val global: Universe.this.type }
/** The API of reflection artifacts that support [[scala.reflect.macros.Attachments]].
diff --git a/src/reflect/scala/reflect/runtime/JavaMirrors.scala b/src/reflect/scala/reflect/runtime/JavaMirrors.scala
index 1e2dd6b7d3..8e822ca4f0 100644
--- a/src/reflect/scala/reflect/runtime/JavaMirrors.scala
+++ b/src/reflect/scala/reflect/runtime/JavaMirrors.scala
@@ -18,7 +18,7 @@ import internal.pickling.ByteCodecs
import internal.pickling.UnPickler
import scala.collection.mutable.{ HashMap, ListBuffer }
import internal.Flags._
-import ReflectionUtils.{staticSingletonInstance, innerSingletonInstance, scalacShouldntLoadClass}
+import ReflectionUtils._
import scala.language.existentials
import scala.runtime.{ScalaRunTime, BoxesRunTime}
@@ -777,33 +777,19 @@ private[reflect] trait JavaMirrors extends internal.SymbolTable with api.JavaUni
/**
* The Scala owner of the Scala class corresponding to the Java class `jclazz`
*/
- private def sOwner(jclazz: jClass[_]): Symbol =
- if (jclazz.isMemberClass) {
- val jEnclosingClass = jclazz.getEnclosingClass
- val sEnclosingClass = classToScala(jEnclosingClass)
- followStatic(sEnclosingClass, jclazz.javaFlags)
- } else if (jclazz.isLocalClass0) {
- val jEnclosingMethod = jclazz.getEnclosingMethod
- if (jEnclosingMethod != null) {
- methodToScala(jEnclosingMethod)
- } else {
- val jEnclosingConstructor = jclazz.getEnclosingConstructor
- constructorToScala(jEnclosingConstructor)
- }
- } else if (jclazz.isPrimitive || jclazz.isArray) {
- ScalaPackageClass
- } else if (jclazz.getPackage != null) {
- val jPackage = jclazz.getPackage
- packageToScala(jPackage).moduleClass
- } else {
- // @eb: a weird classloader might return a null package for something with a non-empty package name
- // for example, http://groups.google.com/group/scala-internals/browse_thread/thread/7be09ff8f67a1e5c
- // in that case we could invoke packageNameToScala(jPackageName) and, probably, be okay
- // however, I think, it's better to blow up, since weirdness of the class loader might bite us elsewhere
- // [martin] I think it's better to be forgiving here. Restoring packageNameToScala.
- val jPackageName = jclazz.getName take jclazz.getName.lastIndexOf('.')
- packageNameToScala(jPackageName).moduleClass
- }
+ // @eb: a weird classloader might return a null package for something with a non-empty package name
+ // for example, http://groups.google.com/group/scala-internals/browse_thread/thread/7be09ff8f67a1e5c
+ // in that case we could invoke packageNameToScala(jPackageName) and, probably, be okay
+ // however, I think, it's better to blow up, since weirdness of the class loader might bite us elsewhere
+ // [martin] I think it's better to be forgiving here. Restoring packageNameToScala.
+ private def sOwner(jclazz: jClass[_]): Symbol = jclazz match {
+ case PrimitiveOrArray() => ScalaPackageClass
+ case EnclosedInMethod(jowner) => methodToScala(jowner)
+ case EnclosedInConstructor(jowner) => constructorToScala(jowner)
+ case EnclosedInClass(jowner) => followStatic(classToScala(jowner), jclazz.javaFlags)
+ case EnclosedInPackage(jowner) => packageToScala(jowner).moduleClass
+ case _ => packageNameToScala(jclazz.getName take jclazz.getName.lastIndexOf('.')).moduleClass
+ }
/**
* The Scala owner of the Scala symbol corresponding to the Java member `jmember`
diff --git a/src/reflect/scala/reflect/runtime/ReflectionUtils.scala b/src/reflect/scala/reflect/runtime/ReflectionUtils.scala
index 710ec02acd..813c0e1386 100644
--- a/src/reflect/scala/reflect/runtime/ReflectionUtils.scala
+++ b/src/reflect/scala/reflect/runtime/ReflectionUtils.scala
@@ -84,4 +84,18 @@ private[scala] object ReflectionUtils {
def scalacShouldntLoadClassfile(fileName: String) = isTraitImplementation(fileName)
def scalacShouldntLoadClass(name: scala.reflect.internal.SymbolTable#Name) = scalacShouldntLoadClassfile(name + ".class")
+
+ object PrimitiveOrArray {
+ def unapply(jclazz: jClass[_]) = jclazz.isPrimitive || jclazz.isArray
+ }
+
+ class EnclosedIn[T](enclosure: jClass[_] => T) {
+ def unapply(jclazz: jClass[_]): Option[T] = if (enclosure(jclazz) != null) Some(enclosure(jclazz)) else None
+ }
+
+ object EnclosedInMethod extends EnclosedIn(_.getEnclosingMethod)
+ object EnclosedInConstructor extends EnclosedIn(_.getEnclosingConstructor)
+ object EnclosedInClass extends EnclosedIn(_.getEnclosingClass)
+ object EnclosedInPackage extends EnclosedIn(_.getPackage)
}
+
diff --git a/src/reflect/scala/reflect/runtime/SymbolLoaders.scala b/src/reflect/scala/reflect/runtime/SymbolLoaders.scala
index c6059ac402..30a3855d70 100644
--- a/src/reflect/scala/reflect/runtime/SymbolLoaders.scala
+++ b/src/reflect/scala/reflect/runtime/SymbolLoaders.scala
@@ -97,9 +97,7 @@ private[reflect] trait SymbolLoaders { self: SymbolTable =>
if (isCompilerUniverse) super.enter(sym)
else {
val existing = super.lookupEntry(sym.name)
- // commented out to provide a hotfix for strange class files that javac sometimes emits
- // see more details at: https://groups.google.com/forum/#!topic/scala-internals/hcnUFk75MgQ
- // assert(existing == null || existing.sym.isMethod, s"pkgClass = $pkgClass, sym = $sym, existing = $existing")
+ assert(existing == null || existing.sym.isMethod, s"pkgClass = $pkgClass, sym = $sym, existing = $existing")
super.enter(sym)
}
}
diff --git a/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/index.js b/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/index.js
index 96689ae701..c201b324e7 100644
--- a/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/index.js
+++ b/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/index.js
@@ -383,51 +383,56 @@ function compilePattern(query) {
// Filters all focused templates and packages. This function should be made less-blocking.
// @param query The string of the query
function textFilter() {
- scheduler.clear("filter");
-
- $('#tpl').html('');
-
var query = $("#textfilter input").attr("value") || '';
var queryRegExp = compilePattern(query);
- var index = 0;
+ if ((typeof textFilter.lastQuery === "undefined") || (textFilter.lastQuery !== query)) {
+
+ textFilter.lastQuery = query;
- var searchLoop = function () {
- var packages = Index.keys(Index.PACKAGES).sort();
+ scheduler.clear("filter");
- while (packages[index]) {
- var pack = packages[index];
- var children = Index.PACKAGES[pack];
- index++;
+ $('#tpl').html('');
- if (focusFilterState) {
- if (pack == focusFilterState ||
- pack.indexOf(focusFilterState + '.') == 0) {
- ;
- } else {
- continue;
+ var index = 0;
+
+ var searchLoop = function () {
+ var packages = Index.keys(Index.PACKAGES).sort();
+
+ while (packages[index]) {
+ var pack = packages[index];
+ var children = Index.PACKAGES[pack];
+ index++;
+
+ if (focusFilterState) {
+ if (pack == focusFilterState ||
+ pack.indexOf(focusFilterState + '.') == 0) {
+ ;
+ } else {
+ continue;
+ }
}
- }
- var matched = $.grep(children, function (child, i) {
- return queryRegExp.test(child.name);
- });
+ var matched = $.grep(children, function (child, i) {
+ return queryRegExp.test(child.name);
+ });
- if (matched.length > 0) {
- $('#tpl').append(Index.createPackageTree(pack, matched,
- focusFilterState));
- scheduler.add('filter', searchLoop);
- return;
+ if (matched.length > 0) {
+ $('#tpl').append(Index.createPackageTree(pack, matched,
+ focusFilterState));
+ scheduler.add('filter', searchLoop);
+ return;
+ }
}
- }
- $('#tpl a.packfocus').click(function () {
- focusFilter($(this).parent().parent());
- });
- configureHideFilter();
- };
+ $('#tpl a.packfocus').click(function () {
+ focusFilter($(this).parent().parent());
+ });
+ configureHideFilter();
+ };
- scheduler.add('filter', searchLoop);
+ scheduler.add('filter', searchLoop);
+ }
}
/* Configures the hide tool by adding the hide link to all packages. */
diff --git a/test/disabled/presentation/ide-bug-1000450.check b/test/disabled/presentation/ide-bug-1000450.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/disabled/presentation/ide-bug-1000450.check
+++ /dev/null
diff --git a/test/disabled/presentation/ide-bug-1000545.check b/test/disabled/presentation/ide-bug-1000545.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/disabled/presentation/ide-bug-1000545.check
+++ /dev/null
diff --git a/test/files/run/reflection-sync-subtypes.scala b/test/disabled/run/reflection-sync-subtypes.scala
index 7f75a464ac..7f75a464ac 100644
--- a/test/files/run/reflection-sync-subtypes.scala
+++ b/test/disabled/run/reflection-sync-subtypes.scala
diff --git a/test/files/disabled/run/t4602.scala b/test/disabled/run/t4602.scala
index 655c350497..655c350497 100644
--- a/test/files/disabled/run/t4602.scala
+++ b/test/disabled/run/t4602.scala
diff --git a/test/files/continuations-run/z1673.check b/test/files/continuations-run/z1673.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/continuations-run/z1673.check
+++ /dev/null
diff --git a/test/files/filters b/test/files/filters
index 9a9b439784..70d7dcff70 100644
--- a/test/files/filters
+++ b/test/files/filters
@@ -1,3 +1,6 @@
#
#Java HotSpot(TM) 64-Bit Server VM warning: Failed to reserve shared memory (errno = 28).
Java HotSpot\(TM\) .* warning:
+# Hotspot receiving VM options through the $_JAVA_OPTIONS
+# env variable outputs them on stderr
+Picked up _JAVA_OPTIONS:
diff --git a/test/files/jvm/t1116.check b/test/files/jvm/t1116.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/jvm/t1116.check
+++ /dev/null
diff --git a/test/files/jvm/t1143.check b/test/files/jvm/t1143.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/jvm/t1143.check
+++ /dev/null
diff --git a/test/files/jvm/t1948.check b/test/files/jvm/t1948.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/jvm/t1948.check
+++ /dev/null
diff --git a/test/files/jvm/t2104.check b/test/files/jvm/t2104.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/jvm/t2104.check
+++ /dev/null
diff --git a/test/files/jvm/t2570.check b/test/files/jvm/t2570.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/jvm/t2570.check
+++ /dev/null
diff --git a/test/files/jvm/t2585.check b/test/files/jvm/t2585.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/jvm/t2585.check
+++ /dev/null
diff --git a/test/files/jvm/t680.check b/test/files/jvm/t680.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/jvm/t680.check
+++ /dev/null
diff --git a/test/files/neg/macro-basic-mamdmi.check b/test/files/neg/macro-basic-mamdmi.check
index 9328fbd51c..61df5131cc 100644
--- a/test/files/neg/macro-basic-mamdmi.check
+++ b/test/files/neg/macro-basic-mamdmi.check
@@ -1,4 +1,4 @@
-Impls_Macros_Test_1.scala:36: error: macro implementation not found: quux
+Impls_Macros_Test_1.scala:33: error: macro implementation not found: quux
(the most common reason for that is that you cannot use macro implementations in the same compilation run that defines them)
println(foo(2) + Macros.bar(2) * new Macros().quux(4))
^
diff --git a/test/files/neg/macro-basic-mamdmi/Impls_Macros_Test_1.scala b/test/files/neg/macro-basic-mamdmi/Impls_Macros_Test_1.scala
index f9e0ca5077..97780ef503 100644
--- a/test/files/neg/macro-basic-mamdmi/Impls_Macros_Test_1.scala
+++ b/test/files/neg/macro-basic-mamdmi/Impls_Macros_Test_1.scala
@@ -3,20 +3,17 @@ import scala.reflect.macros.{Context => Ctx}
object Impls {
def foo(c: Ctx)(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)
+ c.Expr[Int](q"$x + 1")
}
def bar(c: Ctx)(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)
+ c.Expr[Int](q"$x + 2")
}
def quux(c: Ctx)(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)
+ c.Expr[Int](q"$x + 3")
}
}
diff --git a/test/files/neg/macro-bundle-object.check b/test/files/neg/macro-bundle-object.check
index e122001427..8c19271b51 100644
--- a/test/files/neg/macro-bundle-object.check
+++ b/test/files/neg/macro-bundle-object.check
@@ -1,5 +1,6 @@
macro-bundle-object.scala:11: error: macro implementation has wrong shape:
required: (c: scala.reflect.macros.Context): c.Expr[Any]
+ or : (c: scala.reflect.macros.Context): c.Tree
found : : Nothing
number of parameter sections differ
def foo = macro Bundle.impl
diff --git a/test/files/neg/macro-divergence-controlled/Impls_Macros_1.scala b/test/files/neg/macro-divergence-controlled/Impls_Macros_1.scala
index 59acaede65..3983f590dc 100644
--- a/test/files/neg/macro-divergence-controlled/Impls_Macros_1.scala
+++ b/test/files/neg/macro-divergence-controlled/Impls_Macros_1.scala
@@ -15,7 +15,7 @@ object Complex {
val recur = c.inferImplicitValue(trecur, silent = true)
if (recur == EmptyTree) c.abort(c.enclosingPosition, s"couldn't synthesize $trecur")
}
- c.literalNull
+ c.Expr[Null](q"null")
}
implicit object ComplexString extends Complex[String]
diff --git a/test/files/neg/macro-invalidimpl.check b/test/files/neg/macro-invalidimpl.check
index aaf4f88fc2..e39cc8105b 100644
--- a/test/files/neg/macro-invalidimpl.check
+++ b/test/files/neg/macro-invalidimpl.check
@@ -32,12 +32,14 @@ match expected type ?
^
Macros_Test_2.scala:31: error: macro implementation has wrong shape:
required: (c: scala.reflect.macros.Context): c.Expr[Unit]
+ or : (c: scala.reflect.macros.Context): c.Tree
found : (c: scala.reflect.macros.Context)(): c.Expr[Unit]
number of parameter sections differ
def foo1 = macro Impls6.fooEmpty
^
Macros_Test_2.scala:32: error: macro implementation has wrong shape:
required: (c: scala.reflect.macros.Context)(): c.Expr[Unit]
+ or : (c: scala.reflect.macros.Context)(): c.Tree
found : (c: scala.reflect.macros.Context): c.Expr[Unit]
number of parameter sections differ
def bar1() = macro Impls6.fooNullary
diff --git a/test/files/neg/macro-invalidimpl/Impls_1.scala b/test/files/neg/macro-invalidimpl/Impls_1.scala
index cf78ecc65a..9f48ab7ad9 100644
--- a/test/files/neg/macro-invalidimpl/Impls_1.scala
+++ b/test/files/neg/macro-invalidimpl/Impls_1.scala
@@ -22,8 +22,7 @@ object Impls5 {
object Impls6 {
def fooNullary(c: Context) = {
import c.universe._
- val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works"))))
- c.Expr[Unit](body)
+ c.Expr[Unit](q"""Predef.println("it works")""")
}
def fooEmpty(c: Context)() = fooNullary(c)
diff --git a/test/files/neg/macro-invalidret.check b/test/files/neg/macro-invalidret.check
index 8c6ed4eb45..6cf62c292b 100644
--- a/test/files/neg/macro-invalidret.check
+++ b/test/files/neg/macro-invalidret.check
@@ -1,11 +1,13 @@
Macros_Test_2.scala:2: error: macro implementation has wrong shape:
required: (c: scala.reflect.macros.Context): c.Expr[Any]
+ or : (c: scala.reflect.macros.Context): c.Tree
found : (c: scala.reflect.macros.Context): Int
type mismatch for return type: Int does not conform to c.Expr[Any]
def foo1 = macro Impls.foo1
^
Macros_Test_2.scala:3: error: macro implementation has wrong shape:
required: (c: scala.reflect.macros.Context): c.Expr[Any]
+ or : (c: scala.reflect.macros.Context): c.Tree
found : (c: scala.reflect.macros.Context): reflect.runtime.universe.Literal
type mismatch for return type: reflect.runtime.universe.Literal does not conform to c.Expr[Any]
def foo2 = macro Impls.foo2
diff --git a/test/files/neg/macro-invalidshape/Macros_Test_2.scala b/test/files/neg/macro-invalidshape/Macros_Test_2.scala
index cf37e14d8e..819844b9f1 100644
--- a/test/files/neg/macro-invalidshape/Macros_Test_2.scala
+++ b/test/files/neg/macro-invalidshape/Macros_Test_2.scala
@@ -3,7 +3,7 @@ object Macros {
def foo2(x: Any) = macro Impls.foo(null)(null)
def foo3(x: Any) = macro {2; Impls.foo}
{
- def impl(c: scala.reflect.macros.Context) = c.literalUnit
+ def impl(c: scala.reflect.macros.Context) = { import c.universe._; c.Expr[Unit](q"()") }
def foo = macro impl
foo
}
diff --git a/test/files/neg/macro-invalidsig-params-badtype.check b/test/files/neg/macro-invalidsig-params-badtype.check
index 3cc1c9abf1..86aa08291f 100644
--- a/test/files/neg/macro-invalidsig-params-badtype.check
+++ b/test/files/neg/macro-invalidsig-params-badtype.check
@@ -1,5 +1,6 @@
Impls_Macros_1.scala:8: error: macro implementation has wrong shape:
required: (c: scala.reflect.macros.Context)(x: c.Expr[Int]): c.Expr[Any]
+ or : (c: scala.reflect.macros.Context)(x: c.Tree): c.Tree
found : (c: scala.reflect.macros.Context)(x: Int): Nothing
type mismatch for parameter x: c.Expr[Int] does not conform to Int
def foo(x: Int) = macro Impls.foo
diff --git a/test/files/neg/macro-invalidsig.check b/test/files/neg/macro-invalidsig.check
index cbdaf51081..732380d4b3 100644
--- a/test/files/neg/macro-invalidsig.check
+++ b/test/files/neg/macro-invalidsig.check
@@ -1,65 +1,76 @@
Macros_Test_2.scala:2: error: macro implementation has wrong shape:
required: (c: scala.reflect.macros.Context): c.Expr[Any]
+ or : (c: scala.reflect.macros.Context): c.Tree
found : (c: scala.reflect.macros.Context)(implicit evidence$2: Numeric[U]): c.universe.Literal
macro implementations cannot have implicit parameters other than WeakTypeTag evidences
def foo[U] = macro Impls1.foo[U]
^
Macros_Test_2.scala:6: error: macro implementation has wrong shape:
required: (c: scala.reflect.macros.Context): c.Expr[Any]
+ or : (c: scala.reflect.macros.Context): c.Tree
found : : Nothing
number of parameter sections differ
def foo = macro Impls2.foo
^
Macros_Test_2.scala:10: error: macro implementation has wrong shape:
required: (c: scala.reflect.macros.Context): c.Expr[Any]
+ or : (c: scala.reflect.macros.Context): c.Tree
found : (c: scala.reflect.api.Universe): Nothing
type mismatch for parameter c: scala.reflect.macros.Context does not conform to scala.reflect.api.Universe
def foo = macro Impls3.foo
^
Macros_Test_2.scala:14: error: macro implementation has wrong shape:
required: (c: scala.reflect.macros.Context): c.Expr[Any]
+ or : (c: scala.reflect.macros.Context): c.Tree
found : (cs: scala.reflect.macros.Context*): Nothing
types incompatible for parameter cs: corresponding is not a vararg parameter
def foo = macro Impls4.foo
^
Macros_Test_2.scala:18: error: macro implementation has wrong shape:
required: (c: scala.reflect.macros.Context)(x: c.Expr[Any]): c.Expr[Any]
+ or : (c: scala.reflect.macros.Context)(x: c.Tree): c.Tree
found : (c: scala.reflect.macros.Context): Nothing
number of parameter sections differ
def foo(x: Any) = macro Impls5.foo
^
Macros_Test_2.scala:22: error: macro implementation has wrong shape:
required: (c: scala.reflect.macros.Context)(x: c.Expr[Int]): c.Expr[Unit]
+ or : (c: scala.reflect.macros.Context)(x: c.Tree): c.Tree
found : (c: scala.reflect.macros.Context)(implicit x: c.Expr[Int]): c.Expr[Unit]
macro implementations cannot have implicit parameters other than WeakTypeTag evidences
def foo[U](x: Int) = macro Impls6.foo[T, U]
^
Macros_Test_2.scala:26: error: macro implementation has wrong shape:
required: (c: scala.reflect.macros.Context)(x: c.Expr[Int]): c.Expr[Any]
+ or : (c: scala.reflect.macros.Context)(x: c.Tree): c.Tree
found : (c: scala.reflect.macros.Context)(x: c.Expr[Int], y: c.Expr[Int]): Nothing
parameter lists have different length, found extra parameter y: c.Expr[Int]
def foo(x: Int) = macro Impls7.foo
^
Macros_Test_2.scala:30: error: macro implementation has wrong shape:
required: (c: scala.reflect.macros.Context)(x: c.Expr[Int]): c.Expr[Any]
+ or : (c: scala.reflect.macros.Context)(x: c.Tree): c.Tree
found : (c: scala.reflect.macros.Context)(x: c.universe.Symbol): Nothing
type mismatch for parameter x: c.Expr[Int] does not conform to c.universe.Symbol
def foo(x: Int) = macro Impls8.foo
^
Macros_Test_2.scala:34: error: macro implementation has wrong shape:
required: (c: scala.reflect.macros.Context)(x: c.Expr[Int], y: c.Expr[Int]): c.Expr[Any]
+ or : (c: scala.reflect.macros.Context)(x: c.Tree, y: c.Tree): c.Tree
found : (c: scala.reflect.macros.Context)(xs: c.Expr[Int]*): Nothing
parameter lists have different length, required extra parameter y: c.Expr[Int]
def foo(x: Int, y: Int) = macro Impls9.foo
^
Macros_Test_2.scala:38: error: macro implementation has wrong shape:
required: (c: scala.reflect.macros.Context)(x: c.Expr[Int], y: c.Expr[Int]): c.Expr[Any]
+ or : (c: scala.reflect.macros.Context)(x: c.Tree, y: c.Tree): c.Tree
found : (c: scala.reflect.macros.Context)(y: c.Expr[Int], x: c.Expr[Int]): Nothing
parameter names differ: x != y
def foo(x: Int, y: Int) = macro Impls10.foo
^
Macros_Test_2.scala:42: error: macro implementation has wrong shape:
required: (c: scala.reflect.macros.Context): c.Expr[Any]
+ or : (c: scala.reflect.macros.Context): c.Tree
found : (c: scala.reflect.macros.Context)(U: c.universe.Type): Nothing
number of parameter sections differ
def foo[U] = macro Impls11.foo[U]
diff --git a/test/files/neg/macro-invalidsig/Impls_1.scala b/test/files/neg/macro-invalidsig/Impls_1.scala
index e7d6c18f8d..d16ed26386 100644
--- a/test/files/neg/macro-invalidsig/Impls_1.scala
+++ b/test/files/neg/macro-invalidsig/Impls_1.scala
@@ -2,10 +2,7 @@ import scala.reflect.runtime.universe._
import scala.reflect.macros.Context
object Impls1 {
- def foo[U: c.WeakTypeTag: Numeric](c: Context) = {
- import c.universe._
- Literal(Constant(42))
- }
+ def foo[U: c.WeakTypeTag: Numeric](c: Context) = { import c.universe._; q"42" }
}
object Impls2 {
@@ -28,12 +25,11 @@ object Impls6 {
def foo[T, U: c.WeakTypeTag](c: Context)(implicit x: c.Expr[Int]) = {
import c.{prefix => prefix}
import c.universe._
- val body = Block(List(
- Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("invoking foo_targs...")))),
- Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("type of prefix is: " + prefix.staticType)))),
- Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("U is: " + implicitly[c.WeakTypeTag[U]].tpe))))),
- Literal(Constant(())))
- c.Expr[Unit](body)
+ c.Expr[Unit](q"""
+ println("invoking foo_targs...")
+ println("type of prefix is: " + ${prefix.staticType.toString})
+ println("U is: " + ${implicitly[c.WeakTypeTag[U]].tpe.toString})
+ """)
}
}
@@ -71,18 +67,20 @@ object Impls14 {
object Impls15 {
def foo[T: c.WeakTypeTag, U: c.WeakTypeTag, V](c: Context)(implicit V: c.WeakTypeTag[V]): c.Expr[Unit] = {
+ import c.universe._
println(implicitly[c.WeakTypeTag[T]])
println(implicitly[c.WeakTypeTag[U]])
println(V)
- c.literalUnit
+ c.Expr[Unit](q"()")
}
}
object Impls16 {
def foo[T: c.WeakTypeTag, U: c.WeakTypeTag, V](c: Context)(implicit V: c.WeakTypeTag[V]): c.Expr[Unit] = {
+ import c.universe._
println(implicitly[c.WeakTypeTag[T]])
println(implicitly[c.WeakTypeTag[U]])
println(V)
- c.literalUnit
+ c.Expr[Unit](q"()")
}
} \ No newline at end of file
diff --git a/test/files/neg/macro-invalidusage-badbounds/Impls_1.scala b/test/files/neg/macro-invalidusage-badbounds/Impls_1.scala
index 6ee71a3628..74c163596a 100644
--- a/test/files/neg/macro-invalidusage-badbounds/Impls_1.scala
+++ b/test/files/neg/macro-invalidusage-badbounds/Impls_1.scala
@@ -1,5 +1,5 @@
import scala.reflect.macros.{Context => Ctx}
object Impls {
- def foo[U <: String](c: Ctx) = c.literalUnit
+ def foo[U <: String](c: Ctx) = { import c.universe._; c.Expr[Unit](q"()") }
}
diff --git a/test/files/neg/macro-invalidusage-methodvaluesyntax/Impls_1.scala b/test/files/neg/macro-invalidusage-methodvaluesyntax/Impls_1.scala
index 498bd4f18d..11b6a8c3b0 100644
--- a/test/files/neg/macro-invalidusage-methodvaluesyntax/Impls_1.scala
+++ b/test/files/neg/macro-invalidusage-methodvaluesyntax/Impls_1.scala
@@ -3,7 +3,6 @@ import scala.reflect.macros.{Context => Ctx}
object Impls {
def foo(c: Ctx) = {
import c.universe._
- val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works"))))
- c.Expr[Unit](body)
+ c.Expr[Unit](q"""println("it works")""")
}
} \ No newline at end of file
diff --git a/test/files/neg/macro-invalidusage-presuper/Impls_1.scala b/test/files/neg/macro-invalidusage-presuper/Impls_1.scala
index b39a037c47..c4b57233c9 100644
--- a/test/files/neg/macro-invalidusage-presuper/Impls_1.scala
+++ b/test/files/neg/macro-invalidusage-presuper/Impls_1.scala
@@ -1,5 +1,5 @@
import scala.reflect.macros.Context
object Impls {
- def impl(c: Context) = c.literalUnit
+ def impl(c: Context) = { import c.universe._; c.Expr[Unit](q"()") }
} \ No newline at end of file
diff --git a/test/files/neg/macro-override-method-overrides-macro/Impls_1.scala b/test/files/neg/macro-override-method-overrides-macro/Impls_1.scala
index 69ef57d18d..64a9299ee6 100644
--- a/test/files/neg/macro-override-method-overrides-macro/Impls_1.scala
+++ b/test/files/neg/macro-override-method-overrides-macro/Impls_1.scala
@@ -4,8 +4,7 @@ object Impls {
def impl(c: Ctx)(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)
+ c.Expr[Unit](q"println($tag, ${prefix.toString}, $x)")
}
def fooBString(c: Ctx)(x: c.Expr[_]) = impl(c)("fooBString", x)
diff --git a/test/files/neg/macro-quasiquotes.check b/test/files/neg/macro-quasiquotes.check
index 96ef75dd32..d000bb5316 100644
--- a/test/files/neg/macro-quasiquotes.check
+++ b/test/files/neg/macro-quasiquotes.check
@@ -1,6 +1,7 @@
Macros_1.scala:14: error: macro implementation has wrong shape:
required: (x: Impls.this.c.Expr[Int]): Impls.this.c.Expr[Any]
- found : (x: Impls.this.c.universe.Block): Impls.this.c.universe.Tree
+ or : (x: Impls.this.c.Tree): Impls.this.c.Tree
+ found : (x: Impls.this.c.universe.Block): Impls.this.c.Tree
type mismatch for parameter x: Impls.this.c.Expr[Int] does not conform to Impls.this.c.universe.Block
def m3(x: Int) = macro Impls.impl3
^
diff --git a/test/files/neg/macro-without-xmacros-a/Impls_1.scala b/test/files/neg/macro-without-xmacros-a/Impls_1.scala
index c6677c4fde..868616aace 100644
--- a/test/files/neg/macro-without-xmacros-a/Impls_1.scala
+++ b/test/files/neg/macro-without-xmacros-a/Impls_1.scala
@@ -3,16 +3,16 @@ import scala.reflect.macros.{Context => Ctx}
object Impls {
def foo_impl(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = {
import c.universe._
- c.Expr(Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(1)))))
+ c.Expr(q"$x + 1")
}
def bar_impl(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = {
import c.universe._
- c.Expr(Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(2)))))
+ c.Expr(q"$x + 2")
}
def quux_impl(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = {
import c.universe._
- c.Expr(Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(3)))))
+ c.Expr(q"$x + 3")
}
} \ No newline at end of file
diff --git a/test/files/neg/macro-without-xmacros-b/Impls_1.scala b/test/files/neg/macro-without-xmacros-b/Impls_1.scala
index c6677c4fde..868616aace 100644
--- a/test/files/neg/macro-without-xmacros-b/Impls_1.scala
+++ b/test/files/neg/macro-without-xmacros-b/Impls_1.scala
@@ -3,16 +3,16 @@ import scala.reflect.macros.{Context => Ctx}
object Impls {
def foo_impl(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = {
import c.universe._
- c.Expr(Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(1)))))
+ c.Expr(q"$x + 1")
}
def bar_impl(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = {
import c.universe._
- c.Expr(Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(2)))))
+ c.Expr(q"$x + 2")
}
def quux_impl(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = {
import c.universe._
- c.Expr(Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(3)))))
+ c.Expr(q"$x + 3")
}
} \ No newline at end of file
diff --git a/test/files/neg/t3871.check b/test/files/neg/t3871.check
new file mode 100644
index 0000000000..b920357ee6
--- /dev/null
+++ b/test/files/neg/t3871.check
@@ -0,0 +1,7 @@
+t3871.scala:4: error: variable foo in class Sub2 cannot be accessed in Sub2
+ Access to protected method foo not permitted because
+ enclosing class Base is not a subclass of
+ class Sub2 where target is defined
+ s.foo = true
+ ^
+one error found
diff --git a/test/files/neg/t3871.scala b/test/files/neg/t3871.scala
new file mode 100644
index 0000000000..fc459867df
--- /dev/null
+++ b/test/files/neg/t3871.scala
@@ -0,0 +1,11 @@
+class Base {
+ def mkNew() = {
+ val s = new Sub2
+ s.foo = true
+ s
+ }
+}
+
+class Sub2 extends Base {
+ protected var foo = false
+}
diff --git a/test/files/neg/t3871b.check b/test/files/neg/t3871b.check
new file mode 100644
index 0000000000..6ab5ddfaf1
--- /dev/null
+++ b/test/files/neg/t3871b.check
@@ -0,0 +1,97 @@
+t3871b.scala:61: error: not found: value protOT
+ protOT // not allowed
+ ^
+t3871b.scala:77: error: method prot in class A cannot be accessed in E.this.A
+ Access to protected method prot not permitted because
+ prefix type E.this.A does not conform to
+ class B in class E where the access take place
+ a.prot // not allowed, prefix type `A` does not conform to `B`
+ ^
+t3871b.scala:79: error: value protT is not a member of E.this.B
+ b.protT // not allowed
+ ^
+t3871b.scala:80: error: value protT is not a member of E.this.C
+ c.protT // not allowed
+ ^
+t3871b.scala:81: error: value protT is not a member of E.this.A
+ a.protT // not allowed
+ ^
+t3871b.scala:91: error: method prot in class A cannot be accessed in E.this.A
+ Access to protected method prot not permitted because
+ prefix type E.this.A does not conform to
+ object B in class E where the access take place
+ a.prot // not allowed
+ ^
+t3871b.scala:93: error: value protT is not a member of E.this.B
+ b.protT // not allowed
+ ^
+t3871b.scala:94: error: value protT is not a member of E.this.C
+ c.protT // not allowed
+ ^
+t3871b.scala:95: error: value protT is not a member of E.this.A
+ a.protT // not allowed
+ ^
+t3871b.scala:102: error: method prot in class A cannot be accessed in E.this.B
+ Access to protected method prot not permitted because
+ enclosing class Z in class E is not a subclass of
+ class A in class E where target is defined
+ b.prot // not allowed
+ ^
+t3871b.scala:103: error: method prot in class A cannot be accessed in E.this.C
+ Access to protected method prot not permitted because
+ enclosing class Z in class E is not a subclass of
+ class A in class E where target is defined
+ c.prot // not allowed
+ ^
+t3871b.scala:104: error: method prot in class A cannot be accessed in E.this.A
+ Access to protected method prot not permitted because
+ enclosing class Z in class E is not a subclass of
+ class A in class E where target is defined
+ a.prot // not allowed
+ ^
+t3871b.scala:109: error: value protT is not a member of E.this.B
+ b.protT // not allowed
+ ^
+t3871b.scala:110: error: value protT is not a member of E.this.C
+ c.protT // not allowed
+ ^
+t3871b.scala:111: error: value protT is not a member of E.this.A
+ a.protT // not allowed
+ ^
+t3871b.scala:120: error: method prot in class A cannot be accessed in Other.this.e.B
+ Access to protected method prot not permitted because
+ enclosing class Other is not a subclass of
+ class A in class E where target is defined
+ b.prot // not allowed
+ ^
+t3871b.scala:121: error: method prot in class A cannot be accessed in Other.this.e.C
+ Access to protected method prot not permitted because
+ enclosing class Other is not a subclass of
+ class A in class E where target is defined
+ c.prot // not allowed
+ ^
+t3871b.scala:122: error: method prot in class A cannot be accessed in Other.this.e.A
+ Access to protected method prot not permitted because
+ enclosing class Other is not a subclass of
+ class A in class E where target is defined
+ a.prot // not allowed
+ ^
+t3871b.scala:123: error: method protE in class A cannot be accessed in Other.this.e.B
+ Access to protected method protE not permitted because
+ enclosing class Other is not a subclass of
+ class A in class E where target is defined
+ b.protE // not allowed
+ ^
+t3871b.scala:124: error: method protE in class A cannot be accessed in Other.this.e.A
+ Access to protected method protE not permitted because
+ enclosing class Other is not a subclass of
+ class A in class E where target is defined
+ a.protE // not allowed
+ ^
+t3871b.scala:125: error: method protE in class A cannot be accessed in Other.this.e.C
+ Access to protected method protE not permitted because
+ enclosing class Other is not a subclass of
+ class A in class E where target is defined
+ c.protE // not allowed
+ ^
+21 errors found
diff --git a/test/files/neg/t3871b.scala b/test/files/neg/t3871b.scala
new file mode 100644
index 0000000000..b490b7789a
--- /dev/null
+++ b/test/files/neg/t3871b.scala
@@ -0,0 +1,127 @@
+/**
+
+The protected modifier applies to class member definitions. Protected members of a class can be accessed from within
+
+ 0a. the companion module of any of those classes
+
+A protected identifier x may be used as a member name in a selection r.x only
+if one of the following applies:
+ 1a. The access is within the template defining the member, or,
+ if a qualification C is given,
+ 1b. inside the package C, or
+ 1c. the class C , or its companion module, or
+ 2. r is one of the reserved words this and super, or
+ 3. r’s type conforms to a type-instance of the class which contains the access.
+
+ 4. A different form of qualification is protected[this]. A member M marked with this
+ modifier is called object-protected; it can be accessed only from within the object
+ in which it is defined. That is, a selection p.M is only legal if the prefix is this
+ or O.this, for some class O enclosing the reference. In addition, the restrictions
+ for unqualified protected apply.
+*/
+
+object E {
+ val e = new E
+ import e._
+ def n(a: A, b: B, c: C) = {
+ b.protE // 1c
+ c.protE // 1c
+ a.protE // 1c
+ A.protOE // 1c
+ }
+}
+
+class E {
+ object A {
+ protected def protO = 2
+ protected[E] def protOE = 3
+ protected[this] def protOT = 3
+ }
+ class A {
+ protected def prot = 2
+ protected[E] def protE = 3
+ protected[this] def protT = 4
+
+ // 1a
+ prot; protE; protT
+ def foo = {prot; protE; protT}
+ new { prot; protE }
+ def this(a: Any) = {this(); prot; protE; protT}
+ object B extends A {
+ A.this.prot
+ A.this.protE
+ A.this.protT
+ }
+
+ import A._
+ // 0a
+ protO
+ // 3
+ protOE
+ protOT // not allowed
+ }
+
+ class B extends A {
+ // 1b
+ this.prot; this.protE;
+ super.prot; super.protE;
+
+ // 4
+ this.protT
+ // 4 !!! "or the super keyword"
+ super.protT
+
+ def n(a: A, b: B, c: C) = {
+ b.prot // 3
+ c.prot // 3
+ a.prot // not allowed, prefix type `A` does not conform to `B`
+
+ b.protT // not allowed
+ c.protT // not allowed
+ a.protT // not allowed
+ }
+ }
+ object B {
+ def n(a: A, b: B, c: C) = {
+ b.prot // 3 !!!
+ c.prot // 3 !!!
+ // Wording of 3 seems insufficient, missing:
+ // "... (if the access is from a class), or
+ // the type instance of companion class (if the access is from a module)"
+ a.prot // not allowed
+
+ b.protT // not allowed
+ c.protT // not allowed
+ a.protT // not allowed
+ }
+ }
+ class C extends B
+
+ class Z {
+ def n(a: A, b: B, c: C) = {
+ b.prot // not allowed
+ c.prot // not allowed
+ a.prot // not allowed
+ b.protE // 2
+ a.protE // 2
+ c.protE // 2
+
+ b.protT // not allowed
+ c.protT // not allowed
+ a.protT // not allowed
+ }
+ }
+}
+
+class Other {
+ val e = new E
+ import e._
+ def n(a: A, b: B, c: C) = {
+ b.prot // not allowed
+ c.prot // not allowed
+ a.prot // not allowed
+ b.protE // not allowed
+ a.protE // not allowed
+ c.protE // not allowed
+ }
+}
diff --git a/test/files/neg/t5689.check b/test/files/neg/t5689.check
index ad9b79cdcb..8cf0534e77 100644
--- a/test/files/neg/t5689.check
+++ b/test/files/neg/t5689.check
@@ -1,5 +1,6 @@
t5689.scala:4: error: macro implementation has wrong shape:
required: (c: scala.reflect.macros.Context)(i: c.Expr[Double]): c.Expr[String]
+ or : (c: scala.reflect.macros.Context)(i: c.Tree): c.Tree
found : (c: scala.reflect.macros.Context)(i: c.Expr[Double]): c.Expr[Int]
type mismatch for return type: c.Expr[Int] does not conform to c.Expr[String]
def returnsString(i: Double): String = macro returnsIntImpl
diff --git a/test/files/neg/t6123-explaintypes-macros.check b/test/files/neg/t6123-explaintypes-macros.check
index ebcb8069d5..43f8371326 100644
--- a/test/files/neg/t6123-explaintypes-macros.check
+++ b/test/files/neg/t6123-explaintypes-macros.check
@@ -2,6 +2,7 @@ c.universe.Expr[Any]* <: c.universe.Expr[String]*?
false
BadMac_2.scala:6: error: macro implementation has wrong shape:
required: (c: scala.reflect.macros.Context)(format: c.Expr[String], params: c.Expr[Any]*): c.Expr[Unit]
+ or : (c: scala.reflect.macros.Context)(format: c.Tree, params: Tree*): c.Tree
found : (c: scala.reflect.macros.Context)(format: c.Expr[String], params: c.Expr[String]*): c.Expr[Unit]
type mismatch for parameter params: c.Expr[Any]* does not conform to c.Expr[String]*
def printf(format: String, params: Any*): Unit = macro printf_impl
diff --git a/test/files/neg/t6446-additional.check b/test/files/neg/t6446-additional.check
index 6dfe072913..c91333830a 100755
--- a/test/files/neg/t6446-additional.check
+++ b/test/files/neg/t6446-additional.check
@@ -12,7 +12,7 @@ superaccessors 6 add super accessors in traits and nested classes
uncurry 10 uncurry, translate function values to anonymous classes
tailcalls 11 replace tail calls by jumps
specialize 12 @specialized-driven class and method specialization
- explicitouter 13 this refs to outer pointers, translate patterns
+ explicitouter 13 this refs to outer pointers
erasure 14 erase types, add interfaces for traits
posterasure 15 clean up erased inline classes
lazyvals 16 allocate bitmaps, translate lazy vals into lazified defs
diff --git a/test/files/neg/t6446-missing.check b/test/files/neg/t6446-missing.check
index ba5e30dc05..b2d5ddd686 100755
--- a/test/files/neg/t6446-missing.check
+++ b/test/files/neg/t6446-missing.check
@@ -13,7 +13,7 @@ superaccessors 6 add super accessors in traits and nested classes
uncurry 10 uncurry, translate function values to anonymous classes
tailcalls 11 replace tail calls by jumps
specialize 12 @specialized-driven class and method specialization
- explicitouter 13 this refs to outer pointers, translate patterns
+ explicitouter 13 this refs to outer pointers
erasure 14 erase types, add interfaces for traits
posterasure 15 clean up erased inline classes
lazyvals 16 allocate bitmaps, translate lazy vals into lazified defs
diff --git a/test/files/neg/t6446-show-phases.check b/test/files/neg/t6446-show-phases.check
index 10a9e08b86..48d4f37b3e 100644
--- a/test/files/neg/t6446-show-phases.check
+++ b/test/files/neg/t6446-show-phases.check
@@ -12,7 +12,7 @@ superaccessors 6 add super accessors in traits and nested classes
uncurry 10 uncurry, translate function values to anonymous classes
tailcalls 11 replace tail calls by jumps
specialize 12 @specialized-driven class and method specialization
- explicitouter 13 this refs to outer pointers, translate patterns
+ explicitouter 13 this refs to outer pointers
erasure 14 erase types, add interfaces for traits
posterasure 15 clean up erased inline classes
lazyvals 16 allocate bitmaps, translate lazy vals into lazified defs
diff --git a/test/files/neg/t6680b.flags b/test/files/neg/t6680b.flags
deleted file mode 100644
index a02d83efad..0000000000
--- a/test/files/neg/t6680b.flags
+++ /dev/null
@@ -1 +0,0 @@
--Xstrict-inference
diff --git a/test/files/neg/t6680c.check b/test/files/neg/t6680c.check
deleted file mode 100644
index 7a749de1f2..0000000000
--- a/test/files/neg/t6680c.check
+++ /dev/null
@@ -1,6 +0,0 @@
-t6680c.scala:15: error: type mismatch;
- found : String("a string!")
- required: S
- res match { case Unfold(s, f) => f("a string!") }
- ^
-one error found
diff --git a/test/files/neg/t6680c.flags b/test/files/neg/t6680c.flags
deleted file mode 100644
index a02d83efad..0000000000
--- a/test/files/neg/t6680c.flags
+++ /dev/null
@@ -1 +0,0 @@
--Xstrict-inference
diff --git a/test/files/disabled/t7020.check b/test/files/neg/t7020.check
index f9600ca7fc..76390b243d 100644
--- a/test/files/disabled/t7020.check
+++ b/test/files/neg/t7020.check
@@ -1,17 +1,17 @@
t7020.scala:3: warning: match may not be exhaustive.
-It would fail on the following inputs: List((x: Int forSome x not in (1, 2, 4, 5, 6, 7))), List((x: Int forSome x not in (1, 2, 4, 5, 6, 7)), _), List(1, _), List(2, _), List(4, _), List(5, _), List(6, _), List(7, _), List(??, _), List(_, _)
+It would fail on the following inputs: List((x: Int forSome x not in (1, 2, 4, 5, 6, 7))), List((x: Int forSome x not in (1, 2, 4, 5, 6, 7)), _), List(1, _), List(2, _), List(4, _), List(5, _), List(6, _), List(7, _), List(_, _)
List(5) match {
^
t7020.scala:10: warning: match may not be exhaustive.
-It would fail on the following inputs: List((x: Int forSome x not in (1, 2, 4, 5, 6, 7))), List((x: Int forSome x not in (1, 2, 4, 5, 6, 7)), _), List(1, _), List(2, _), List(4, _), List(5, _), List(6, _), List(7, _), List(??, _), List(_, _)
+It would fail on the following inputs: List((x: Int forSome x not in (1, 2, 4, 5, 6, 7))), List((x: Int forSome x not in (1, 2, 4, 5, 6, 7)), _), List(1, _), List(2, _), List(4, _), List(5, _), List(6, _), List(7, _), List(_, _)
List(5) match {
^
t7020.scala:17: warning: match may not be exhaustive.
-It would fail on the following inputs: List((x: Int forSome x not in (1, 2, 4, 5, 6, 7))), List((x: Int forSome x not in (1, 2, 4, 5, 6, 7)), _), List(1, _), List(2, _), List(4, _), List(5, _), List(6, _), List(7, _), List(??, _), List(_, _)
+It would fail on the following inputs: List((x: Int forSome x not in (1, 2, 4, 5, 6, 7))), List((x: Int forSome x not in (1, 2, 4, 5, 6, 7)), _), List(1, _), List(2, _), List(4, _), List(5, _), List(6, _), List(7, _), List(_, _)
List(5) match {
^
t7020.scala:24: warning: match may not be exhaustive.
-It would fail on the following inputs: List((x: Int forSome x not in (1, 2, 4, 5, 6, 7))), List((x: Int forSome x not in (1, 2, 4, 5, 6, 7)), _), List(1, _), List(2, _), List(4, _), List(5, _), List(6, _), List(7, _), List(??, _), List(_, _)
+It would fail on the following inputs: List((x: Int forSome x not in (1, 2, 4, 5, 6, 7))), List((x: Int forSome x not in (1, 2, 4, 5, 6, 7)), _), List(1, _), List(2, _), List(4, _), List(5, _), List(6, _), List(7, _), List(_, _)
List(5) match {
^
error: No warnings can be incurred under -Xfatal-warnings.
diff --git a/test/files/disabled/t7020.flags b/test/files/neg/t7020.flags
index e8fb65d50c..e8fb65d50c 100644
--- a/test/files/disabled/t7020.flags
+++ b/test/files/neg/t7020.flags
diff --git a/test/files/disabled/t7020.scala b/test/files/neg/t7020.scala
index cc5421bab1..cc5421bab1 100644
--- a/test/files/disabled/t7020.scala
+++ b/test/files/neg/t7020.scala
diff --git a/test/files/neg/t7157/Impls_Macros_1.scala b/test/files/neg/t7157/Impls_Macros_1.scala
index 09f423fbab..9069d26e6e 100644
--- a/test/files/neg/t7157/Impls_Macros_1.scala
+++ b/test/files/neg/t7157/Impls_Macros_1.scala
@@ -2,30 +2,30 @@ import scala.reflect.macros.Context
import language.experimental.macros
object Macros {
- def impl1_0_0(c: Context)() = c.literalUnit
- def impl1_1_1(c: Context)(x: c.Expr[Int]) = c.literalUnit
- def impl1_2_2(c: Context)(x: c.Expr[Int], y: c.Expr[Int]) = c.literalUnit
+ def impl1_0_0(c: Context)() = { import c.universe._; c.Expr[Unit](q"()") }
+ def impl1_1_1(c: Context)(x: c.Expr[Int]) = { import c.universe._; c.Expr[Unit](q"()") }
+ def impl1_2_2(c: Context)(x: c.Expr[Int], y: c.Expr[Int]) = { import c.universe._; c.Expr[Unit](q"()") }
def m1_0_0() = macro impl1_0_0
def m1_1_1(x: Int) = macro impl1_1_1
def m1_2_2(x: Int, y: Int) = macro impl1_2_2
- def impl1_0_inf(c: Context)(x: c.Expr[Int]*) = c.literalUnit
- def impl1_1_inf(c: Context)(x: c.Expr[Int], y: c.Expr[Int]*) = c.literalUnit
- def impl1_2_inf(c: Context)(x: c.Expr[Int], y: c.Expr[Int], z: c.Expr[Int]*) = c.literalUnit
+ def impl1_0_inf(c: Context)(x: c.Expr[Int]*) = { import c.universe._; c.Expr[Unit](q"()") }
+ def impl1_1_inf(c: Context)(x: c.Expr[Int], y: c.Expr[Int]*) = { import c.universe._; c.Expr[Unit](q"()") }
+ def impl1_2_inf(c: Context)(x: c.Expr[Int], y: c.Expr[Int], z: c.Expr[Int]*) = { import c.universe._; c.Expr[Unit](q"()") }
def m1_0_inf(x: Int*) = macro impl1_0_inf
def m1_1_inf(x: Int, y: Int*) = macro impl1_1_inf
def m1_2_inf(x: Int, y: Int, z: Int*) = macro impl1_2_inf
- def impl2_0_0(c: Context)()() = c.literalUnit
- def impl2_1_1(c: Context)()(x: c.Expr[Int]) = c.literalUnit
- def impl2_2_2(c: Context)()(x: c.Expr[Int], y: c.Expr[Int]) = c.literalUnit
+ def impl2_0_0(c: Context)()() = { import c.universe._; c.Expr[Unit](q"()") }
+ def impl2_1_1(c: Context)()(x: c.Expr[Int]) = { import c.universe._; c.Expr[Unit](q"()") }
+ def impl2_2_2(c: Context)()(x: c.Expr[Int], y: c.Expr[Int]) = { import c.universe._; c.Expr[Unit](q"()") }
def m2_0_0()() = macro impl2_0_0
def m2_1_1()(x: Int) = macro impl2_1_1
def m2_2_2()(x: Int, y: Int) = macro impl2_2_2
- def impl2_0_inf(c: Context)()(x: c.Expr[Int]*) = c.literalUnit
- def impl2_1_inf(c: Context)()(x: c.Expr[Int], y: c.Expr[Int]*) = c.literalUnit
- def impl2_2_inf(c: Context)()(x: c.Expr[Int], y: c.Expr[Int], z: c.Expr[Int]*) = c.literalUnit
+ def impl2_0_inf(c: Context)()(x: c.Expr[Int]*) = { import c.universe._; c.Expr[Unit](q"()") }
+ def impl2_1_inf(c: Context)()(x: c.Expr[Int], y: c.Expr[Int]*) = { import c.universe._; c.Expr[Unit](q"()") }
+ def impl2_2_inf(c: Context)()(x: c.Expr[Int], y: c.Expr[Int], z: c.Expr[Int]*) = { import c.universe._; c.Expr[Unit](q"()") }
def m2_0_inf()(x: Int*) = macro impl2_0_inf
def m2_1_inf()(x: Int, y: Int*) = macro impl2_1_inf
def m2_2_inf()(x: Int, y: Int, z: Int*) = macro impl2_2_inf
diff --git a/test/files/neg/t7494-no-options.check b/test/files/neg/t7494-no-options.check
index 0bde84c96c..b5dc0e3d4f 100644
--- a/test/files/neg/t7494-no-options.check
+++ b/test/files/neg/t7494-no-options.check
@@ -13,7 +13,7 @@ superaccessors 6 add super accessors in traits and nested classes
uncurry 10 uncurry, translate function values to anonymous classes
tailcalls 11 replace tail calls by jumps
specialize 12 @specialized-driven class and method specialization
- explicitouter 13 this refs to outer pointers, translate patterns
+ explicitouter 13 this refs to outer pointers
erasure 14 erase types, add interfaces for traits
posterasure 15 clean up erased inline classes
lazyvals 16 allocate bitmaps, translate lazy vals into lazified defs
diff --git a/test/files/neg/t7519-b.check b/test/files/neg/t7519-b.check
new file mode 100644
index 0000000000..08d819eeec
--- /dev/null
+++ b/test/files/neg/t7519-b.check
@@ -0,0 +1,6 @@
+Use_2.scala:6: error: type mismatch;
+ found : String
+ required: Q
+ val x: Q = ex.Mac.mac("asdf")
+ ^
+one error found
diff --git a/test/files/neg/t7519-b/Mac_1.scala b/test/files/neg/t7519-b/Mac_1.scala
new file mode 100644
index 0000000000..55b583d24b
--- /dev/null
+++ b/test/files/neg/t7519-b/Mac_1.scala
@@ -0,0 +1,14 @@
+// get expected error message without package declaration
+package ex
+
+import scala.language.experimental.macros
+import scala.reflect.macros._
+
+object IW {
+ def foo(a: String): String = ???
+}
+object Mac {
+ def mac(s: String): String = macro macImpl
+ def macImpl(c: Context)(s: c.Expr[String]): c.Expr[String] =
+ c.universe.reify(IW.foo(s.splice))
+}
diff --git a/test/files/neg/t7519-b/Use_2.scala b/test/files/neg/t7519-b/Use_2.scala
new file mode 100644
index 0000000000..413e40e25e
--- /dev/null
+++ b/test/files/neg/t7519-b/Use_2.scala
@@ -0,0 +1,8 @@
+trait Q
+trait K
+
+object Use {
+ implicit def cd[T](p: T)(implicit ev: T => K): Q = ???
+ val x: Q = ex.Mac.mac("asdf")
+}
+
diff --git a/test/files/neg/t7694b.check b/test/files/neg/t7694b.check
deleted file mode 100644
index ea3d7736f8..0000000000
--- a/test/files/neg/t7694b.check
+++ /dev/null
@@ -1,7 +0,0 @@
-t7694b.scala:8: error: type arguments [_3,_4] do not conform to trait L's type parameter bounds [A2,B2 <: A2]
- def d = if (true) (null: L[A, A]) else (null: L[B, B])
- ^
-t7694b.scala:9: error: type arguments [_1,_2] do not conform to trait L's type parameter bounds [A2,B2 <: A2]
- val v = if (true) (null: L[A, A]) else (null: L[B, B])
- ^
-two errors found
diff --git a/test/files/pos/annotated-treecopy.check b/test/files/pos/annotated-treecopy.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/pos/annotated-treecopy.check
+++ /dev/null
diff --git a/test/files/pos/annotated-treecopy/Impls_Macros_1.scala b/test/files/pos/annotated-treecopy/Impls_Macros_1.scala
index ecf8916c46..9b7af0c3b8 100644
--- a/test/files/pos/annotated-treecopy/Impls_Macros_1.scala
+++ b/test/files/pos/annotated-treecopy/Impls_Macros_1.scala
@@ -38,10 +38,10 @@ object Macros {
val reifiedExpr = c.Expr[scala.reflect.runtime.universe.Expr[T => U]](reifiedTree)
val template =
c.universe.reify(new (T => U) with TypedFunction {
- override def toString = c.literal(tp+" => "+ttag.tpe+" { "+b1.toString+" } ").splice // DEBUG
+ override def toString = c.Expr[String](q"""${tp+" => "+ttag.tpe+" { "+b1.toString+" } "}""").splice // DEBUG
def tree = reifiedExpr.splice.tree
- val typeIn = c.literal(tp.toString).splice
- val typeOut = c.literal(ttag.tpe.toString).splice
+ val typeIn = c.Expr[String](q"${tp.toString}").splice
+ val typeOut = c.Expr[String](q"${ttag.tpe.toString}").splice
def apply(_arg: T): U = c.Expr[U](b1)(ttag.asInstanceOf[c.WeakTypeTag[U]]).splice
})
val untyped = c.resetLocalAttrs(template.tree)
diff --git a/test/files/pos/attachments-typed-another-ident.check b/test/files/pos/attachments-typed-another-ident.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/pos/attachments-typed-another-ident.check
+++ /dev/null
diff --git a/test/files/pos/attachments-typed-ident.check b/test/files/pos/attachments-typed-ident.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/pos/attachments-typed-ident.check
+++ /dev/null
diff --git a/test/files/pos/macro-qmarkqmarkqmark.check b/test/files/pos/macro-qmarkqmarkqmark.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/pos/macro-qmarkqmarkqmark.check
+++ /dev/null
diff --git a/test/files/pos/t5692a/Macros_1.scala b/test/files/pos/t5692a/Macros_1.scala
index 06b5a3de36..e530713bb0 100644
--- a/test/files/pos/t5692a/Macros_1.scala
+++ b/test/files/pos/t5692a/Macros_1.scala
@@ -1,6 +1,6 @@
import scala.reflect.macros.Context
object Macros {
- def impl[T](c: Context) = c.literalUnit
+ def impl[T](c: Context) = { import c.universe._; c.Expr[Unit](q"()") }
def foo[T] = macro impl[T]
} \ No newline at end of file
diff --git a/test/files/pos/t5692b/Macros_1.scala b/test/files/pos/t5692b/Macros_1.scala
index b28d19f903..45c672cfce 100644
--- a/test/files/pos/t5692b/Macros_1.scala
+++ b/test/files/pos/t5692b/Macros_1.scala
@@ -1,6 +1,6 @@
import scala.reflect.macros.Context
object Macros {
- def impl[T, U](c: Context) = c.literalUnit
+ def impl[T, U](c: Context) = { import c.universe._; c.Expr[Unit](q"()") }
def foo[T, U] = macro impl[T, U]
} \ No newline at end of file
diff --git a/test/files/pos/t5692c.check b/test/files/pos/t5692c.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/pos/t5692c.check
+++ /dev/null
diff --git a/test/files/pos/t5845.check b/test/files/pos/t5845.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/pos/t5845.check
+++ /dev/null
diff --git a/test/files/pos/t7461.check b/test/files/pos/t7461.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/pos/t7461.check
+++ /dev/null
diff --git a/test/files/pos/t7461/Macros_1.scala b/test/files/pos/t7461/Macros_1.scala
index 353dec66d7..8621650f77 100644
--- a/test/files/pos/t7461/Macros_1.scala
+++ b/test/files/pos/t7461/Macros_1.scala
@@ -6,7 +6,7 @@ object Macros {
import c.universe._
val wut = c.typeCheck(Select(Literal(Constant(10)), newTermName("$minus")), silent = true)
// println(showRaw(wut, printIds = true, printTypes = true))
- c.literalUnit
+ c.Expr[Unit](q"()")
}
def foo = macro impl
diff --git a/test/files/pos/t7649.scala b/test/files/pos/t7649.scala
index a1b02f63f1..ff3c626fca 100644
--- a/test/files/pos/t7649.scala
+++ b/test/files/pos/t7649.scala
@@ -4,7 +4,7 @@ object Test {
reify {
// The lookup of the implicit WeakTypeTag[Any]
// was triggering an unpositioned tree.
- c.Expr[Any](Literal(Constant(0))).splice
+ c.Expr[Any](q"0").splice
}
import scala.reflect.ClassTag
diff --git a/test/files/pos/t7928.scala b/test/files/pos/t7928.scala
new file mode 100644
index 0000000000..d9e29935b3
--- /dev/null
+++ b/test/files/pos/t7928.scala
@@ -0,0 +1,16 @@
+trait OuterTrait {
+ trait InnerTrait {
+ type Element
+ type Collection <: Iterable[Inner.Element]
+ }
+
+ val Inner: InnerTrait
+
+}
+
+object OuterObject extends OuterTrait {
+ object Inner extends InnerTrait {
+ type Element = String
+ override type Collection = Seq[Inner.Element]
+ }
+}
diff --git a/test/files/pos/virtpatmat_anonfun_for.flags b/test/files/pos/virtpatmat_anonfun_for.flags
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/pos/virtpatmat_anonfun_for.flags
+++ /dev/null
diff --git a/test/files/presentation/partial-fun/partial-fun.check b/test/files/presentation/partial-fun/partial-fun.check
deleted file mode 100644
index adceab8280..0000000000
--- a/test/files/presentation/partial-fun/partial-fun.check
+++ /dev/null
@@ -1 +0,0 @@
-reload: PartialFun.scala
diff --git a/test/files/run/dead-code-elimination.check b/test/files/run/dead-code-elimination.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/dead-code-elimination.check
+++ /dev/null
diff --git a/test/files/run/exoticnames.check b/test/files/run/exoticnames.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/exoticnames.check
+++ /dev/null
diff --git a/test/files/run/intmap.check b/test/files/run/intmap.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/intmap.check
+++ /dev/null
diff --git a/test/files/run/longmap.check b/test/files/run/longmap.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/longmap.check
+++ /dev/null
diff --git a/test/files/run/macro-bundle-repl.check b/test/files/run/macro-bundle-repl.check
index b9c809f037..c11c48dc55 100644
--- a/test/files/run/macro-bundle-repl.check
+++ b/test/files/run/macro-bundle-repl.check
@@ -7,13 +7,13 @@ import scala.language.experimental.macros
scala> import scala.reflect.macros.Macro
import scala.reflect.macros.Macro
-scala> trait Bar extends Macro { def impl = c.literalUnit };def bar = macro Bar.impl
+scala> trait Bar extends Macro { def impl = { import c.universe._; c.Expr[Unit](q"()") } };def bar = macro Bar.impl
defined trait Bar
defined term macro bar: Unit
scala> bar
-scala> trait Foo extends Macro { def impl = c.literalUnit }
+scala> trait Foo extends Macro { def impl = { import c.universe._; c.Expr[Unit](q"()") } }
defined trait Foo
scala> def foo = macro Foo.impl
diff --git a/test/files/run/macro-bundle-repl.scala b/test/files/run/macro-bundle-repl.scala
index 50783c8cba..3171aaacc2 100644
--- a/test/files/run/macro-bundle-repl.scala
+++ b/test/files/run/macro-bundle-repl.scala
@@ -4,9 +4,9 @@ object Test extends ReplTest {
def code = """
import scala.language.experimental.macros
import scala.reflect.macros.Macro
-trait Bar extends Macro { def impl = c.literalUnit };def bar = macro Bar.impl
+trait Bar extends Macro { def impl = { import c.universe._; c.Expr[Unit](q"()") } };def bar = macro Bar.impl
bar
-trait Foo extends Macro { def impl = c.literalUnit }
+trait Foo extends Macro { def impl = { import c.universe._; c.Expr[Unit](q"()") } }
def foo = 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 831dac6df5..e81fd0dbd6 100644
--- a/test/files/run/macro-bundle-static/Impls_Macros_1.scala
+++ b/test/files/run/macro-bundle-static/Impls_Macros_1.scala
@@ -4,8 +4,8 @@ import scala.language.experimental.macros
object Enclosing {
trait Impl extends Macro {
- def mono = c.literalUnit
- def poly[T: c.WeakTypeTag] = c.literal(c.weakTypeOf[T].toString)
+ 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
}
}
@@ -18,8 +18,8 @@ object Macros {
package pkg {
object Enclosing {
trait Impl extends Macro {
- def mono = c.literalTrue
- def poly[T: c.WeakTypeTag] = c.literal(c.weakTypeOf[T].toString + c.weakTypeOf[T].toString)
+ 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/Impls_Macros_1.scala b/test/files/run/macro-bundle-toplevel/Impls_Macros_1.scala
index 676935682e..8c7df2cdc5 100644
--- a/test/files/run/macro-bundle-toplevel/Impls_Macros_1.scala
+++ b/test/files/run/macro-bundle-toplevel/Impls_Macros_1.scala
@@ -2,8 +2,8 @@ import scala.reflect.macros.Context
import scala.reflect.macros.Macro
trait Impl extends Macro {
- def mono = c.literalUnit
- def poly[T: c.WeakTypeTag] = c.literal(c.weakTypeOf[T].toString)
+ def 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
}
@@ -14,8 +14,8 @@ object Macros {
package pkg {
trait Impl extends Macro {
- def mono = c.literalTrue
- def poly[T: c.WeakTypeTag] = c.literal(c.weakTypeOf[T].toString + c.weakTypeOf[T].toString)
+ 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-divergence-spurious/Impls_Macros_1.scala b/test/files/run/macro-divergence-spurious/Impls_Macros_1.scala
index bc4a9fded7..53511ebc72 100644
--- a/test/files/run/macro-divergence-spurious/Impls_Macros_1.scala
+++ b/test/files/run/macro-divergence-spurious/Impls_Macros_1.scala
@@ -15,7 +15,7 @@ object Complex {
val recur = c.inferImplicitValue(trecur, silent = true)
if (recur == EmptyTree) c.abort(c.enclosingPosition, s"couldn't synthesize $trecur")
}
- c.literalNull
+ c.Expr[Null](Literal(Constant(null)))
}
implicit object ComplexString extends Complex[String]
diff --git a/test/files/run/macro-enclosures/Impls_Macros_1.scala b/test/files/run/macro-enclosures/Impls_Macros_1.scala
index cd54028676..68f1920cdd 100644
--- a/test/files/run/macro-enclosures/Impls_Macros_1.scala
+++ b/test/files/run/macro-enclosures/Impls_Macros_1.scala
@@ -1,13 +1,16 @@
import scala.reflect.macros.Context
object Macros {
- def impl(c: Context) = c.universe.reify {
- println("enclosingPackage = " + c.literal(c.enclosingPackage.toString).splice)
- println("enclosingClass = " + c.literal(c.enclosingClass.toString).splice)
- println("enclosingImpl = " + c.literal(c.enclosingImpl.toString).splice)
- println("enclosingTemplate = " + c.literal(c.enclosingTemplate.toString).splice)
- println("enclosingMethod = " + c.literal(c.enclosingMethod.toString).splice)
- println("enclosingDef = " + c.literal(c.enclosingDef.toString).splice)
+ def impl(c: Context) = {
+ import c.universe._
+ reify {
+ println("enclosingPackage = " + c.Expr[String](Literal(Constant(c.enclosingPackage.toString))).splice)
+ println("enclosingClass = " + c.Expr[String](Literal(Constant(c.enclosingClass.toString))).splice)
+ println("enclosingImpl = " + c.Expr[String](Literal(Constant(c.enclosingImpl.toString))).splice)
+ println("enclosingTemplate = " + c.Expr[String](Literal(Constant(c.enclosingTemplate.toString))).splice)
+ println("enclosingMethod = " + c.Expr[String](Literal(Constant(c.enclosingMethod.toString))).splice)
+ println("enclosingDef = " + c.Expr[String](Literal(Constant(c.enclosingDef.toString))).splice)
+ }
}
def foo = macro impl
diff --git a/test/files/run/macro-expand-tparams-bounds.check b/test/files/run/macro-expand-tparams-bounds.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/macro-expand-tparams-bounds.check
+++ /dev/null
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 f9103aaf8f..d63f034e9b 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.Context
object Impls1 {
- def foo[U <: String](c: Context): c.Expr[Unit] = c.literalUnit
+ def foo[U <: String](c: Context): c.Expr[Unit] = { import c.universe._; c.Expr[Unit](q"()") }
}
class C
class D extends C
object Impls2 {
- def foo[U <: C](c: Context): c.Expr[Unit] = c.literalUnit
+ def foo[U <: C](c: Context): c.Expr[Unit] = { import c.universe._; c.Expr[Unit](q"()") }
}
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 e92396d1b4..a98c4abe78 100644
--- a/test/files/run/macro-expand-tparams-prefix/Impls_1.scala
+++ b/test/files/run/macro-expand-tparams-prefix/Impls_1.scala
@@ -5,8 +5,7 @@ object Impls1 {
def foo[U: c.WeakTypeTag](c: Context)(x: c.Expr[U]) = {
import c.universe._
val U = implicitly[c.WeakTypeTag[U]]
- val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(U.toString))))
- c.Expr[Unit](body)
+ c.Expr[Unit](q"println(${U.toString})")
}
}
@@ -16,18 +15,18 @@ object Impls2 {
val T = implicitly[c.WeakTypeTag[T]]
val U = implicitly[c.WeakTypeTag[U]]
val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(T.toString + " " + U.toString))))
- c.Expr[Unit](body)
+ c.Expr[Unit](q"""println(${T.toString} + " " + ${U.toString})""")
}
}
object Impls345 {
def foo[T, U: c.WeakTypeTag, V](c: Context)(implicit T: c.WeakTypeTag[T], V: c.WeakTypeTag[V]): c.Expr[Unit] = {
import c.universe._
- c.Expr(Block(List(
- Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(T.toString)))),
- Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(implicitly[c.WeakTypeTag[U]].toString)))),
- Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(V.toString))))),
- Literal(Constant(()))))
+ c.Expr(q"""
+ println(${T.toString})
+ println(${implicitly[c.WeakTypeTag[U]].toString})
+ println(${V.toString})
+ """)
}
}
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 95d746980e..043675ec00 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
@@ -6,13 +6,12 @@ object Impls {
import c.{prefix => prefix}
import c.universe._
val U = implicitly[c.WeakTypeTag[U]]
- val body = Block(List(
- Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("invoking foo_targs...")))),
- Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("type of prefix is: " + prefix.staticType)))),
- Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("type of prefix tree is: " + prefix.tree.tpe)))),
- Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("U is: " + U.tpe))))),
- Literal(Constant(())))
- c.Expr[Unit](body)
+ c.Expr[Unit](q"""
+ println("invoking foo_targs...")
+ println("type of prefix is: " + ${prefix.staticType.toString})
+ println("type of prefix tree is: " + ${prefix.tree.tpe.toString})
+ println("U is: " + ${U.tpe.toString})
+ """)
}
}
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 738c88bbc8..5f3bbac719 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
@@ -3,10 +3,7 @@ import scala.reflect.macros.{Context => Ctx}
object Impls {
def foo(unconventionalName: Ctx)(x: unconventionalName.Expr[Int]) = {
import unconventionalName.universe._
- val body = Block(List(
- Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("invoking foo..."))))),
- Literal(Constant(())))
- unconventionalName.Expr[Unit](body)
+ 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 9b8dafaa97..24eacb36de 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.{Context => Ctx}
object Impls {
- def foo[U <: String](c: Ctx): c.Expr[Unit] = c.literalUnit
+ def foo[U <: String](c: Ctx): c.Expr[Unit] = { import c.universe._; c.Expr[Unit](q"()") }
}
diff --git a/test/files/run/macro-openmacros/Impls_Macros_1.scala b/test/files/run/macro-openmacros/Impls_Macros_1.scala
index 50a1782431..884d7f8825 100644
--- a/test/files/run/macro-openmacros/Impls_Macros_1.scala
+++ b/test/files/run/macro-openmacros/Impls_Macros_1.scala
@@ -14,9 +14,9 @@ object Macros {
}
import c.universe._
- val next = if (c.enclosingMacros.length < 3) c.Expr[Unit](Select(Ident(c.mirror.staticModule("Macros")), TermName("foo"))) else c.literalUnit
+ val next = if (c.enclosingMacros.length < 3) c.Expr[Unit](Select(Ident(c.mirror.staticModule("Macros")), TermName("foo"))) else c.Expr[Unit](Literal(Constant(())))
c.universe.reify {
- println(c.literal(normalizePaths(c.enclosingMacros.toString)).splice)
+ println(c.Expr[String](Literal(Constant(normalizePaths(c.enclosingMacros.toString)))).splice)
next.splice
}
}
diff --git a/test/files/run/macro-reify-nested-a.check b/test/files/run/macro-reify-nested-a.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/macro-reify-nested-a.check
+++ /dev/null
diff --git a/test/files/run/macro-reify-nested-b.check b/test/files/run/macro-reify-nested-b.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/macro-reify-nested-b.check
+++ /dev/null
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 5330d0e32b..f454fc430a 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
@@ -2,9 +2,9 @@ import scala.reflect.macros.{Context => Ctx}
object Impls {
def foo(c: Ctx)(x: c.Expr[Int]) = {
+ import c.universe._
val x1 = c.Expr[Int](c.resetAllAttrs(x.tree))
-// was: c.literal(x1.splice)
- c.literal(c.eval(x1))
+ c.Expr[Int](Literal(Constant(c.eval(x1))))
}
}
diff --git a/test/files/run/macro-settings/Impls_Macros_1.scala b/test/files/run/macro-settings/Impls_Macros_1.scala
index 83d80a5bff..9257784cf2 100644
--- a/test/files/run/macro-settings/Impls_Macros_1.scala
+++ b/test/files/run/macro-settings/Impls_Macros_1.scala
@@ -1,8 +1,11 @@
import scala.reflect.macros.Context
object Impls {
- def impl(c: Context) = c.universe.reify {
- println(c.literal(c.settings.toString).splice)
+ 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 8d7d3b5d3d..1b914ac797 100644
--- a/test/files/run/macro-sip19-revised/Impls_Macros_1.scala
+++ b/test/files/run/macro-sip19-revised/Impls_Macros_1.scala
@@ -11,7 +11,8 @@ object Macros {
val fileName = fun.pos.source.file.file.getName
val line = fun.pos.line
val charOffset = fun.pos.point
- c.universe.reify { SourceLocation1(outer.splice, c.literal(fileName).splice, c.literal(line).splice, c.literal(charOffset).splice) }
+ def literal[T](x: T) = c.Expr[T](Literal(Constant(x)))
+ c.universe.reify { SourceLocation1(outer.splice, literal(fileName).splice, literal(line).splice, literal(charOffset).splice) }
}
implicit def sourceLocation: SourceLocation1 = macro impl
diff --git a/test/files/run/macro-sip19/Impls_Macros_1.scala b/test/files/run/macro-sip19/Impls_Macros_1.scala
index 4c165ed1b8..95e19c4fd1 100644
--- a/test/files/run/macro-sip19/Impls_Macros_1.scala
+++ b/test/files/run/macro-sip19/Impls_Macros_1.scala
@@ -7,7 +7,8 @@ object Macros {
val fileName = fun.pos.source.file.file.getName
val line = fun.pos.line
val charOffset = fun.pos.point
- c.universe.reify { SourceLocation(c.literal(fileName).splice, c.literal(line).splice, c.literal(charOffset).splice) }
+ def literal[T](x: T) = c.Expr[T](Literal(Constant(x)))
+ c.universe.reify { SourceLocation(literal(fileName).splice, literal(line).splice, literal(charOffset).splice) }
}
implicit def sourceLocation: SourceLocation = macro impl
diff --git a/test/files/run/macro-system-properties.check b/test/files/run/macro-system-properties.check
index ff96a34426..c61fe7f2cf 100644
--- a/test/files/run/macro-system-properties.check
+++ b/test/files/run/macro-system-properties.check
@@ -8,7 +8,7 @@ import reflect.macros.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: Context)() = { System.getProperties.put("lastContext", c); c.literalUnit }
+ def impl(c: Context)() = { import c.universe._; System.getProperties.put("lastContext", c); c.Expr[Unit](q"()") }
def grab() = macro impl
}
defined object GrabContext
diff --git a/test/files/run/macro-system-properties.scala b/test/files/run/macro-system-properties.scala
index e182defc81..9dcd044dbd 100644
--- a/test/files/run/macro-system-properties.scala
+++ b/test/files/run/macro-system-properties.scala
@@ -7,7 +7,7 @@ object Test extends ReplTest {
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: Context)() = { System.getProperties.put("lastContext", c); c.literalUnit }
+ def impl(c: Context)() = { import c.universe._; System.getProperties.put("lastContext", c); c.Expr[Unit](q"()") }
def grab() = macro impl
}
object Test { class C(implicit a: Any) { GrabContext.grab } }
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 dbeb7efbc0..cd37c269b5 100644
--- a/test/files/run/macro-typecheck-implicitsdisabled/Impls_Macros_1.scala
+++ b/test/files/run/macro-typecheck-implicitsdisabled/Impls_Macros_1.scala
@@ -6,7 +6,7 @@ object Macros {
val tree1 = Apply(Select(Literal(Constant(1)), TermName("$minus$greater")), List(Literal(Constant(2))))
val ttree1 = c.typeCheck(tree1, withImplicitViewsDisabled = false)
- c.literal(ttree1.toString)
+ c.Expr[String](Literal(Constant(ttree1.toString)))
}
def foo_with_implicits_enabled = macro impl_with_implicits_enabled
@@ -17,10 +17,10 @@ object Macros {
try {
val tree2 = Apply(Select(Literal(Constant(1)), TermName("$minus$greater")), List(Literal(Constant(2))))
val ttree2 = c.typeCheck(tree2, withImplicitViewsDisabled = true)
- c.literal(ttree2.toString)
+ c.Expr[String](Literal(Constant(ttree2.toString)))
} catch {
case ex: Throwable =>
- c.literal(ex.toString)
+ c.Expr[String](Literal(Constant(ex.toString)))
}
}
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 ff535fea8d..2532cfd2b9 100644
--- a/test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala
+++ b/test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala
@@ -7,7 +7,7 @@ object Macros {
val ru = Select(Select(Select(Select(Ident(TermName("scala")), TermName("reflect")), TermName("runtime")), TermName("package")), TermName("universe"))
val tree1 = Apply(Select(ru, TermName("reify")), List(Literal(Constant(2))))
val ttree1 = c.typeCheck(tree1, withMacrosDisabled = false)
- c.literal(ttree1.toString)
+ c.Expr[String](Literal(Constant(ttree1.toString)))
}
def foo_with_macros_enabled = macro impl_with_macros_enabled
@@ -23,7 +23,7 @@ object Macros {
val tree2 = Apply(Select(Ident(ru), TermName("reify")), List(Literal(Constant(2))))
val ttree2 = c.typeCheck(tree2, withMacrosDisabled = true)
- c.literal(ttree2.toString)
+ c.Expr[String](Literal(Constant(ttree2.toString)))
}
def foo_with_macros_disabled = macro impl_with_macros_disabled
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 a96e0c53b6..7b22793df9 100644
--- a/test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala
+++ b/test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala
@@ -7,7 +7,7 @@ object Macros {
val ru = Select(Select(Select(Select(Ident(TermName("scala")), TermName("reflect")), TermName("runtime")), TermName("package")), TermName("universe"))
val tree1 = Apply(Select(ru, TermName("reify")), List(Apply(Select(Ident(TermName("scala")), TermName("Array")), List(Literal(Constant(2))))))
val ttree1 = c.typeCheck(tree1, withMacrosDisabled = false)
- c.literal(ttree1.toString)
+ c.Expr[String](Literal(Constant(ttree1.toString)))
}
def foo_with_macros_enabled = macro impl_with_macros_enabled
@@ -23,7 +23,7 @@ object Macros {
val tree2 = Apply(Select(Ident(ru), TermName("reify")), List(Apply(Select(Ident(TermName("scala")), TermName("Array")), List(Literal(Constant(2))))))
val ttree2 = c.typeCheck(tree2, withMacrosDisabled = true)
- c.literal(ttree2.toString)
+ c.Expr[String](Literal(Constant(ttree2.toString)))
}
def foo_with_macros_disabled = macro impl_with_macros_disabled
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 bcbd12817b..6695a297ea 100644
--- a/test/files/run/macro-undetparams-consfromsls/Impls_Macros_1.scala
+++ b/test/files/run/macro-undetparams-consfromsls/Impls_Macros_1.scala
@@ -2,14 +2,20 @@ import scala.reflect.runtime.universe._
import scala.reflect.macros.Context
object Macros {
- def cons_impl[A: c.WeakTypeTag](c: Context)(x: c.Expr[A], xs: c.Expr[List[A]]): c.Expr[List[A]] = c.universe.reify {
- println("A = " + c.literal(implicitly[c.WeakTypeTag[A]].toString).splice)
- x.splice :: xs.splice
+ 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)
+ x.splice :: xs.splice
+ }
}
- def nil_impl[B: c.WeakTypeTag](c: Context): c.Expr[List[B]] = c.universe.reify {
- println("B = " + c.literal(implicitly[c.WeakTypeTag[B]].toString).splice)
- Nil
+ 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)
+ Nil
+ }
}
def cons[A](x: A, xs: List[A]): List[A] = macro cons_impl[A]
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 0244273b6f..85877b3f13 100644
--- a/test/files/run/macro-undetparams-macroitself/Impls_Macros_1.scala
+++ b/test/files/run/macro-undetparams-macroitself/Impls_Macros_1.scala
@@ -2,7 +2,10 @@ import scala.reflect.runtime.universe._
import scala.reflect.macros.Context
object Macros {
- def impl[T: c.WeakTypeTag](c: Context)(foo: c.Expr[T]): c.Expr[Unit] = c.universe.reify { println(c.literal(implicitly[c.WeakTypeTag[T]].toString).splice) }
+ 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) }
+ }
def foo[T](foo: T) = macro impl[T]
} \ No newline at end of file
diff --git a/test/files/run/programmatic-main.check b/test/files/run/programmatic-main.check
index 10d2ed5af7..cfa3ed3fb4 100644
--- a/test/files/run/programmatic-main.check
+++ b/test/files/run/programmatic-main.check
@@ -12,7 +12,7 @@ superaccessors 6 add super accessors in traits and nested classes
uncurry 10 uncurry, translate function values to anonymous classes
tailcalls 11 replace tail calls by jumps
specialize 12 @specialized-driven class and method specialization
- explicitouter 13 this refs to outer pointers, translate patterns
+ explicitouter 13 this refs to outer pointers
erasure 14 erase types, add interfaces for traits
posterasure 15 clean up erased inline classes
lazyvals 16 allocate bitmaps, translate lazy vals into lazified defs
diff --git a/test/files/run/range.check b/test/files/run/range.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/range.check
+++ /dev/null
diff --git a/test/files/run/reflection-fancy-java-classes.check b/test/files/run/reflection-fancy-java-classes.check
new file mode 100644
index 0000000000..258208dd99
--- /dev/null
+++ b/test/files/run/reflection-fancy-java-classes.check
@@ -0,0 +1,12 @@
+===== JAVA POV =====
+class Foo_1$1
+getEnclosingClass = class Foo_1
+getEnclosingMethod = null
+getEnclosingConstructor = null
+isMemberClass = false
+isLocalClass = false
+isAnonymousClass = true
+
+===== SCALA POV =====
+class 1
+object Foo_1
diff --git a/test/files/run/reflection-fancy-java-classes/Foo_1.java b/test/files/run/reflection-fancy-java-classes/Foo_1.java
new file mode 100644
index 0000000000..f6fd76124b
--- /dev/null
+++ b/test/files/run/reflection-fancy-java-classes/Foo_1.java
@@ -0,0 +1,5 @@
+public class Foo_1 {
+ public static Bar bar = new Bar();
+ private static class Bar {
+ }
+} \ No newline at end of file
diff --git a/test/files/run/reflection-fancy-java-classes/Test_2.scala b/test/files/run/reflection-fancy-java-classes/Test_2.scala
new file mode 100644
index 0000000000..271960ee79
--- /dev/null
+++ b/test/files/run/reflection-fancy-java-classes/Test_2.scala
@@ -0,0 +1,20 @@
+import scala.reflect.runtime.{universe => ru}
+import scala.reflect.runtime.{currentMirror => cm}
+
+object Test extends App {
+ println("===== JAVA POV =====")
+ val jfancy = Class.forName("Foo_1$1")
+ println(jfancy)
+ println("getEnclosingClass = " + jfancy.getEnclosingClass)
+ println("getEnclosingMethod = " + jfancy.getEnclosingMethod)
+ println("getEnclosingConstructor = " + jfancy.getEnclosingConstructor)
+ println("isMemberClass = " + jfancy.isMemberClass)
+ println("isLocalClass = " + jfancy.isLocalClass)
+ println("isAnonymousClass = " + jfancy.isAnonymousClass)
+
+ println("")
+ println("===== SCALA POV =====")
+ val sfancy = cm.classSymbol(jfancy)
+ println(sfancy)
+ println(sfancy.owner)
+} \ No newline at end of file
diff --git a/test/files/run/reflection-sync-potpourri.check b/test/files/run/reflection-sync-potpourri.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/reflection-sync-potpourri.check
+++ /dev/null
diff --git a/test/files/run/reflection-sync-subtypes.check b/test/files/run/reflection-sync-subtypes.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/reflection-sync-subtypes.check
+++ /dev/null
diff --git a/test/files/run/reify_for1.check b/test/files/run/reify_for1.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/reify_for1.check
+++ /dev/null
diff --git a/test/files/run/reify_fors_oldpatmat.flags b/test/files/run/reify_fors_oldpatmat.flags
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/reify_fors_oldpatmat.flags
+++ /dev/null
diff --git a/test/files/run/reify_maps_oldpatmat.flags b/test/files/run/reify_maps_oldpatmat.flags
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/reify_maps_oldpatmat.flags
+++ /dev/null
diff --git a/test/files/run/repl-term-macros.check b/test/files/run/repl-term-macros.check
index 2a143a1777..63bafe401b 100644
--- a/test/files/run/repl-term-macros.check
+++ b/test/files/run/repl-term-macros.check
@@ -9,7 +9,7 @@ import language.experimental.macros
scala>
-scala> def impl1(c: Context) = c.literalUnit
+scala> def impl1(c: Context) = { import c.universe._; c.Expr[Unit](q"()") }
impl1: (c: scala.reflect.macros.Context)c.Expr[Unit]
scala> def foo1 = macro impl1
@@ -19,7 +19,7 @@ scala> foo1
scala>
-scala> def impl2(c: Context)() = c.literalUnit
+scala> def impl2(c: Context)() = { import c.universe._; c.Expr[Unit](q"()") }
impl2: (c: scala.reflect.macros.Context)()c.Expr[Unit]
scala> def foo2() = macro impl2
@@ -29,7 +29,7 @@ scala> foo2()
scala>
-scala> def impl3(c: Context)(x: c.Expr[Int])(y: c.Expr[Int]) = c.literalUnit
+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.Context)(x: c.Expr[Int])(y: c.Expr[Int])c.Expr[Unit]
scala> def foo3(x: Int)(y: Int) = macro impl3
diff --git a/test/files/run/repl-term-macros.scala b/test/files/run/repl-term-macros.scala
index f826259be9..125e397b22 100644
--- a/test/files/run/repl-term-macros.scala
+++ b/test/files/run/repl-term-macros.scala
@@ -5,15 +5,15 @@ object Test extends ReplTest {
import scala.reflect.macros.Context
import language.experimental.macros
-def impl1(c: Context) = c.literalUnit
+def impl1(c: Context) = { import c.universe._; c.Expr[Unit](q"()") }
def foo1 = macro impl1
foo1
-def impl2(c: Context)() = c.literalUnit
+def impl2(c: Context)() = { import c.universe._; c.Expr[Unit](q"()") }
def foo2() = macro impl2
foo2()
-def impl3(c: Context)(x: c.Expr[Int])(y: c.Expr[Int]) = c.literalUnit
+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) = macro impl3
foo3(2)(3)
"""
diff --git a/test/files/run/t0668.check b/test/files/run/t0668.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/t0668.check
+++ /dev/null
diff --git a/test/files/run/t1829.check b/test/files/run/t1829.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/t1829.check
+++ /dev/null
diff --git a/test/files/run/t2594_tcpoly.check b/test/files/run/t2594_tcpoly.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/t2594_tcpoly.check
+++ /dev/null
diff --git a/test/files/run/t3346b.check b/test/files/run/t3346b.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/t3346b.check
+++ /dev/null
diff --git a/test/files/run/t3346c.check b/test/files/run/t3346c.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/t3346c.check
+++ /dev/null
diff --git a/test/files/run/t3346d.check b/test/files/run/t3346d.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/t3346d.check
+++ /dev/null
diff --git a/test/files/run/t5229_1.check b/test/files/run/t5229_1.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/t5229_1.check
+++ /dev/null
diff --git a/test/files/run/t5271_4.check b/test/files/run/t5271_4.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/t5271_4.check
+++ /dev/null
diff --git a/test/files/run/t5272_1_oldpatmat.flags b/test/files/run/t5272_1_oldpatmat.flags
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/t5272_1_oldpatmat.flags
+++ /dev/null
diff --git a/test/files/run/t5272_2_oldpatmat.flags b/test/files/run/t5272_2_oldpatmat.flags
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/t5272_2_oldpatmat.flags
+++ /dev/null
diff --git a/test/files/run/t5273_1_oldpatmat.flags b/test/files/run/t5273_1_oldpatmat.flags
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/t5273_1_oldpatmat.flags
+++ /dev/null
diff --git a/test/files/run/t5273_2a_oldpatmat.flags b/test/files/run/t5273_2a_oldpatmat.flags
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/t5273_2a_oldpatmat.flags
+++ /dev/null
diff --git a/test/files/run/t5273_2b_oldpatmat.flags b/test/files/run/t5273_2b_oldpatmat.flags
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/t5273_2b_oldpatmat.flags
+++ /dev/null
diff --git a/test/files/run/t5415.check b/test/files/run/t5415.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/t5415.check
+++ /dev/null
diff --git a/test/files/run/t5418.check b/test/files/run/t5418.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/t5418.check
+++ /dev/null
diff --git a/test/files/run/t5545.check b/test/files/run/t5545.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/t5545.check
+++ /dev/null
diff --git a/test/files/run/t5894.scala b/test/files/run/t5894.scala
index abeec32365..5deda34489 100644
--- a/test/files/run/t5894.scala
+++ b/test/files/run/t5894.scala
@@ -4,7 +4,7 @@ class Test
object Test {
def foo = macro fooImpl
- def fooImpl(c: reflect.macros.Context) = c.literalUnit
+ def fooImpl(c: reflect.macros.Context) = { import c.universe._; c.Expr[Unit](q"()") }
def main(args: Array[String]) {
try {
diff --git a/test/files/run/t5923a/Macros_1.scala b/test/files/run/t5923a/Macros_1.scala
index 97076eb102..741379cf34 100644
--- a/test/files/run/t5923a/Macros_1.scala
+++ b/test/files/run/t5923a/Macros_1.scala
@@ -46,7 +46,7 @@ object Macros {
if (sym.isParameter && !sym.isSkolem) TypeTag.Nothing.asInstanceOf[TypeTag[T]]
else ttag0
}
- reify(C[T](c.literal(weakTypeOf[T].toString).splice))
+ reify(C[T](c.Expr[String](Literal(Constant(weakTypeOf[T].toString))).splice))
}
}
} \ No newline at end of file
diff --git a/test/files/run/t5923d.check b/test/files/run/t5923d.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/t5923d.check
+++ /dev/null
diff --git a/test/files/run/t5940.scala b/test/files/run/t5940.scala
index 147ff38256..9c8f702c68 100644
--- a/test/files/run/t5940.scala
+++ b/test/files/run/t5940.scala
@@ -7,12 +7,12 @@ object Test extends DirectTest {
import scala.reflect.macros.Context
object Impls {
- def impl(c: Context) = c.literalUnit
+ def impl(c: Context) = { import c.universe._; c.Expr[Unit](q"()") }
}
object Macros {
//import Impls._
- def impl(c: Context) = c.literalUnit
+ def impl(c: Context) = { import c.universe._; c.Expr[Unit](q"()") }
def foo = macro impl
}
"""
diff --git a/test/files/run/t5942.check b/test/files/run/t5942.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/t5942.check
+++ /dev/null
diff --git a/test/files/run/t6197.check b/test/files/run/t6197.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/t6197.check
+++ /dev/null
diff --git a/test/files/run/t6198.check b/test/files/run/t6198.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/t6198.check
+++ /dev/null
diff --git a/test/files/run/t6199-toolbox.scala b/test/files/run/t6199-toolbox.scala
index 89015f5878..6ba5e50f66 100644
--- a/test/files/run/t6199-toolbox.scala
+++ b/test/files/run/t6199-toolbox.scala
@@ -4,5 +4,5 @@ import scala.tools.reflect.ToolBox
object Test extends App {
val tb = cm.mkToolBox()
- println(tb.eval(Literal(Constant(()))))
+ println(tb.eval(q"()"))
} \ No newline at end of file
diff --git a/test/files/run/t6240-universe-code-gen.check b/test/files/run/t6240-universe-code-gen.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/t6240-universe-code-gen.check
+++ /dev/null
diff --git a/test/files/run/t6381.check b/test/files/run/t6381.check
index 5070b67e46..c9d4713aa8 100644
--- a/test/files/run/t6381.check
+++ b/test/files/run/t6381.check
@@ -4,8 +4,10 @@ Type :help for more information.
scala> import language.experimental.macros
import language.experimental.macros
-scala> def pos_impl(c: reflect.macros.Context): c.Expr[String] =
- c.literal(c.enclosingPosition.getClass.toString)
+scala> def pos_impl(c: reflect.macros.Context): c.Expr[String] = {
+ import c.universe._
+ c.Expr[String](Literal(Constant(c.enclosingPosition.getClass.toString)))
+}
pos_impl: (c: scala.reflect.macros.Context)c.Expr[String]
scala> def pos = macro pos_impl
diff --git a/test/files/run/t6381.scala b/test/files/run/t6381.scala
index 859ec3cb30..4c2a40fe87 100644
--- a/test/files/run/t6381.scala
+++ b/test/files/run/t6381.scala
@@ -3,8 +3,10 @@ import scala.tools.partest.ReplTest
object Test extends ReplTest {
def code = """
|import language.experimental.macros
- |def pos_impl(c: reflect.macros.Context): c.Expr[String] =
- | c.literal(c.enclosingPosition.getClass.toString)
+ |def pos_impl(c: reflect.macros.Context): c.Expr[String] = {
+ | import c.universe._
+ | c.Expr[String](Literal(Constant(c.enclosingPosition.getClass.toString)))
+ |}
|def pos = macro pos_impl
|pos
|""".stripMargin.trim
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 94fd99018e..477829f200 100644
--- a/test/files/run/t7008-scala-defined/Impls_Macros_2.scala
+++ b/test/files/run/t7008-scala-defined/Impls_Macros_2.scala
@@ -3,9 +3,10 @@ import scala.reflect.macros.Context
object Macros {
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)
- c.universe.reify(println(c.literal(s).splice))
+ reify(println(c.Expr[String](Literal(Constant(s))).splice))
}
def foo = macro impl
diff --git a/test/files/run/t7008/Impls_Macros_2.scala b/test/files/run/t7008/Impls_Macros_2.scala
index 7a17314085..63c3f9d696 100644
--- a/test/files/run/t7008/Impls_Macros_2.scala
+++ b/test/files/run/t7008/Impls_Macros_2.scala
@@ -3,9 +3,10 @@ import scala.reflect.macros.Context
object Macros {
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)
- c.universe.reify(println(c.literal(s).splice))
+ reify(println(c.Expr[String](Literal(Constant(s))).splice))
}
def foo = macro impl
diff --git a/test/files/run/t7047/Impls_Macros_1.scala b/test/files/run/t7047/Impls_Macros_1.scala
index 2992e3efe4..a5d55c3a42 100644
--- a/test/files/run/t7047/Impls_Macros_1.scala
+++ b/test/files/run/t7047/Impls_Macros_1.scala
@@ -12,7 +12,7 @@ object Macros {
} catch {
case _: Exception =>
}
- c.literalNull
+ c.Expr[Null](Literal(Constant(null)))
}
def foo = macro impl
diff --git a/test/files/run/t7240.check b/test/files/run/t7240.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/t7240.check
+++ /dev/null
diff --git a/test/files/run/t7341.check b/test/files/run/t7341.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/t7341.check
+++ /dev/null
diff --git a/test/files/run/t7375b/Macros_1.scala b/test/files/run/t7375b/Macros_1.scala
index 70e79cc2b4..7a307805db 100644
--- a/test/files/run/t7375b/Macros_1.scala
+++ b/test/files/run/t7375b/Macros_1.scala
@@ -11,7 +11,7 @@ object Macros {
def foo = macro impl
def impl(c: Context) = {
import c.universe._
- def test[T: c.TypeTag] = reify(println(c.literal(c.reifyRuntimeClass(c.typeOf[T]).toString).splice)).tree
+ def 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(())))
c.Expr[Unit](tests)
}
diff --git a/test/files/run/t7510.check b/test/files/run/t7510.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/t7510.check
+++ /dev/null
diff --git a/test/files/run/t7852.check b/test/files/run/t7852.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/t7852.check
+++ /dev/null
diff --git a/test/files/run/typetags_without_scala_reflect_manifest_lookup.check b/test/files/run/typetags_without_scala_reflect_manifest_lookup.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/files/run/typetags_without_scala_reflect_manifest_lookup.check
+++ /dev/null
diff --git a/test/files/scalacheck/quasiquotes/TermConstructionProps.scala b/test/files/scalacheck/quasiquotes/TermConstructionProps.scala
index 9284903623..f68656d0f7 100644
--- a/test/files/scalacheck/quasiquotes/TermConstructionProps.scala
+++ b/test/files/scalacheck/quasiquotes/TermConstructionProps.scala
@@ -199,4 +199,13 @@ object TermConstructionProps extends QuasiquoteProperties("term construction") {
def withEvidence = q"def foo[T: X]"
assert(!(withEvidence ≈ withEvidence))
}
+
+ property("make sure inference doesn't infer any") = test {
+ val l1 = List(q"foo")
+ val l2 = List(q"bar")
+ val baz = q"baz"
+ assert(q"f(..${l1 ++ l2})" ≈ q"f(foo, bar)")
+ assert(q"f(..${l1 ++ l2}, $baz)" ≈ q"f(foo, bar, baz)")
+ assert(q"f(${if (true) q"a" else q"b"})" ≈ q"f(a)")
+ }
}
diff --git a/test/junit/scala/collection/convert/MapWrapperTest.scala b/test/junit/scala/collection/convert/MapWrapperTest.scala
new file mode 100644
index 0000000000..060b6b5937
--- /dev/null
+++ b/test/junit/scala/collection/convert/MapWrapperTest.scala
@@ -0,0 +1,49 @@
+package scala.collection.convert
+
+import org.junit.Assert._
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+
+@RunWith(classOf[JUnit4])
+class MapWrapperTest {
+
+ /* Test for SI-7883 */
+ @Test
+ def testContains() {
+ import scala.collection.JavaConverters.mapAsJavaMapConverter
+ import scala.language.reflectiveCalls // for accessing containsCounter
+
+ // A HashMap which throws an exception when the iterator() method is called.
+ // Before the fix for SI-7883, calling MapWrapper.containsKey() used to
+ // iterate through every element of the wrapped Map, and thus would crash
+ // in this case.
+ val scalaMap = new scala.collection.mutable.HashMap[String, String] {
+ var containsCounter = 0 // keep track of how often contains() has been called.
+ override def iterator = throw new UnsupportedOperationException
+
+ override def contains(key: String): Boolean = {
+ containsCounter += 1
+ super.contains(key)
+ }
+ }
+
+ val javaMap = scalaMap.asJava
+
+ scalaMap("hello") = "world"
+ scalaMap(null) = "null's value"
+
+ assertEquals(0, scalaMap.containsCounter)
+ assertTrue(javaMap.containsKey("hello")) // positive test
+ assertTrue(javaMap.containsKey(null)) // positive test, null key
+
+ assertFalse(javaMap.containsKey("goodbye")) // negative test
+ // Note: this case does NOT make it to scalaMap's contains() method because the runtime
+ // cast fails in MapWrapper, so the containsCounter is not incremented in this case.
+ assertFalse(javaMap.containsKey(42)) // negative test, wrong key type
+
+ assertEquals(Some("null's value"), scalaMap.remove(null))
+ assertFalse(javaMap.containsKey(null)) // negative test, null key
+ assertEquals(4, scalaMap.containsCounter)
+ }
+}
diff --git a/test/pending/run/macro-term-declared-in-anonymous-explicit-import.check b/test/pending/run/macro-term-declared-in-anonymous-explicit-import.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/pending/run/macro-term-declared-in-anonymous-explicit-import.check
+++ /dev/null
diff --git a/test/pending/run/virtpatmat_anonfun_underscore.check b/test/pending/run/virtpatmat_anonfun_underscore.check
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/pending/run/virtpatmat_anonfun_underscore.check
+++ /dev/null