diff options
Diffstat (limited to 'src/compiler')
20 files changed, 69 insertions, 47 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/reporters/AbstractReporter.scala b/src/compiler/scala/tools/nsc/reporters/AbstractReporter.scala index a67c207820..16d432438a 100644 --- a/src/compiler/scala/tools/nsc/reporters/AbstractReporter.scala +++ b/src/compiler/scala/tools/nsc/reporters/AbstractReporter.scala @@ -18,11 +18,13 @@ abstract class AbstractReporter extends Reporter { def display(pos: Position, msg: String, severity: Severity): Unit def displayPrompt(): Unit - private val positions = new mutable.HashMap[Position, Severity] + private val positions = mutable.Map[Position, Severity]() withDefaultValue INFO + private val messages = mutable.Map[Position, List[String]]() withDefaultValue Nil override def reset() { super.reset() positions.clear() + messages.clear() } private def isVerbose = settings.verbose.value @@ -37,13 +39,14 @@ abstract class AbstractReporter extends Reporter { } } else { - val hidden = testAndLog(pos, severity) + val hidden = testAndLog(pos, severity, msg) if (severity == WARNING && noWarnings) () else { if (!hidden || isPromptSet) { severity.count += 1 display(pos, msg, severity) - } else if (settings.debug) { + } + else if (settings.debug) { severity.count += 1 display(pos, "[ suppressed ] " + msg, severity) } @@ -57,12 +60,20 @@ abstract class AbstractReporter extends Reporter { /** Logs a position and returns true if it was already logged. * @note Two positions are considered identical for logging if they have the same point. */ - private def testAndLog(pos: Position, severity: Severity): Boolean = + private def testAndLog(pos: Position, severity: Severity, msg: String): Boolean = pos != null && pos.isDefined && { val fpos = pos.focus - (positions get fpos) match { - case Some(level) if level >= severity => true - case _ => positions += (fpos -> severity) ; false + val suppress = positions(fpos) match { + case ERROR => true // already error at position + case highest if highest > severity => true // already message higher than present severity + case `severity` => messages(fpos) contains msg // already issued this exact message + case _ => false // good to go + } + + suppress || { + positions(fpos) = severity + messages(fpos) ::= msg + false } } } diff --git a/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala b/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala index 6f27eb8660..8b739958ff 100644 --- a/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala +++ b/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala @@ -164,10 +164,17 @@ abstract class SymbolLoaders { if (settings.verbose) inform("[symloader] no class, picked up source file for " + src.path) enterToplevelsFromSource(owner, classRep.name, src) case (Some(bin), _) => - enterClassAndModule(owner, classRep.name, new ClassfileLoader(bin)) + enterClassAndModule(owner, classRep.name, newClassLoader(bin)) } } + /** Create a new loader from a binary classfile. + * This is intented as a hook allowing to support loading symbols from + * files other than .class files. + */ + protected def newClassLoader(bin: AbstractFile): SymbolLoader = + new ClassfileLoader(bin) + /** * A lazy type that completes itself by calling parameter doComplete. * Any linked modules/classes or module classes are also initialized. 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 347426d42a..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 @@ -1272,9 +1272,7 @@ trait Namers extends MethodSynthesis { val defRhs = copyUntyped(vparam.rhs) val defaultTree = atPos(vparam.pos.focus) { - DefDef( - Modifiers(meth.flags & DefaultGetterFlags) | (SYNTHETIC | DEFAULTPARAM | oflag).toLong, - name, deftParams, defvParamss, defTpt, defRhs) + DefDef(Modifiers(paramFlagsToDefaultGetter(meth.flags)) | oflag, name, deftParams, defvParamss, defTpt, defRhs) } if (!isConstr) methOwner.resetFlag(INTERFACE) // there's a concrete member now diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala index 61759a9f00..f3aed66bc5 100644 --- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala +++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala @@ -127,14 +127,14 @@ abstract class RefChecks extends InfoTransform with scala.reflect.internal.trans // those with the DEFAULTPARAM flag, and infer the methods. Looking for the methods // directly requires inspecting the parameter list of every one. That modification // shaved 95% off the time spent in this method. - val defaultGetters = defaultClass.info.findMembers(0L, DEFAULTPARAM) + val defaultGetters = defaultClass.info.findMembers(excludedFlags = PARAM, requiredFlags = DEFAULTPARAM) val defaultMethodNames = defaultGetters map (sym => nme.defaultGetterToMethod(sym.name)) defaultMethodNames.toList.distinct foreach { name => - val methods = clazz.info.findMember(name, 0L, METHOD, stableOnly = false).alternatives + val methods = clazz.info.findMember(name, 0L, requiredFlags = METHOD, stableOnly = false).alternatives def hasDefaultParam(tpe: Type): Boolean = tpe match { case MethodType(params, restpe) => (params exists (_.hasDefault)) || hasDefaultParam(restpe) - case _ => false + case _ => false } val haveDefaults = methods filter (sym => hasDefaultParam(sym.info) && !nme.isProtectedAccessorName(sym.name)) @@ -411,7 +411,7 @@ abstract class RefChecks extends InfoTransform with scala.reflect.internal.trans overrideError("cannot be used here - classes can only override abstract types") } else if (other.isEffectivelyFinal) { // (1.2) overrideError("cannot override final member") - } else if (!other.isDeferred && !other.hasFlag(DEFAULTMETHOD) && !member.isAnyOverride && !member.isSynthetic) { // (*) + } else if (!other.isDeferredOrDefault && !other.hasFlag(DEFAULTMETHOD) && !member.isAnyOverride && !member.isSynthetic) { // (*) // (*) Synthetic exclusion for (at least) default getters, fixes SI-5178. We cannot assign the OVERRIDE flag to // the default getter: one default getter might sometimes override, sometimes not. Example in comment on ticket. if (isNeitherInClass && !(other.owner isSubClass member.owner)) @@ -596,7 +596,7 @@ abstract class RefChecks extends InfoTransform with scala.reflect.internal.trans def checkNoAbstractMembers(): Unit = { // Avoid spurious duplicates: first gather any missing members. def memberList = clazz.info.nonPrivateMembersAdmitting(VBRIDGE) - val (missing, rest) = memberList partition (m => m.isDeferred && !ignoreDeferred(m)) + val (missing, rest) = memberList partition (m => m.isDeferredNotDefault && !ignoreDeferred(m)) // Group missing members by the name of the underlying symbol, // to consolidate getters and setters. val grouped = missing groupBy (sym => analyzer.underlyingSymbol(sym).name) 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/nsc/util/ClassPath.scala b/src/compiler/scala/tools/nsc/util/ClassPath.scala index 906a575d90..c63d7f6820 100644 --- a/src/compiler/scala/tools/nsc/util/ClassPath.scala +++ b/src/compiler/scala/tools/nsc/util/ClassPath.scala @@ -96,6 +96,12 @@ object ClassPath { */ def isValidName(name: String): Boolean = true + /** Filters for assessing validity of various entities. + */ + def validClassFile(name: String) = endsClass(name) && isValidName(name) + def validPackage(name: String) = (name != "META-INF") && (name != "") && (name.charAt(0) != '.') + def validSourceFile(name: String) = endsScala(name) || endsJava(name) + /** From the representation to its identifier. */ def toBinaryName(rep: T): String @@ -208,9 +214,9 @@ abstract class ClassPath[T] { /** Filters for assessing validity of various entities. */ - def validClassFile(name: String) = endsClass(name) && context.isValidName(name) - def validPackage(name: String) = (name != "META-INF") && (name != "") && (name.charAt(0) != '.') - def validSourceFile(name: String) = endsScala(name) || endsJava(name) + def validClassFile(name: String) = context.validClassFile(name) + def validPackage(name: String) = context.validPackage(name) + def validSourceFile(name: String) = context.validSourceFile(name) /** * Find a ClassRep given a class name of the form "package.subpackage.ClassName". 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), |