summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/reflect/macros/compiler/Resolvers.scala2
-rw-r--r--src/compiler/scala/reflect/reify/codegen/GenTrees.scala4
-rw-r--r--src/compiler/scala/reflect/reify/phases/Reshape.scala2
-rw-r--r--src/compiler/scala/reflect/reify/utils/Extractors.scala4
-rw-r--r--src/compiler/scala/tools/nsc/ast/Printers.scala2
-rw-r--r--src/compiler/scala/tools/nsc/ast/TreeGen.scala2
-rw-r--r--src/compiler/scala/tools/nsc/ast/Trees.scala2
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/Parsers.scala12
-rw-r--r--src/compiler/scala/tools/nsc/javac/JavaParsers.scala4
-rw-r--r--src/compiler/scala/tools/nsc/transform/AddInterfaces.scala6
-rw-r--r--src/compiler/scala/tools/nsc/transform/Erasure.scala2
-rw-r--r--src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala4
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Contexts.scala4
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Namers.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Unapplies.scala2
-rw-r--r--src/compiler/scala/tools/reflect/ToolBoxFactory.scala2
-rw-r--r--src/reflect/scala/reflect/api/Printers.scala4
-rw-r--r--src/reflect/scala/reflect/api/Trees.scala20
-rw-r--r--src/reflect/scala/reflect/internal/BuildUtils.scala4
-rw-r--r--src/reflect/scala/reflect/internal/Importers.scala6
-rw-r--r--src/reflect/scala/reflect/internal/Printers.scala4
-rw-r--r--src/reflect/scala/reflect/internal/StdNames.scala2
-rw-r--r--src/reflect/scala/reflect/internal/Trees.scala6
23 files changed, 50 insertions, 52 deletions
diff --git a/src/compiler/scala/reflect/macros/compiler/Resolvers.scala b/src/compiler/scala/reflect/macros/compiler/Resolvers.scala
index 3025eb52a1..46c4e24817 100644
--- a/src/compiler/scala/reflect/macros/compiler/Resolvers.scala
+++ b/src/compiler/scala/reflect/macros/compiler/Resolvers.scala
@@ -57,7 +57,7 @@ trait Resolvers {
val contextField = mkContextValDef(PARAMACCESSOR)
val contextParam = mkContextValDef(PARAM | PARAMACCESSOR)
val invokerCtor = DefDef(Modifiers(), nme.CONSTRUCTOR, Nil, List(List(contextParam)), TypeTree(), Block(List(pendingSuperCall), Literal(Constant(()))))
- val invoker = atPos(bundleClass.pos)(ClassDef(NoMods, invokerName, Nil, Template(List(Ident(bundleClass)), emptyValDef, List(contextField, invokerCtor))))
+ val invoker = atPos(bundleClass.pos)(ClassDef(NoMods, invokerName, Nil, Template(List(Ident(bundleClass)), noSelfType, List(contextField, invokerCtor))))
currentRun.compileLate(PackageDef(invokerPid, List(invoker)))
}
diff --git a/src/compiler/scala/reflect/reify/codegen/GenTrees.scala b/src/compiler/scala/reflect/reify/codegen/GenTrees.scala
index 9de8451873..a09acc04b8 100644
--- a/src/compiler/scala/reflect/reify/codegen/GenTrees.scala
+++ b/src/compiler/scala/reflect/reify/codegen/GenTrees.scala
@@ -71,8 +71,8 @@ trait GenTrees {
def reifyTreeSyntactically(tree: Tree) = tree match {
case global.EmptyTree =>
reifyMirrorObject(EmptyTree)
- case global.emptyValDef =>
- mirrorSelect(nme.emptyValDef)
+ case global.noSelfType =>
+ mirrorSelect(nme.noSelfType)
case global.pendingSuperCall =>
mirrorSelect(nme.pendingSuperCall)
case Literal(const @ Constant(_)) =>
diff --git a/src/compiler/scala/reflect/reify/phases/Reshape.scala b/src/compiler/scala/reflect/reify/phases/Reshape.scala
index 7610df67dc..fff6978653 100644
--- a/src/compiler/scala/reflect/reify/phases/Reshape.scala
+++ b/src/compiler/scala/reflect/reify/phases/Reshape.scala
@@ -169,7 +169,7 @@ trait Reshape {
private def toPreTyperCompoundTypeTree(ctt: CompoundTypeTree): Tree = {
val CompoundTypeTree(tmpl @ Template(parents, self, stats)) = ctt
if (stats.nonEmpty) CannotReifyCompoundTypeTreeWithNonEmptyBody(ctt)
- assert(self eq emptyValDef, self)
+ assert(self eq noSelfType, self)
val att = tmpl.attachments.get[CompoundTypeTreeOriginalAttachment]
val CompoundTypeTreeOriginalAttachment(parents1, stats1) = att.getOrElse(CompoundTypeTreeOriginalAttachment(parents, stats))
CompoundTypeTree(Template(parents1, self, stats1))
diff --git a/src/compiler/scala/reflect/reify/utils/Extractors.scala b/src/compiler/scala/reflect/reify/utils/Extractors.scala
index 9af8f2de2a..d052127956 100644
--- a/src/compiler/scala/reflect/reify/utils/Extractors.scala
+++ b/src/compiler/scala/reflect/reify/utils/Extractors.scala
@@ -75,12 +75,12 @@ trait Extractors {
newTypeName(global.currentUnit.fresh.newName(flavor.toString)),
List(),
Template(List(Ident(reifierBase)),
- emptyValDef,
+ noSelfType,
List(
DefDef(NoMods, nme.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(Apply(Select(Super(This(tpnme.EMPTY), tpnme.EMPTY), nme.CONSTRUCTOR), List())), Literal(Constant(())))),
DefDef(NoMods,
reifierName,
- List(TypeDef(Modifiers(PARAM), tparamu, List(), TypeBoundsTree(Ident(NothingClass), CompoundTypeTree(Template(List(Ident(reifierUniverse), Ident(SingletonClass)), emptyValDef, List()))))),
+ List(TypeDef(Modifiers(PARAM), tparamu, List(), TypeBoundsTree(Ident(NothingClass), CompoundTypeTree(Template(List(Ident(reifierUniverse), Ident(SingletonClass)), noSelfType, List()))))),
List(List(ValDef(Modifiers(PARAM), nme.MIRROR_UNTYPED, AppliedTypeTree(Ident(MirrorClass), List(Ident(tparamu))), EmptyTree))),
reifierTpt, reifierBody))))
Block(tpec, ApplyConstructor(Ident(tpec.name), List()))
diff --git a/src/compiler/scala/tools/nsc/ast/Printers.scala b/src/compiler/scala/tools/nsc/ast/Printers.scala
index 89652c5a20..c31b5e2c0e 100644
--- a/src/compiler/scala/tools/nsc/ast/Printers.scala
+++ b/src/compiler/scala/tools/nsc/ast/Printers.scala
@@ -20,7 +20,7 @@ trait Printers extends scala.reflect.internal.Printers { this: Global =>
printTree(
if (tree.isDef && tree.symbol != NoSymbol && tree.symbol.isInitialized) {
tree match {
- case ClassDef(_, _, _, impl @ Template(ps, emptyValDef, body))
+ case ClassDef(_, _, _, impl @ Template(ps, noSelfType, body))
if (tree.symbol.thisSym != tree.symbol) =>
ClassDef(tree.symbol, Template(ps, ValDef(tree.symbol.thisSym), body))
case ClassDef(_, _, _, impl) => ClassDef(tree.symbol, impl)
diff --git a/src/compiler/scala/tools/nsc/ast/TreeGen.scala b/src/compiler/scala/tools/nsc/ast/TreeGen.scala
index 7122e864a4..28b127698f 100644
--- a/src/compiler/scala/tools/nsc/ast/TreeGen.scala
+++ b/src/compiler/scala/tools/nsc/ast/TreeGen.scala
@@ -261,7 +261,7 @@ abstract class TreeGen extends scala.reflect.internal.TreeGen with TreeDSL {
*/
def mkAnonymousNew(stats: List[Tree]): Tree = {
val stats1 = if (stats.isEmpty) List(Literal(Constant(()))) else stats
- mkNew(Nil, emptyValDef, stats1, NoPosition, NoPosition)
+ mkNew(Nil, noSelfType, stats1, NoPosition, NoPosition)
}
def mkSyntheticParam(pname: TermName) =
diff --git a/src/compiler/scala/tools/nsc/ast/Trees.scala b/src/compiler/scala/tools/nsc/ast/Trees.scala
index 381ffb1ed9..bdff5e1344 100644
--- a/src/compiler/scala/tools/nsc/ast/Trees.scala
+++ b/src/compiler/scala/tools/nsc/ast/Trees.scala
@@ -70,7 +70,7 @@ trait Trees extends scala.reflect.internal.Trees { self: Global =>
ClassDef(sym,
gen.mkTemplate(sym.info.parents map TypeTree,
- if (sym.thisSym == sym || phase.erasedTypes) emptyValDef else ValDef(sym.thisSym),
+ if (sym.thisSym == sym || phase.erasedTypes) noSelfType else ValDef(sym.thisSym),
constrMods, vparamss, body, superPos))
}
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
index a894e38ab4..a7790bec43 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
@@ -217,7 +217,7 @@ self =>
override def blockExpr(): Tree = skipBraces(EmptyTree)
- override def templateBody(isPre: Boolean) = skipBraces((emptyValDef, EmptyTree.asList))
+ override def templateBody(isPre: Boolean) = skipBraces((noSelfType, EmptyTree.asList))
}
class UnitParser(override val unit: global.CompilationUnit, patches: List[BracePatch]) extends SourceFileParser(unit.source) { uself =>
@@ -429,7 +429,7 @@ self =>
// object Main
def moduleName = newTermName(ScriptRunner scriptMain settings)
- def moduleBody = Template(atInPos(scalaAnyRefConstr) :: Nil, emptyValDef, List(emptyInit, mainDef))
+ def moduleBody = Template(atInPos(scalaAnyRefConstr) :: Nil, noSelfType, List(emptyInit, mainDef))
def moduleDef = ModuleDef(NoMods, moduleName, moduleBody)
// package <empty> { ... }
@@ -958,7 +958,7 @@ self =>
// it still gets a CompoundTypeTree.
ts.toList match {
case tp :: Nil if !hasRefinement => tp // single type, no refinement, already positioned
- case tps => atPos(t.pos.startOrPoint)(CompoundTypeTree(Template(tps, emptyValDef, refinements)))
+ case tps => atPos(t.pos.startOrPoint)(CompoundTypeTree(Template(tps, noSelfType, refinements)))
}
}
@@ -2796,7 +2796,7 @@ self =>
if (in.token == LBRACE) {
// @S: pre template body cannot stub like post body can!
val (self, body) = templateBody(isPre = true)
- if (in.token == WITH && (self eq emptyValDef)) {
+ if (in.token == WITH && (self eq noSelfType)) {
val earlyDefs: List[Tree] = body.map(ensureEarlyDef).filter(_.nonEmpty)
in.nextToken()
val parents = templateParents()
@@ -2883,7 +2883,7 @@ self =>
if (parenMeansSyntaxError) syntaxError(s"traits or objects may not have parameters", skipIt = true)
else abort("unexpected opening parenthesis")
}
- (emptyValDef, List())
+ (noSelfType, List())
}
}
@@ -2939,7 +2939,7 @@ self =>
* @param isPre specifies whether in early initializer (true) or not (false)
*/
def templateStatSeq(isPre : Boolean): (ValDef, List[Tree]) = checkNoEscapingPlaceholders {
- var self: ValDef = emptyValDef
+ var self: ValDef = noSelfType
var firstOpt: Option[Tree] = None
if (isExprIntro) {
in.flushDoc
diff --git a/src/compiler/scala/tools/nsc/javac/JavaParsers.scala b/src/compiler/scala/tools/nsc/javac/JavaParsers.scala
index 239ecb4f8a..c34ff0ce97 100644
--- a/src/compiler/scala/tools/nsc/javac/JavaParsers.scala
+++ b/src/compiler/scala/tools/nsc/javac/JavaParsers.scala
@@ -118,7 +118,7 @@ trait JavaParsers extends ast.parser.ParsersCommon with JavaScanners {
def makeTemplate(parents: List[Tree], stats: List[Tree]) =
Template(
parents,
- emptyValDef,
+ noSelfType,
if (treeInfo.firstConstructor(stats) == EmptyTree) makeConstructor(List()) :: stats
else stats)
@@ -417,7 +417,7 @@ trait JavaParsers extends ast.parser.ParsersCommon with JavaScanners {
}
val ts = buf.toList
if (ts.tail.isEmpty) ts.head
- else CompoundTypeTree(Template(ts, emptyValDef, List()))
+ else CompoundTypeTree(Template(ts, noSelfType, List()))
}
def formalParams(): List[ValDef] = {
diff --git a/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala b/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala
index d9d08dde1e..2b7c6cca2c 100644
--- a/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala
+++ b/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala
@@ -249,7 +249,7 @@ abstract class AddInterfaces extends InfoTransform { self: Erasure =>
private def ifaceMemberDef(tree: Tree): Tree = createMemberDef(tree, true)(t => DefDef(t.symbol, EmptyTree))
private def ifaceTemplate(templ: Template): Template =
- treeCopy.Template(templ, templ.parents, emptyValDef, templ.body map ifaceMemberDef)
+ treeCopy.Template(templ, templ.parents, noSelfType, templ.body map ifaceMemberDef)
/** Transforms the member tree containing the implementation
* into a member of the impl class.
@@ -280,7 +280,7 @@ abstract class AddInterfaces extends InfoTransform { self: Erasure =>
private def implTemplate(clazz: Symbol, templ: Template): Template = atPos(templ.pos) {
val templ1 = (
- Template(templ.parents, emptyValDef, addMixinConstructorDef(clazz, templ.body map implMemberDef))
+ Template(templ.parents, noSelfType, addMixinConstructorDef(clazz, templ.body map implMemberDef))
setSymbol clazz.newLocalDummy(templ.pos)
)
templ1.changeOwner(templ.symbol.owner -> clazz, templ.symbol -> templ1.symbol)
@@ -338,7 +338,7 @@ abstract class AddInterfaces extends InfoTransform { self: Erasure =>
deriveDefDef(tree)(addMixinConstructorCalls(_, sym.owner)) // (3)
case Template(parents, self, body) =>
val parents1 = sym.owner.info.parents map (t => TypeTree(t) setPos tree.pos)
- treeCopy.Template(tree, parents1, emptyValDef, body)
+ treeCopy.Template(tree, parents1, noSelfType, body)
case This(_) if sym.needsImplClass =>
val impl = implClass(sym)
var owner = currentOwner
diff --git a/src/compiler/scala/tools/nsc/transform/Erasure.scala b/src/compiler/scala/tools/nsc/transform/Erasure.scala
index 28db6a4f6d..2d005b26e3 100644
--- a/src/compiler/scala/tools/nsc/transform/Erasure.scala
+++ b/src/compiler/scala/tools/nsc/transform/Erasure.scala
@@ -1205,7 +1205,7 @@ abstract class Erasure extends AddInterfaces
assert(!currentOwner.isImplClass)
//Console.println("checking no dble defs " + tree)//DEBUG
checkNoDoubleDefs(tree.symbol.owner)
- treeCopy.Template(tree, parents, emptyValDef, addBridges(body, currentOwner))
+ treeCopy.Template(tree, parents, noSelfType, addBridges(body, currentOwner))
case Match(selector, cases) =>
Match(Typed(selector, TypeTree(selector.tpe)), cases)
diff --git a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
index 5a440039d6..2d4269a3bc 100644
--- a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
+++ b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
@@ -1844,7 +1844,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers {
mbrs += ValDef(m).setType(NoType)
} else if (m.isClass) {
// mbrs +=
-// ClassDef(m, Template(m.info.parents map TypeTree, emptyValDef, List())
+// ClassDef(m, Template(m.info.parents map TypeTree, noSelfType, List())
// .setSymbol(m.newLocalDummy(m.pos)))
// log("created synthetic class: " + m.fullName)
}
@@ -1866,7 +1866,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers {
for (((sym1, env), specCls) <- specializedClass if sym1 == tree.symbol) yield {
debuglog("created synthetic class: " + specCls + " of " + sym1 + " in " + pp(env))
val parents = specCls.info.parents.map(TypeTree)
- ClassDef(specCls, atPos(impl.pos)(Template(parents, emptyValDef, List()))
+ ClassDef(specCls, atPos(impl.pos)(Template(parents, noSelfType, List()))
.setSymbol(specCls.newLocalDummy(sym1.pos))) setPos tree.pos
}
case _ => Nil
diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
index cd2b9b3a97..315496e5f6 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
@@ -49,7 +49,7 @@ trait Contexts { self: Analyzer =>
private lazy val startContext = {
NoContext.make(
- Template(List(), emptyValDef, List()) setSymbol global.NoSymbol setType global.NoType,
+ Template(List(), noSelfType, List()) setSymbol global.NoSymbol setType global.NoType,
rootMirror.RootClass,
rootMirror.RootClass.info.decls)
}
@@ -615,7 +615,7 @@ trait Contexts { self: Analyzer =>
private def treeIdString = if (settings.uniqid.value) "#" + System.identityHashCode(tree).toString.takeRight(3) else ""
private def treeString = tree match {
case x: Import => "" + x
- case Template(parents, `emptyValDef`, body) =>
+ case Template(parents, `noSelfType`, body) =>
val pstr = if ((parents eq null) || parents.isEmpty) "Nil" else parents mkString " "
val bstr = if (body eq null) "" else body.length + " stats"
s"""Template($pstr, _, $bstr)"""
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
index 4cfac91a94..12e8b0a3f9 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
@@ -841,7 +841,7 @@ trait Namers extends MethodSynthesis {
// owner is the class with the self type
def enterSelf(self: ValDef) {
val ValDef(_, name, tpt, _) = self
- if (self eq emptyValDef)
+ if (self eq noSelfType)
return
val hasName = name != nme.WILDCARD
diff --git a/src/compiler/scala/tools/nsc/typechecker/Unapplies.scala b/src/compiler/scala/tools/nsc/typechecker/Unapplies.scala
index af19e3cf80..0c7c42db17 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Unapplies.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Unapplies.scala
@@ -119,7 +119,7 @@ trait Unapplies extends ast.TreeDSL {
ModuleDef(
Modifiers(cdef.mods.flags & AccessFlags | SYNTHETIC, cdef.mods.privateWithin),
cdef.name.toTermName,
- gen.mkTemplate(parents, emptyValDef, NoMods, Nil, body, cdef.impl.pos.focus))
+ gen.mkTemplate(parents, noSelfType, NoMods, Nil, body, cdef.impl.pos.focus))
}
/** The apply method corresponding to a case class
diff --git a/src/compiler/scala/tools/reflect/ToolBoxFactory.scala b/src/compiler/scala/tools/reflect/ToolBoxFactory.scala
index 2d905d5436..b60db38ae7 100644
--- a/src/compiler/scala/tools/reflect/ToolBoxFactory.scala
+++ b/src/compiler/scala/tools/reflect/ToolBoxFactory.scala
@@ -222,7 +222,7 @@ abstract class ToolBoxFactory[U <: JavaUniverse](val u: U) { factorySelf =>
obj,
gen.mkTemplate(
List(TypeTree(ObjectTpe)),
- emptyValDef,
+ noSelfType,
NoMods,
List(),
List(methdef),
diff --git a/src/reflect/scala/reflect/api/Printers.scala b/src/reflect/scala/reflect/api/Printers.scala
index 81d30dec1e..6e2e2c3781 100644
--- a/src/reflect/scala/reflect/api/Printers.scala
+++ b/src/reflect/scala/reflect/api/Printers.scala
@@ -48,7 +48,7 @@ import java.io.{ PrintWriter, StringWriter }
* res1: String = Block(List(
* ClassDef(Modifiers(FINAL), newTypeName("C"), List(), Template(
* List(Ident(newTypeName("AnyRef"))),
- * emptyValDef,
+ * noSelfType,
* List(
* DefDef(Modifiers(), nme.CONSTRUCTOR, List(), List(List()), TypeTree(),
* Block(List(
@@ -72,7 +72,7 @@ import java.io.{ PrintWriter, StringWriter }
* res2: String = Block[1](List(
* ClassDef[2](Modifiers(FINAL), newTypeName("C"), List(), Template[3](
* List(Ident[4](newTypeName("AnyRef"))),
- * emptyValDef,
+ * noSelfType,
* List(
* DefDef[2](Modifiers(), nme.CONSTRUCTOR, List(), List(List()), TypeTree[3](),
* Block[1](List(
diff --git a/src/reflect/scala/reflect/api/Trees.scala b/src/reflect/scala/reflect/api/Trees.scala
index 7a627bc875..fa7d41f0fc 100644
--- a/src/reflect/scala/reflect/api/Trees.scala
+++ b/src/reflect/scala/reflect/api/Trees.scala
@@ -71,20 +71,13 @@ trait Trees { self: Universe =>
/** Is this tree one of the empty trees?
*
- * Empty trees are: the `EmptyTree` null object, `TypeTree` instances that don't carry a type
- * and the special `emptyValDef` singleton.
- *
- * In the compiler the `isEmpty` check and the derived `orElse` method are mostly used
- * as a check for a tree being a null object (`EmptyTree` for term trees and empty TypeTree for type trees).
- *
- * Unfortunately `emptyValDef` is also considered to be `isEmpty`, but this is deemed to be
- * a conceptual mistake pending a fix in https://issues.scala-lang.org/browse/SI-6762.
+ * Empty trees are: the `EmptyTree` null object and `TypeTree` instances that don't carry a type.
*
* @see `canHaveAttrs`
*/
def isEmpty: Boolean
- /** Is this tree one of the empty trees?
+ /** Is this tree not an empty tree?
*
* @see `isEmpty`
*/
@@ -92,7 +85,7 @@ trait Trees { self: Universe =>
/** Can this tree carry attributes (i.e. symbols, types or positions)?
* Typically the answer is yes, except for the `EmptyTree` null object and
- * two special singletons: `emptyValDef` and `pendingSuperCall`.
+ * two special singletons: `noSelfType` and `pendingSuperCall`.
*/
def canHaveAttrs: Boolean
@@ -856,7 +849,7 @@ trait Trees { self: Universe =>
def parents: List[Tree]
/** Self type of the template.
- * Is equal to `emptyValDef` if the self type is not specified.
+ * Is equal to `noSelfType` if the self type is not specified.
*/
def self: ValDef
@@ -2121,6 +2114,9 @@ trait Trees { self: Universe =>
* no definition of a self value of self type.
* @group Trees
*/
+ val noSelfType: ValDef
+
+ @deprecated("Use `noSelfType` instead", "2.11.0")
val emptyValDef: ValDef
/** An empty superclass constructor call corresponding to:
@@ -2635,7 +2631,7 @@ trait Trees { self: Universe =>
trees mapConserve (tree => transform(tree).asInstanceOf[TypeDef])
/** Transforms a `ValDef`. */
def transformValDef(tree: ValDef): ValDef =
- if (tree eq emptyValDef) tree
+ if (tree eq noSelfType) tree
else transform(tree).asInstanceOf[ValDef]
/** Transforms a list of `ValDef` nodes. */
def transformValDefs(trees: List[ValDef]): List[ValDef] =
diff --git a/src/reflect/scala/reflect/internal/BuildUtils.scala b/src/reflect/scala/reflect/internal/BuildUtils.scala
index e5c7dc44af..25186ae95b 100644
--- a/src/reflect/scala/reflect/internal/BuildUtils.scala
+++ b/src/reflect/scala/reflect/internal/BuildUtils.scala
@@ -63,7 +63,7 @@ trait BuildUtils { self: SymbolTable =>
def setSymbol[T <: Tree](tree: T, sym: Symbol): T = { tree.setSymbol(sym); tree }
def mkAnnotation(tree: Tree): Tree = tree match {
- case SyntacticNew(Nil, SyntacticApplied(SyntacticTypeApplied(_, _), _) :: Nil, emptyValDef, Nil) =>
+ case SyntacticNew(Nil, SyntacticApplied(SyntacticTypeApplied(_, _), _) :: Nil, noSelfType, Nil) =>
tree
case _ =>
throw new IllegalArgumentException(s"Tree ${showRaw(tree)} isn't a correct representation of annotation." +
@@ -364,7 +364,7 @@ trait BuildUtils { self: SymbolTable =>
def unapply(tree: Tree): Option[(List[Tree], List[Tree], ValDef, List[Tree])] = tree match {
case SyntacticApplied(Select(New(SyntacticTypeApplied(ident, targs)), nme.CONSTRUCTOR), argss) =>
- Some((Nil, SyntacticApplied(SyntacticTypeApplied(ident, targs), argss) :: Nil, emptyValDef, Nil))
+ Some((Nil, SyntacticApplied(SyntacticTypeApplied(ident, targs), argss) :: Nil, noSelfType, Nil))
case SyntacticBlock(SyntacticClassDef(_, tpnme.ANON_CLASS_NAME, Nil, _, ListOfNil, earlyDefs, parents, selfdef, body) ::
Apply(Select(New(Ident(tpnme.ANON_CLASS_NAME)), nme.CONSTRUCTOR), Nil) :: Nil) =>
Some((earlyDefs, parents, selfdef, body))
diff --git a/src/reflect/scala/reflect/internal/Importers.scala b/src/reflect/scala/reflect/internal/Importers.scala
index 9ddf156128..72c8ccfa62 100644
--- a/src/reflect/scala/reflect/internal/Importers.scala
+++ b/src/reflect/scala/reflect/internal/Importers.scala
@@ -308,8 +308,8 @@ trait Importers extends api.Importers { to: SymbolTable =>
new PackageDef(importRefTree(pid), stats map importTree)
case from.ModuleDef(mods, name, impl) =>
new ModuleDef(importModifiers(mods), importName(name).toTermName, importTemplate(impl))
- case from.emptyValDef =>
- emptyValDef
+ case from.noSelfType =>
+ noSelfType
case from.pendingSuperCall =>
pendingSuperCall
case from.ValDef(mods, name, tpt, rhs) =>
@@ -412,7 +412,7 @@ trait Importers extends api.Importers { to: SymbolTable =>
addFixup(recreatedTreeCompleter(their, my))
tryFixup()
// we have to be careful with position import as some shared trees
- // like EmptyTree, emptyValDef don't support position assignment
+ // like EmptyTree, noSelfType don't support position assignment
if (their.pos != NoPosition) {
my.setPos(importPosition(their.pos))
}
diff --git a/src/reflect/scala/reflect/internal/Printers.scala b/src/reflect/scala/reflect/internal/Printers.scala
index 206dff44e2..424e73dce8 100644
--- a/src/reflect/scala/reflect/internal/Printers.scala
+++ b/src/reflect/scala/reflect/internal/Printers.scala
@@ -549,8 +549,8 @@ trait Printers extends api.Printers { self: SymbolTable =>
print(")")
case EmptyTree =>
print("EmptyTree")
- case self.emptyValDef =>
- print("emptyValDef")
+ case self.noSelfType =>
+ print("noSelfType")
case self.pendingSuperCall =>
print("pendingSuperCall")
case tree: Tree =>
diff --git a/src/reflect/scala/reflect/internal/StdNames.scala b/src/reflect/scala/reflect/internal/StdNames.scala
index f4eae5590a..dc5c6704bc 100644
--- a/src/reflect/scala/reflect/internal/StdNames.scala
+++ b/src/reflect/scala/reflect/internal/StdNames.scala
@@ -661,7 +661,7 @@ trait StdNames {
val dollarScope: NameType = "$scope"
val drop: NameType = "drop"
val elem: NameType = "elem"
- val emptyValDef: NameType = "emptyValDef"
+ val noSelfType: NameType = "noSelfType"
val ensureAccessible : NameType = "ensureAccessible"
val eq: NameType = "eq"
val equalsNumChar : NameType = "equalsNumChar"
diff --git a/src/reflect/scala/reflect/internal/Trees.scala b/src/reflect/scala/reflect/internal/Trees.scala
index 2163a26b84..b1fc27f832 100644
--- a/src/reflect/scala/reflect/internal/Trees.scala
+++ b/src/reflect/scala/reflect/internal/Trees.scala
@@ -1037,9 +1037,11 @@ trait Trees extends api.Trees { self: SymbolTable =>
}
case object EmptyTree extends TermTree with CannotHaveAttrs { override def isEmpty = true; val asList = List(this) }
- object emptyValDef extends ValDef(Modifiers(PRIVATE), nme.WILDCARD, TypeTree(NoType), EmptyTree) with CannotHaveAttrs
+ object noSelfType extends ValDef(Modifiers(PRIVATE), nme.WILDCARD, TypeTree(NoType), EmptyTree) with CannotHaveAttrs
object pendingSuperCall extends Apply(Select(Super(This(tpnme.EMPTY), tpnme.EMPTY), nme.CONSTRUCTOR), List()) with CannotHaveAttrs
+ @deprecated("Use `noSelfType` instead", "2.11.0") lazy val emptyValDef = noSelfType
+
def newValDef(sym: Symbol, rhs: Tree)(
mods: Modifiers = Modifiers(sym.flags),
name: TermName = sym.name.toTermName,
@@ -1196,7 +1198,7 @@ trait Trees extends api.Trees { self: SymbolTable =>
traverse(annot); traverse(arg)
case Template(parents, self, body) =>
traverseTrees(parents)
- if (self ne emptyValDef) traverse(self)
+ if (self ne noSelfType) traverse(self)
traverseStats(body, tree.symbol)
case Block(stats, expr) =>
traverseTrees(stats); traverse(expr)