diff options
author | Martin Odersky <odersky@gmail.com> | 2010-02-01 15:49:33 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2010-02-01 15:49:33 +0000 |
commit | b6cdaaa3db2bf7f3e7a3648247ee5401c5ff63cd (patch) | |
tree | 76d1810efc13558e12769c1f7ad1f75d0a4bac23 /src/compiler | |
parent | e75346d68d46f188dbcd7d76707d9c6f778f7803 (diff) | |
download | scala-b6cdaaa3db2bf7f3e7a3648247ee5401c5ff63cd.tar.gz scala-b6cdaaa3db2bf7f3e7a3648247ee5401c5ff63cd.tar.bz2 scala-b6cdaaa3db2bf7f3e7a3648247ee5401c5ff63cd.zip |
missing bits of r20746.
Diffstat (limited to 'src/compiler')
31 files changed, 108 insertions, 845 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/icode/Checkers.scala b/src/compiler/scala/tools/nsc/backend/icode/Checkers.scala index a441f69b59..cbbd92a69b 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/Checkers.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/Checkers.scala @@ -84,13 +84,13 @@ abstract class Checkers { for (f1 <- cls.fields; f2 <- cls.fields if f1 ne f2) if (f1.symbol.name == f2.symbol.name) Checkers.this.global.error("Repetitive field name: " + - f1.symbol.fullNameString); + f1.symbol.fullName); for (m1 <- cls.methods; m2 <- cls.methods if m1 ne m2) if (m1.symbol.name == m2.symbol.name && m1.symbol.tpe =:= m2.symbol.tpe) Checkers.this.global.error("Repetitive method: " + - m1.symbol.fullNameString); + m1.symbol.fullName); clasz.methods.foreach(check) } @@ -241,15 +241,15 @@ abstract class Checkers { receiver match { case REFERENCE(sym) => checkBool(sym.info.member(method.name) != NoSymbol, - "Method " + method + " does not exist in " + sym.fullNameString); + "Method " + method + " does not exist in " + sym.fullName); if (method hasFlag Flags.PRIVATE) checkBool(method.owner == clasz.symbol, - "Cannot call private method of " + method.owner.fullNameString - + " from " + clasz.symbol.fullNameString); + "Cannot call private method of " + method.owner.fullName + + " from " + clasz.symbol.fullName); else if (method hasFlag Flags.PROTECTED) checkBool(clasz.symbol isSubClass method.owner, - "Cannot call protected method of " + method.owner.fullNameString - + " from " + clasz.symbol.fullNameString); + "Cannot call protected method of " + method.owner.fullName + + " from " + clasz.symbol.fullName); case ARRAY(_) => checkBool(receiver.toType.member(method.name) != NoSymbol, diff --git a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala index da695e45d7..4252fa7905 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala @@ -11,7 +11,6 @@ package icode import scala.collection.mutable.{Map, HashMap, ListBuffer, Buffer, HashSet} import scala.tools.nsc.symtab._ -import scala.tools.nsc.util.Position import scala.annotation.switch import PartialFunction._ @@ -97,7 +96,7 @@ abstract class GenICode extends SubComponent { gen(stats, ctx setPackage pid.name) case ClassDef(mods, name, _, impl) => - log("Generating class: " + tree.symbol.fullNameString) + log("Generating class: " + tree.symbol.fullName) val outerClass = ctx.clazz ctx setClass (new IClass(tree.symbol) setCompilationUnit unit) addClassFields(ctx, tree.symbol); @@ -215,7 +214,7 @@ abstract class GenICode extends SubComponent { case scalaPrimitives.NOT => ctx1.bb.emit(CALL_PRIMITIVE(Arithmetic(NOT, resKind)), larg.pos) case _ => - abort("Unknown unary operation: " + fun.symbol.fullNameString + + abort("Unknown unary operation: " + fun.symbol.fullName + " code: " + code) } @@ -454,7 +453,7 @@ abstract class GenICode extends SubComponent { genCoercion(tree, ctx1, code) (ctx1, scalaPrimitives.generatedKind(code)) } - else abort("Primitive operation not handled yet: " + sym.fullNameString + "(" + + else abort("Primitive operation not handled yet: " + sym.fullName + "(" + fun.symbol.simpleName + ") " + " at: " + (tree.pos)) } @@ -574,7 +573,7 @@ abstract class GenICode extends SubComponent { val cast = sym match { case Object_isInstanceOf => false case Object_asInstanceOf => true - case _ => abort("Unexpected type application " + fun + "[sym: " + sym.fullNameString + "]" + " in: " + tree) + case _ => abort("Unexpected type application " + fun + "[sym: " + sym.fullName + "]" + " in: " + tree) } val Select(obj, _) = fun @@ -658,7 +657,7 @@ abstract class GenICode extends SubComponent { case rt @ REFERENCE(cls) => if (settings.debug.value) assert(ctor.owner == cls, - "Symbol " + ctor.owner.fullNameString + " is different than " + tpt) + "Symbol " + ctor.owner.fullName + " is different than " + tpt) val nw = NEW(rt) ctx.bb.emit(nw, tree.pos) ctx.bb.emit(DUP(generatedType)) @@ -675,7 +674,7 @@ abstract class GenICode extends SubComponent { case Apply(fun @ _, List(expr)) if (definitions.isBox(fun.symbol)) => if (settings.debug.value) - log("BOX : " + fun.symbol.fullNameString); + log("BOX : " + fun.symbol.fullName); val ctx1 = genLoad(expr, ctx, toTypeKind(expr.tpe)) val nativeKind = toTypeKind(expr.tpe) if (settings.Xdce.value) { @@ -692,7 +691,7 @@ abstract class GenICode extends SubComponent { case Apply(fun @ _, List(expr)) if (definitions.isUnbox(fun.symbol)) => if (settings.debug.value) - log("UNBOX : " + fun.symbol.fullNameString) + log("UNBOX : " + fun.symbol.fullName) val ctx1 = genLoad(expr, ctx, toTypeKind(expr.tpe)) val boxType = toTypeKind(fun.symbol.owner.linkedClassOfClass.tpe) generatedType = boxType @@ -754,8 +753,8 @@ abstract class GenICode extends SubComponent { else cm setHostClass qualSym if (settings.debug.value) log( - if (qualSym == ArrayClass) "Stored target type kind " + toTypeKind(qual.tpe) + " for " + sym.fullNameString - else "Set more precise host class for " + sym.fullNameString + " host: " + qualSym + if (qualSym == ArrayClass) "Stored target type kind " + toTypeKind(qual.tpe) + " for " + sym.fullName + else "Set more precise host class for " + sym.fullName + " host: " + qualSym ) case _ => } diff --git a/src/compiler/scala/tools/nsc/backend/icode/Members.scala b/src/compiler/scala/tools/nsc/backend/icode/Members.scala index a5c740f9e5..82e99d50ac 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/Members.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/Members.scala @@ -108,7 +108,7 @@ trait Members { self: ICodes => this } - override def toString() = symbol.fullNameString + override def toString() = symbol.fullName def lookupField(s: Symbol) = fields find (_.symbol == s) def lookupMethod(s: Symbol) = methods find (_.symbol == s) @@ -201,7 +201,7 @@ trait Members { self: ICodes => /* determines whether or not this method is the class static constructor. */ def isStaticCtor: Boolean = isStatic && symbol.rawname == nme.CONSTRUCTOR - override def toString() = symbol.fullNameString + override def toString() = symbol.fullName import opcodes._ def checkLocals: Unit = if (code ne null) { diff --git a/src/compiler/scala/tools/nsc/backend/icode/Opcodes.scala b/src/compiler/scala/tools/nsc/backend/icode/Opcodes.scala index f7baab286b..be580d7154 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/Opcodes.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/Opcodes.scala @@ -170,7 +170,7 @@ trait Opcodes { self: ICodes => case class LOAD_FIELD(field: Symbol, isStatic: Boolean) extends Instruction { /** Returns a string representation of this instruction */ override def toString(): String = - "LOAD_FIELD " + (if (isStatic) field.fullNameString else field.toString()); + "LOAD_FIELD " + (if (isStatic) field.fullName else field.toString()); override def consumed = if (isStatic) 0 else 1 override def produced = 1 @@ -320,7 +320,7 @@ trait Opcodes { self: ICodes => case class CALL_METHOD(method: Symbol, style: InvokeStyle) extends Instruction { /** Returns a string representation of this instruction */ override def toString(): String = - "CALL_METHOD " + hostClass.fullNameString + method.fullNameString +" ("+style.toString()+")"; + "CALL_METHOD " + hostClass.fullName + method.fullName +" ("+style.toString()+")"; var hostClass: Symbol = method.owner; def setHostClass(cls: Symbol): this.type = { hostClass = cls; this } diff --git a/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala b/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala index 8e06e6b5f9..2c4a1c5b5f 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala @@ -261,7 +261,7 @@ trait TypeKinds { self: ICodes => "REFERENCE to NoSymbol not allowed!") override def toString(): String = - "REFERENCE(" + cls.fullNameString + ")" + "REFERENCE(" + cls.fullName + ")" /** * Approximate `lub'. The common type of two references is @@ -306,7 +306,7 @@ trait TypeKinds { self: ICodes => // abort(toString() + " maxType " + other.toString()); // override def toString(): String = -// "VALUE(" + cls.fullNameString + ")"; +// "VALUE(" + cls.fullName + ")"; // } def ArrayN(elem: TypeKind, dims: Int): ARRAY = { diff --git a/src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala b/src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala index b0fef79fa4..d71fa8420d 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala @@ -528,7 +528,7 @@ abstract class CopyPropagation { final def invalidateRecords(state: copyLattice.State) { def shouldRetain(sym: Symbol): Boolean = { if (sym.hasFlag(symtab.Flags.MUTABLE)) - log("dropping binding for " + sym.fullNameString) + log("dropping binding for " + sym.fullName) !sym.hasFlag(symtab.Flags.MUTABLE) } state.stack = state.stack map { v => v match { @@ -575,7 +575,7 @@ abstract class CopyPropagation { // this relies on having the same order in paramAccessors and // the arguments on the stack. It should be the same! for ((p, i) <- paramAccessors.zipWithIndex) { -// assert(p.tpe == paramTypes(i), "In: " + ctor.fullNameString +// assert(p.tpe == paramTypes(i), "In: " + ctor.fullName // + " having acc: " + (paramAccessors map (_.tpe))+ " vs. params" + paramTypes // + "\n\t failed at pos " + i + " with " + p.tpe + " == " + paramTypes(i)) if (p.tpe == paramTypes(i)) diff --git a/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala b/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala index 9cc0c93928..132e85f6d3 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala @@ -180,7 +180,7 @@ abstract class TypeFlowAnalysis { assert(visited.contains(b), "Block " + b + " in " + this.method + " has input equal to bottom -- not visited? .." + visited)); } -// log("" + method.symbol.fullNameString + " [" + method.code.blocks.size + " blocks] " +// log("" + method.symbol.fullName + " [" + method.code.blocks.size + " blocks] " // + "\n\t" + iterations + " iterations: " + t + " ms." // + "\n\tlubs: " + typeFlowLattice.lubs + " out of which " + icodes.lubs0 + " typer lubs") } diff --git a/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala b/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala index 794f05ce17..4f8bb63e74 100644 --- a/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala +++ b/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala @@ -13,7 +13,6 @@ import java.nio.{ByteBuffer, ByteOrder} import scala.collection.mutable.{Map, HashMap, HashSet, Stack, ListBuffer} import scala.tools.nsc.symtab._ -import scala.tools.nsc.util.Position import ch.epfl.lamp.compiler.msil.{Type => MsilType, _} import ch.epfl.lamp.compiler.msil.emit._ @@ -518,7 +517,7 @@ abstract class GenMSIL extends SubComponent { dumpMirrorClass(sym) else log("No mirror class for module with linked class: " + - sym.fullNameString) + sym.fullName) } addSymtabAttribute(sym, tBuilder) @@ -1532,7 +1531,7 @@ abstract class GenMSIL extends SubComponent { return "scala.runtime.Null$" (if (sym.isClass || (sym.isModule && !sym.isMethod)) - sym.fullNameString + sym.fullName else sym.simpleName.toString().trim()) + suffix } @@ -1677,7 +1676,7 @@ abstract class GenMSIL extends SubComponent { case None => def typeString(sym: Symbol): String = { val s = if (sym.isNestedClass) typeString(sym.owner) +"+"+ sym.simpleName - else sym.fullNameString + else sym.fullName if (sym.isModuleClass && !sym.isTrait) s + "$" else s } val name = typeString(sym) @@ -1755,7 +1754,7 @@ abstract class GenMSIL extends SubComponent { for (ifield <- iclass.fields) { val sym = ifield.symbol if (settings.debug.value) - log("Adding field: " + sym.fullNameString) + log("Adding field: " + sym.fullName) var attributes = msilFieldFlags(sym) val fBuilder = mtype.DefineField(msilName(sym), msilType(sym.tpe), attributes) @@ -1768,7 +1767,7 @@ abstract class GenMSIL extends SubComponent { val sym = m.symbol if (settings.debug.value) log("Creating MethodBuilder for " + Flags.flagsToString(sym.flags) + " " + - sym.owner.fullNameString + "::" + sym.name) + sym.owner.fullName + "::" + sym.name) val ownerType = getType(sym.enclClass).asInstanceOf[TypeBuilder] assert(mtype == ownerType, "mtype = " + mtype + "; ownerType = " + ownerType) @@ -1855,7 +1854,7 @@ abstract class GenMSIL extends SubComponent { case Some(sym) => sym case None => //val mclass = types(moduleClassSym) - val mClass = clrTypes.getType(moduleClassSym.fullNameString + "$") + val mClass = clrTypes.getType(moduleClassSym.fullName + "$") val mfield = mClass.GetField("MODULE$") assert(mfield ne null, "module not found " + showsym(moduleClassSym)) fields(moduleClassSym) = mfield @@ -2039,7 +2038,7 @@ abstract class GenMSIL extends SubComponent { if (constr eq null) { System.out.println("Cannot find constructor " + sym.owner + "::" + sym.name) System.out.println("scope = " + sym.owner.tpe.decls) - throw new Error(sym.fullNameString) + throw new Error(sym.fullName) } else { mapConstructor(sym, constr) @@ -2073,7 +2072,7 @@ abstract class GenMSIL extends SubComponent { if (method eq null) { System.out.println("Cannot find method " + sym.owner + "::" + msilName(sym)) System.out.println("scope = " + sym.owner.tpe.decls) - throw new Error(sym.fullNameString) + throw new Error(sym.fullName) } else { mapMethod(sym, method) diff --git a/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala b/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala index 14b168824a..22667dff49 100644 --- a/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala +++ b/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala @@ -328,10 +328,10 @@ abstract class Inliners extends SubComponent { if (receiver != msym.owner && receiver != NoSymbol) { if (settings.debug.value) log("" + i + " has actual receiver: " + receiver); - if (!concreteMethod.isFinal && receiver.isFinal) { + if (!concreteMethod.isEffectivelyFinal && receiver.isFinal) { concreteMethod = lookupImpl(concreteMethod, receiver) if (settings.debug.value) - log("\tlooked up method: " + concreteMethod.fullNameString) + log("\tlooked up method: " + concreteMethod.fullName) } } @@ -342,11 +342,11 @@ abstract class Inliners extends SubComponent { log("Treating " + i + "\n\treceiver: " + receiver + "\n\ticodes.available: " + icodes.available(receiver) - + "\n\tconcreteMethod.isFinal: " + concreteMethod.isFinal); + + "\n\tconcreteMethod.isEffectivelyFinal: " + concreteMethod.isFinal); if ( icodes.available(receiver) && (isClosureClass(receiver) - || concreteMethod.isFinal + || concreteMethod.isEffectivelyFinal || receiver.isFinal)) { icodes.icode(receiver).get.lookupMethod(concreteMethod) match { case Some(inc) => @@ -387,7 +387,7 @@ abstract class Inliners extends SubComponent { } info = tfa.interpret(info, i) }}} - if (tfa.stat) log(m.symbol.fullNameString + " iterations: " + tfa.iterations + " (size: " + m.code.blocks.length + ")") + if (tfa.stat) log(m.symbol.fullName + " iterations: " + tfa.iterations + " (size: " + m.code.blocks.length + ")") }} while (retry && count < 15) m.normalize } @@ -402,7 +402,7 @@ abstract class Inliners extends SubComponent { /** Should the given method be loaded from disk? */ def shouldLoad(receiver: Symbol, method: Symbol): Boolean = { if (settings.debug.value) log("shouldLoad: " + receiver + "." + method) - ((method.isFinal && isMonadMethod(method) && isHigherOrderMethod(method)) + ((method.isEffectivelyFinal && isMonadMethod(method) && isHigherOrderMethod(method)) || (receiver.enclosingPackage == definitions.ScalaRunTimeModule.enclosingPackage) || (receiver == definitions.PredefModule.moduleClass) || (method.hasAnnotation(ScalaInlineAttr))) @@ -488,7 +488,7 @@ abstract class Inliners extends SubComponent { } private def lookupImpl(meth: Symbol, clazz: Symbol): Symbol = { - //println("\t\tlooking up " + meth + " in " + clazz.fullNameString + " meth.owner = " + meth.owner) + //println("\t\tlooking up " + meth + " in " + clazz.fullName + " meth.owner = " + meth.owner) if (meth.owner == clazz || clazz == definitions.NullClass || clazz == definitions.NothingClass) meth diff --git a/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala b/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala index 7503c4dcc5..434e2b4572 100644 --- a/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala +++ b/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala @@ -9,7 +9,6 @@ import comment._ import scala.collection._ import symtab.Flags -import util.Position /** This trait extracts all required information for documentation from compilation units */ class ModelFactory(val global: Global, val settings: doc.Settings) { extractor => @@ -466,7 +465,7 @@ class ModelFactory(val global: Global, val settings: doc.Settings) { extractor = nameBuffer append ')' case TypeRef(pre, aSym, targs) => val bSym = normalizeTemplate(aSym) - if (bSym.isTypeMember) + if (bSym.isNonClassType) nameBuffer append bSym.name else { val tpl = makeTemplate(bSym) diff --git a/src/compiler/scala/tools/nsc/interactive/Global.scala b/src/compiler/scala/tools/nsc/interactive/Global.scala index db69e4cb42..09aa4efd39 100644 --- a/src/compiler/scala/tools/nsc/interactive/Global.scala +++ b/src/compiler/scala/tools/nsc/interactive/Global.scala @@ -150,7 +150,7 @@ self => val tree = locateTree(pos) val sw = new StringWriter val pw = new PrintWriter(sw) - treePrinters.create(pw).print(tree) + newTreePrinter(pw).print(tree) pw.flush val typed = new Response[Tree] @@ -159,7 +159,7 @@ self => case Some(tree) => val sw = new StringWriter val pw = new PrintWriter(sw) - treePrinters.create(pw).print(tree) + newTreePrinter(pw).print(tree) pw.flush sw.toString case None => "<None>" diff --git a/src/compiler/scala/tools/nsc/interactive/RefinedBuildManager.scala b/src/compiler/scala/tools/nsc/interactive/RefinedBuildManager.scala index e82375fe83..9d66564c18 100644 --- a/src/compiler/scala/tools/nsc/interactive/RefinedBuildManager.scala +++ b/src/compiler/scala/tools/nsc/interactive/RefinedBuildManager.scala @@ -83,7 +83,7 @@ class RefinedBuildManager(val settings: Settings) extends Changes with BuildMana private def invalidatedByRemove(files: Set[AbstractFile]): Set[AbstractFile] = { val changes = new mutable.HashMap[Symbol, List[Change]] for (f <- files; SymWithHistory(sym, _) <- definitions(f)) - changes += sym -> List(Removed(Class(sym.fullNameString))) + changes += sym -> List(Removed(Class(sym.fullName))) invalidated(files, changes) } @@ -131,7 +131,7 @@ class RefinedBuildManager(val settings: Settings) extends Changes with BuildMana // Deterministic behaviour required by partest val changesOf = new mutable.HashMap[Symbol, List[Change]] { override def toString: String = { - val syms = toList.sort(_._1.fullNameString < _._1.fullNameString) + val syms = toList.sort(_._1.fullName < _._1.fullName) val changesOrdered = syms.map(entry => { val list = entry._2.sort(_.toString < _.toString) entry._1.toString + " -> " + list.mkString("List(", ", ", ")") @@ -150,7 +150,7 @@ class RefinedBuildManager(val settings: Settings) extends Changes with BuildMana val syms = defs(src) for (sym <- syms) { definitions(src).find( - s => (s.sym.fullNameString == sym.fullNameString) && + s => (s.sym.fullName == sym.fullName) && isCorrespondingSym(s.sym, sym)) match { case Some(SymWithHistory(oldSym, info)) => val changes = changeSet(oldSym.info, sym) @@ -169,7 +169,7 @@ class RefinedBuildManager(val settings: Settings) extends Changes with BuildMana } // Create a change for the top level classes that were removed val removed = definitions(src) filterNot ((s:SymWithHistory) => - syms.find(_.fullNameString == (s.sym.fullNameString)) != None) + syms.find(_.fullName == (s.sym.fullName)) != None) for (s <- removed) { changesOf(s.sym) = List(removeChangeSet(s.sym)) } @@ -235,7 +235,7 @@ class RefinedBuildManager(val settings: Settings) extends Changes with BuildMana for ((oldSym, changes) <- changesOf; change <- changes) { def checkParents(cls: Symbol, file: AbstractFile) { - val parentChange = cls.info.parents.exists(_.typeSymbol.fullNameString == oldSym.fullNameString) + val parentChange = cls.info.parents.exists(_.typeSymbol.fullName == oldSym.fullName) // if (settings.buildmanagerdebug.value) // compiler.inform("checkParents " + cls + " oldSym: " + oldSym + " parentChange: " + parentChange + " " + cls.info.parents) change match { @@ -258,10 +258,10 @@ class RefinedBuildManager(val settings: Settings) extends Changes with BuildMana def checkInterface(cls: Symbol, file: AbstractFile) { change match { case Added(Definition(name)) => - if (cls.info.decls.iterator.exists(_.fullNameString == name)) + if (cls.info.decls.iterator.exists(_.fullName == name)) invalidate(file, "of new method with existing name", change) case Changed(Class(name)) => - if (cls.info.typeSymbol.fullNameString == name) + if (cls.info.typeSymbol.fullName == name) invalidate(file, "self type changed", change) case _ => () @@ -299,7 +299,7 @@ class RefinedBuildManager(val settings: Settings) extends Changes with BuildMana for (Inherited(q, member) <- refs.find(p => (p != null && p.qualifier == name)); classFile <- classes.get(q); defs <- definitions.get(classFile); - s <- defs.find(p => p.sym.fullNameString == q) + s <- defs.find(p => p.sym.fullName == q) if ((s.sym).tpe.nonPrivateMember(member) == compiler.NoSymbol)) invalidate(file, "it references invalid (no longer inherited) defintion", change) () @@ -326,7 +326,7 @@ class RefinedBuildManager(val settings: Settings) extends Changes with BuildMana private def updateDefinitions(files: Set[AbstractFile]) { for (src <- files; val localDefs = compiler.dependencyAnalysis.definitions(src)) { definitions(src) = (localDefs map (s => { - this.classes += s.fullNameString -> src + this.classes += s.fullName -> src SymWithHistory( s.cloneSymbol, atPhase(currentRun.erasurePhase.prev) { diff --git a/src/compiler/scala/tools/nsc/javac/JavaParsers.scala b/src/compiler/scala/tools/nsc/javac/JavaParsers.scala index 5838fa47c1..16430b0a42 100644 --- a/src/compiler/scala/tools/nsc/javac/JavaParsers.scala +++ b/src/compiler/scala/tools/nsc/javac/JavaParsers.scala @@ -9,7 +9,7 @@ package scala.tools.nsc package javac -import scala.tools.nsc.util.{Position, OffsetPosition, NoPosition, BatchSourceFile} +import scala.tools.nsc.util.{OffsetPosition, BatchSourceFile} import scala.collection.mutable.ListBuffer import symtab.Flags import JavaTokens._ diff --git a/src/compiler/scala/tools/nsc/models/Models.scala b/src/compiler/scala/tools/nsc/models/Models.scala index 2c44c290ae..a45d0d8877 100644 --- a/src/compiler/scala/tools/nsc/models/Models.scala +++ b/src/compiler/scala/tools/nsc/models/Models.scala @@ -8,7 +8,6 @@ package scala.tools.nsc package models import scala.tools.nsc.Global -import scala.tools.nsc.util.{Position,NoPosition} /** This abstract class ... * diff --git a/src/compiler/scala/tools/nsc/models/SemanticTokens.scala b/src/compiler/scala/tools/nsc/models/SemanticTokens.scala index 2fae919614..945215cacf 100644 --- a/src/compiler/scala/tools/nsc/models/SemanticTokens.scala +++ b/src/compiler/scala/tools/nsc/models/SemanticTokens.scala @@ -14,7 +14,7 @@ import scala.collection.mutable.{HashMap, HashSet} import scala.tools.nsc.Global import scala.tools.nsc.symtab.{Flags, Names} import scala.tools.nsc.symtab.Flags.DEFERRED -import scala.tools.nsc.util.{BatchSourceFile, NoPosition, Position, SourceFile} +import scala.tools.nsc.util.{BatchSourceFile, SourceFile} import scala.util.NameTransformer class SemanticTokens(val compiler: Global) { diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala index d248567a16..34b7f9f8af 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala @@ -14,7 +14,7 @@ import java.lang.Integer.toHexString import scala.collection.immutable.{Map, ListMap} import scala.collection.mutable.{ListBuffer, ArrayBuffer} import scala.tools.nsc.io.AbstractFile -import scala.tools.nsc.util.{Position, NoPosition, ClassRep} +import scala.tools.nsc.util.ClassRep import scala.annotation.switch /** This abstract class implements a class file parser. @@ -244,7 +244,7 @@ abstract class ClassfileParser { log("Couldn't find " + name + ": " + tpe + " inside: \n" + ownerTpe) f = if (tpe.isInstanceOf[MethodType]) owner.newMethod(owner.pos, name).setInfo(tpe) else owner.newValue(owner.pos, name).setInfo(tpe).setFlag(MUTABLE) - log("created fake member " + f.fullNameString) + log("created fake member " + f.fullName) } // println("\townerTpe.decls: " + ownerTpe.decls) // println("Looking for: " + name + ": " + tpe + " inside: " + ownerTpe.typeSymbol + "\n\tand found: " + ownerTpe.members) @@ -820,7 +820,7 @@ abstract class ClassfileParser { val srcfileLeaf = pool.getName(in.nextChar).toString.trim val srcpath = sym.enclosingPackage match { case NoSymbol => srcfileLeaf - case pkg => pkg.fullNameString(File.separatorChar)+File.separator+srcfileLeaf + case pkg => pkg.fullName(File.separatorChar)+File.separator+srcfileLeaf } srcfile0 = settings.outputDirs.srcFilesFor(in.file, srcpath).find(_.exists) case _ => diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala index 6011d68a6f..0c466e24f5 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala @@ -14,7 +14,7 @@ import scala.collection.mutable._ import scala.tools.nsc._ import scala.tools.nsc.backend.icode._ import scala.tools.nsc.io._ -import scala.tools.nsc.util.{Position, NoPosition, ClassRep} +import scala.tools.nsc.util.ClassRep import ClassfileConstants._ import Flags._ @@ -49,7 +49,7 @@ abstract class ICodeReader extends ClassfileParser { isScalaModule = cls.isModule && !cls.hasFlag(JAVA) log("Reading class: " + cls + " isScalaModule?: " + isScalaModule) - val name = cls.fullNameString('.') + (if (sym.hasFlag(MODULE)) "$" else "") + val name = cls.fullName('.') + (if (sym.hasFlag(MODULE)) "$" else "") classPath.findClass(name) match { case Some(ClassRep(bin, _)) => assert(bin.isDefined, "No classfile for " + cls) @@ -159,7 +159,7 @@ abstract class ICodeReader extends ClassfileParser { override def parseMethod() { val (jflags, sym) = parseMember(false) if (sym != NoSymbol) { - log("Parsing method " + sym.fullNameString + ": " + sym.tpe); + log("Parsing method " + sym.fullName + ": " + sym.tpe); this.method = new IMethod(sym); this.method.returnType = toTypeKind(sym.tpe.resultType) getCode(jflags).addMethod(this.method) diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/MetaParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/MetaParser.scala index 58322cdd85..0ae2d5b015 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/MetaParser.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/MetaParser.scala @@ -11,7 +11,6 @@ package classfile import java.util.{StringTokenizer, NoSuchElementException} import scala.collection.mutable.ListBuffer -import scala.tools.nsc.util.{Position,NoPosition} abstract class MetaParser{ diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala b/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala index 483f67e066..a9a9aa4397 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala @@ -271,11 +271,11 @@ abstract class Pickler extends SubComponent { putEntry(from) putEntry(to) } - - case DocDef(comment, definition) => +/* + case DocDef(comment, definition) => should not be needed putConstant(Constant(comment)) putTree(definition) - +*/ case Template(parents, self, body) => writeNat(parents.length) putTrees(parents) diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala b/src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala index b8fc0ea1d3..0538d108c4 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala @@ -11,770 +11,47 @@ package classfile import java.io.IOException import java.lang.{Float, Double} -import scala.tools.nsc.util.{Position, NoPosition} - import Flags._ import PickleFormat._ import collection.mutable.{HashMap, ListBuffer} import annotation.switch -/** This abstract class implements .. - * - * @author Martin Odersky +/** @author Martin Odersky * @version 1.0 */ -abstract class UnPickler { +abstract class UnPickler extends reflect.generic.UnPickler { val global: Global import global._ - /** Unpickle symbol table information descending from a class and/or module root - * from an array of bytes. - * @param bytes bytearray from which we unpickle - * @param offset offset from which unpickling starts - * @param classroot the top-level class which is unpickled, or NoSymbol if unapplicable - * @param moduleroot the top-level module which is unpickled, or NoSymbol if unapplicable - * @param filename filename associated with bytearray, only used for error messages - */ - def unpickle(bytes: Array[Byte], offset: Int, classRoot: Symbol, moduleRoot: Symbol, filename: String) { - try { - val p = if (currentRun.isDefined && - currentRun.picklerPhase != NoPhase && - phase.id > currentRun.picklerPhase.id) currentRun.picklerPhase - else phase - atPhase(p) { - new UnPickle(bytes, offset, classRoot, moduleRoot, filename) - } - } catch { - case ex: IOException => - throw ex - case ex: Throwable => - /*if (settings.debug.value)*/ ex.printStackTrace() - throw new RuntimeException("error reading Scala signature of "+filename+": "+ex.getMessage()) - } - } - - private class UnPickle(bytes: Array[Byte], offset: Int, classRoot: Symbol, moduleRoot: Symbol, filename: String) extends PickleBuffer(bytes, offset, -1) { - if (settings.debug.value) global.log("unpickle " + classRoot + " and " + moduleRoot) - checkVersion(filename) - - /** A map from entry numbers to array offsets */ - private val index = createIndex - - /** A map from entry numbers to symbols, types, or annotations */ - private val entries = new Array[AnyRef](index.length) - - /** A map from symbols to their associated `decls' scopes */ - private val symScopes = new HashMap[Symbol, Scope] - - for (i <- 0 until index.length) { - if (isSymbolEntry(i)) - at(i, readSymbol) - else if (isSymbolAnnotationEntry(i)) - at(i, {() => readSymbolAnnotation(); null}) - else if (isChildrenEntry(i)) - at(i, {() => readChildren(); null}) - } - - if (settings.debug.value) global.log("unpickled " + classRoot + ":" + classRoot.rawInfo + ", " + moduleRoot + ":" + moduleRoot.rawInfo);//debug - - private def checkVersion(filename: String) { - val major = readNat() - val minor = readNat() - if (major != MajorVersion || minor > MinorVersion) - throw new IOException("Scala signature " + classRoot.name + - " has wrong version\n expected: " + - MajorVersion + "." + MinorVersion + - "\n found: " + major + "." + minor + - " in "+filename) - } - - /** The `decls' scope associated with given symbol */ - private def symScope(sym: Symbol) = symScopes.get(sym) match { - case None => val s = new Scope; symScopes(sym) = s; s - case Some(s) => s - } - - /** Does entry represent an (internal) symbol */ - private def isSymbolEntry(i: Int): Boolean = { - val tag = bytes(index(i)).toInt - (firstSymTag <= tag && tag <= lastSymTag && - (tag != CLASSsym || !isRefinementSymbolEntry(i))) - } - - /** Does entry represent an (internal or external) symbol */ - private def isSymbolRef(i: Int): Boolean = { - val tag = bytes(index(i)) - (firstSymTag <= tag && tag <= lastExtSymTag) - } - - /** Does entry represent a name? */ - private def isNameEntry(i: Int): Boolean = { - val tag = bytes(index(i)).toInt - tag == TERMname || tag == TYPEname - } - - /** Does entry represent a symbol annotation? */ - private def isSymbolAnnotationEntry(i: Int): Boolean = { - val tag = bytes(index(i)).toInt - tag == SYMANNOT - } - - /** Does the entry represent children of a symbol? */ - private def isChildrenEntry(i: Int): Boolean = { - val tag = bytes(index(i)).toInt - tag == CHILDREN - } - - /** Does entry represent a refinement symbol? - * pre: Entry is a class symbol - */ - private def isRefinementSymbolEntry(i: Int): Boolean = { - val savedIndex = readIndex - readIndex = index(i) - val tag = readByte().toInt - assert(tag == CLASSsym) - - readNat(); // read length - val result = readNameRef() == nme.REFINE_CLASS_NAME.toTypeName - readIndex = savedIndex - result - } - - /** If entry at <code>i</code> is undefined, define it by performing - * operation <code>op</code> with <code>readIndex at start of i'th - * entry. Restore <code>readIndex</code> afterwards. - */ - private def at[T <: AnyRef](i: Int, op: () => T): T = { - var r = entries(i) - if (r eq null) { - val savedIndex = readIndex - readIndex = index(i) - r = op() - assert(entries(i) eq null, entries(i)) - entries(i) = r - readIndex = savedIndex - } - r.asInstanceOf[T] - } - - /** Read a name */ - private def readName(): Name = { - val tag = readByte() - val len = readNat() - tag match { - case TERMname => newTermName(bytes, readIndex, len) - case TYPEname => newTypeName(bytes, readIndex, len) - case _ => errorBadSignature("bad name tag: " + tag) - } - } + def scan(bytes: Array[Byte], offset: Int, classRoot: Symbol, moduleRoot: Symbol, filename: String) = + new CompileScan(bytes, offset, classRoot, moduleRoot, filename).run() - /** Read a symbol */ - private def readSymbol(): Symbol = { - val tag = readByte() - val end = readNat() + readIndex - var sym: Symbol = NoSymbol - tag match { - case EXTref | EXTMODCLASSref => - val name = readNameRef() - val owner = if (readIndex == end) definitions.RootClass else readSymbolRef() - def fromName(name: Name) = - if (name.toTermName == nme.ROOT) definitions.RootClass - else if (name == nme.ROOTPKG) definitions.RootPackage - else if (tag == EXTref) owner.info.decl(name) - else owner.info.decl(name).moduleClass - sym = fromName(name) - // If sym not found try with expanded name. - // This can happen if references to private symbols are - // read from outside; for instance when checking the children of a class - // (see t1722) - if (sym == NoSymbol) { - sym = fromName(owner.expandedName(name)) - } + class CompileScan(bytes: Array[Byte], offset: Int, classRoot: Symbol, moduleRoot: Symbol, filename: String) + extends Scan(bytes, offset, classRoot, moduleRoot, filename) { - // If the owner is overloaded (i.e. a method), it's not possible to select the - // right member => return NoSymbol. This can only happen when unpickling a tree. - // the "case Apply" in readTree() takes care of selecting the correct alternative - // after parsing the arguments. - if (sym == NoSymbol && !owner.hasFlag(OVERLOADED)) { - errorMissingRequirement( - "reference " + (if (name.isTypeName) "type " else "value ") + - name.decode + " of " + owner.tpe.widen + " refers to nonexisting symbol.") - } - case NONEsym => - sym = NoSymbol - case _ => // symbols that were pickled with Pickler.writeSymInfo - var defaultGetter: Symbol = NoSymbol // @deprecated, to be removed for 2.8 final - var nameref = readNat() - if (tag == VALsym && isSymbolRef(nameref)) { // @deprecated, to be removed for 2.8 final - defaultGetter = at(nameref, readSymbol) - nameref = readNat() - } - val name = at(nameref, readName) - val owner = readSymbolRef() - val flags = pickledToRawFlags(readLongNat()) - var privateWithin: Symbol = NoSymbol - var inforef = readNat() - if (isSymbolRef(inforef)) { - privateWithin = at(inforef, readSymbol) - inforef = readNat() - } - tag match { - case TYPEsym => - sym = owner.newAbstractType(NoPosition, name) - case ALIASsym => - sym = owner.newAliasType(NoPosition, name) - case CLASSsym => - sym = - if (name == classRoot.name && owner == classRoot.owner) - (if ((flags & MODULE) != 0L) moduleRoot.moduleClass - else classRoot) - else - if ((flags & MODULE) != 0L) owner.newModuleClass(NoPosition, name) - else owner.newClass(NoPosition, name) - if (readIndex != end) sym.typeOfThis = new LazyTypeRef(readNat()) - case MODULEsym => - val clazz = at(inforef, readType).typeSymbol - sym = - if (name == moduleRoot.name && owner == moduleRoot.owner) moduleRoot - else { - assert(clazz.isInstanceOf[ModuleClassSymbol], clazz) - val mclazz = clazz.asInstanceOf[ModuleClassSymbol] - val m = owner.newModule(NoPosition, name, mclazz) - mclazz.setSourceModule(m) - m - } - case VALsym => - sym = if (name == moduleRoot.name && owner == moduleRoot.owner) moduleRoot.resetFlag(MODULE) - else if ((flags & METHOD) != 0) owner.newMethod(NoPosition, name) - else owner.newValue(NoPosition, name) - case _ => - errorBadSignature("bad symbol tag: " + tag) - } - sym.setFlag(flags.toLong & PickledFlags) - sym.privateWithin = privateWithin - if (readIndex != end) assert(sym hasFlag (SUPERACCESSOR | PARAMACCESSOR), sym) - if (sym hasFlag SUPERACCESSOR) assert(readIndex != end) - sym.setInfo( - if (readIndex != end) new LazyTypeRefAndAlias(inforef, readNat()) - else new LazyTypeRef(inforef)) - if (sym.owner.isClass && sym != classRoot && sym != moduleRoot && - !sym.isModuleClass && !sym.isRefinementClass && !sym.isTypeParameter && !sym.isExistential) - symScope(sym.owner) enter sym - } - sym - } + protected override def debug = settings.debug.value - /** Read a type */ - private def readType(): Type = { - val tag = readByte() - val end = readNat() + readIndex + override def noSuchTypeTag(tag: Int, end: Int): Type = { tag match { - case NOtpe => - NoType - case NOPREFIXtpe => - NoPrefix - case THIStpe => - ThisType(readSymbolRef()) - case SINGLEtpe => - singleType(readTypeRef(), readSymbolRef()) - case SUPERtpe => - val thistpe = readTypeRef() - val supertpe = readTypeRef() - SuperType(thistpe, supertpe) - case CONSTANTtpe => - ConstantType(readConstantRef()) - case TYPEREFtpe => - val pre = readTypeRef() - val sym = readSymbolRef() - var args = until(end, readTypeRef) - rawTypeRef(pre, sym, args) - case TYPEBOUNDStpe => - TypeBounds(readTypeRef(), readTypeRef()) - case REFINEDtpe => - val clazz = readSymbolRef() -/* - val ps = until(end, readTypeRef) - val dcls = symScope(clazz) - new RefinedType(ps, dcls) { override def symbol = clazz } -*/ - new RefinedType(until(end, readTypeRef), symScope(clazz)) { - override def typeSymbol = clazz - } - case CLASSINFOtpe => - val clazz = readSymbolRef() - ClassInfoType(until(end, readTypeRef), symScope(clazz), clazz) - case METHODtpe => - val restpe = readTypeRef() - val params = until(end, readSymbolRef) - // if the method is overloaded, the params cannot be determined (see readSymbol) => return NoType. - // Only happen for trees, "case Apply" in readTree() takes care of selecting the correct - // alternative after parsing the arguments. - if (params.contains(NoSymbol) || restpe == NoType) NoType - else MethodType(params, restpe) - case IMPLICITMETHODtpe => - val restpe = readTypeRef() - val params = until(end, readSymbolRef) - ImplicitMethodType(params, restpe) - case POLYtpe => - val restpe = readTypeRef() - val typeParams = until(end, readSymbolRef) - // see comment above in "case METHODtpe" - if (typeParams.contains(NoSymbol) || restpe == NoType) NoType - else PolyType(typeParams, restpe) - case EXISTENTIALtpe => - val restpe = readTypeRef() - ExistentialType(until(end, readSymbolRef), restpe) - case ANNOTATEDtpe => - var typeRef = readNat() - val selfsym = if (isSymbolRef(typeRef)) { - val s = at(typeRef, readSymbol) - typeRef = readNat() - s - } else NoSymbol - val tp = at(typeRef, readType) - val annots = until(end, readAnnotationRef) - if (settings.selfInAnnots.value || (selfsym == NoSymbol)) - AnnotatedType(annots, tp, selfsym) - else - tp // drop annotations with a self symbol unless - // -Yself-in-annots is on case DEBRUIJNINDEXtpe => DeBruijnIndex(readNat(), readNat()) case _ => - errorBadSignature("bad type tag: " + tag) - } - } - - /** Read a constant */ - private def readConstant(): Constant = { - val tag = readByte().toInt - val len = readNat() - (tag: @switch) match { - case LITERALunit => Constant(()) - case LITERALboolean => Constant(readLong(len) != 0L) - case LITERALbyte => Constant(readLong(len).toByte) - case LITERALshort => Constant(readLong(len).toShort) - case LITERALchar => Constant(readLong(len).toChar) - case LITERALint => Constant(readLong(len).toInt) - case LITERALlong => Constant(readLong(len)) - case LITERALfloat => Constant(Float.intBitsToFloat(readLong(len).toInt)) - case LITERALdouble => Constant(Double.longBitsToDouble(readLong(len))) - case LITERALstring => Constant(readNameRef().toString()) - case LITERALnull => Constant(null) - case LITERALclass => Constant(readTypeRef()) - case LITERALenum => Constant(readSymbolRef()) - case _ => errorBadSignature("bad constant tag: " + tag) - } - } - - /** Read children and store them into the corresponding symbol. - */ - private def readChildren() { - val tag = readByte() - assert(tag == CHILDREN) - val end = readNat() + readIndex - val target = readSymbolRef() - while (readIndex != end) target addChild readSymbolRef() - } - - /** Read an annotation argument, which is pickled either - * as a Constant or a Tree. - */ - private def readAnnotArg(i: Int): Tree = { - if (bytes(index(i)) == TREE) { - at(i, readTree) - } else { - val const = at(i, readConstant) - Literal(const).setType(const.tpe) - } - } - - /** Read a ClassfileAnnotArg (argument to a classfile annotation) - */ - private def readClassfileAnnotArg(i: Int): ClassfileAnnotArg = bytes(index(i)) match { - case ANNOTINFO => - NestedAnnotArg(at(i, readAnnotation)) - case ANNOTARGARRAY => - at(i, () => { - readByte() // skip the `annotargarray` tag - val end = readNat() + readIndex - ArrayAnnotArg(until(end, () => readClassfileAnnotArg(readNat())).toArray) - }) - case _ => - LiteralAnnotArg(at(i, readConstant)) - } - - /** Read an AnnotationInfo. Not to be called directly, use - * readAnnotation or readSymbolAnnotation - */ - private def readAnnotationInfo(end: Int): AnnotationInfo = { - val atp = readTypeRef() - val args = new ListBuffer[Tree] - val assocs = new ListBuffer[(Name, ClassfileAnnotArg)] - while (readIndex != end) { - val argref = readNat() - if (isNameEntry(argref)) { - val name = at(argref, readName) - val arg = readClassfileAnnotArg(readNat()) - assocs += ((name, arg)) - } - else - args += readAnnotArg(argref) - } - AnnotationInfo(atp, args.toList, assocs.toList) - } - - /** Read an annotation and as a side effect store it into - * the symbol it requests. Called at top-level, for all - * (symbol, annotInfo) entries. */ - private def readSymbolAnnotation() { - val tag = readByte() - if (tag != SYMANNOT) - errorBadSignature("symbol annotation expected ("+ tag +")") - val end = readNat() + readIndex - val target = readSymbolRef() - target.addAnnotation(readAnnotationInfo(end)) - } - - /** Read an annotation and return it. Used when unpickling - * an ANNOTATED(WSELF)tpe or a NestedAnnotArg */ - private def readAnnotation(): AnnotationInfo = { - val tag = readByte() - if (tag != ANNOTINFO) - errorBadSignature("annotation expected (" + tag + ")") - val end = readNat() + readIndex - readAnnotationInfo(end) - } - - /* Read an abstract syntax tree */ - private def readTree(): Tree = { - val outerTag = readByte() - if (outerTag != TREE) - errorBadSignature("tree expected (" + outerTag + ")") - val end = readNat() + readIndex - val tag = readByte() - val tpe = if (tag == EMPTYtree) NoType else readTypeRef() - - // Set by the three functions to follow. If symbol is non-null - // after the the new tree 't' has been created, t has its Symbol - // set to symbol; and it always has its Type set to tpe. - var symbol: Symbol = null - var mods: Modifiers = null - var name: Name = null - - /** Read a Symbol, Modifiers, and a Name */ - def setSymModsName() { - symbol = readSymbolRef() - mods = readModifiersRef() - name = readNameRef() - } - /** Read a Symbol and a Name */ - def setSymName() { - symbol = readSymbolRef() - name = readNameRef() - } - /** Read a Symbol */ - def setSym() { - symbol = readSymbolRef() - } - - val t = tag match { - case EMPTYtree => - EmptyTree - - case PACKAGEtree => - setSym() - // val discardedSymbol = readSymbolRef() // XXX is symbol intentionally not set? - val pid = readTreeRef().asInstanceOf[RefTree] - val stats = until(end, readTreeRef) - PackageDef(pid, stats) - - case CLASStree => - setSymModsName() - val impl = readTemplateRef() - val tparams = until(end, readTypeDefRef) - ClassDef(mods, name, tparams, impl) - - case MODULEtree => - setSymModsName() - ModuleDef(mods, name, readTemplateRef()) - - case VALDEFtree => - setSymModsName() - val tpt = readTreeRef() - val rhs = readTreeRef() - ValDef(mods, name, tpt, rhs) - - case DEFDEFtree => - setSymModsName() - val tparams = times(readNat(), readTypeDefRef) - val vparamss = times(readNat(), () => times(readNat(), readValDefRef)) - val tpt = readTreeRef() - val rhs = readTreeRef() - - DefDef(mods, name, tparams, vparamss, tpt, rhs) - - case TYPEDEFtree => - setSymModsName() - val rhs = readTreeRef() - val tparams = until(end, readTypeDefRef) - TypeDef(mods, name, tparams, rhs) - - case LABELtree => - setSymName() - val rhs = readTreeRef() - val params = until(end, readIdentRef) - LabelDef(name, params, rhs) - - case IMPORTtree => - setSym() - val expr = readTreeRef() - val selectors = until(end, () => { - val from = readNameRef() - val to = readNameRef() - ImportSelector(from, -1, to, -1) - }) - - Import(expr, selectors) - - case DOCDEFtree => - val comment = readConstantRef match { - case Constant(com: String) => com - case other => errorBadSignature("Document comment not a string (" + other + ")") - } - val definition = readTreeRef() - DocDef(DocComment(comment, NoPosition), definition) - - case TEMPLATEtree => - setSym() - val parents = times(readNat(), readTreeRef) - val self = readValDefRef() - val body = until(end, readTreeRef) - - Template(parents, self, body) - - case BLOCKtree => - val expr = readTreeRef() - val stats = until(end, readTreeRef) - Block(stats, expr) - - case CASEtree => - val pat = readTreeRef() - val guard = readTreeRef() - val body = readTreeRef() - CaseDef(pat, guard, body) - - case ALTERNATIVEtree => - Alternative(until(end, readTreeRef)) - - case STARtree => - Star(readTreeRef()) - - case BINDtree => - setSymName() - Bind(name, readTreeRef()) - - case UNAPPLYtree => - val fun = readTreeRef() - val args = until(end, readTreeRef) - UnApply(fun, args) - - case ARRAYVALUEtree => - val elemtpt = readTreeRef() - val trees = until(end, readTreeRef) - ArrayValue(elemtpt, trees) - - case FUNCTIONtree => - setSym() - val body = readTreeRef() - val vparams = until(end, readValDefRef) - Function(vparams, body) - - case ASSIGNtree => - val lhs = readTreeRef() - val rhs = readTreeRef() - Assign(lhs, rhs) - - case IFtree => - val cond = readTreeRef() - val thenp = readTreeRef() - val elsep = readTreeRef() - If(cond, thenp, elsep) - - case MATCHtree => - val selector = readTreeRef() - val cases = until(end, readCaseDefRef) - Match(selector, cases) - - case RETURNtree => - setSym() - Return(readTreeRef()) - - case TREtree => - val block = readTreeRef() - val finalizer = readTreeRef() - val catches = until(end, readCaseDefRef) - Try(block, catches, finalizer) - - case THROWtree => - Throw(readTreeRef()) - - case NEWtree => - New(readTreeRef()) - - case TYPEDtree => - val expr = readTreeRef() - val tpt = readTreeRef() - Typed(expr, tpt) - - case TYPEAPPLYtree => - val fun = readTreeRef() - val args = until(end, readTreeRef) - TypeApply(fun, args) - - case APPLYtree => - val fun = readTreeRef() - val args = until(end, readTreeRef) - if (fun.symbol hasFlag OVERLOADED) { - fun.setType(fun.symbol.info) - typer.infer.inferMethodAlternative(fun, Nil, args map (_.tpe), tpe) - } - Apply(fun, args) - - case APPLYDYNAMICtree => - setSym() - val qual = readTreeRef() - val args = until(end, readTreeRef) - ApplyDynamic(qual, args) - - case SUPERtree => - setSym() - val qual = readNameRef() - val mix = readNameRef() - Super(qual, mix) - - case THIStree => - setSym() - This(readNameRef()) - - case SELECTtree => - setSym() - val qualifier = readTreeRef() - val selector = readNameRef() - Select(qualifier, selector) - - case IDENTtree => - setSymName() - Ident(name) - - case LITERALtree => - Literal(readConstantRef()) - - case TYPEtree => - TypeTree() - - case ANNOTATEDtree => - val annot = readTreeRef() - val arg = readTreeRef() - Annotated(annot, arg) - - case SINGLETONTYPEtree => - SingletonTypeTree(readTreeRef()) - - case SELECTFROMTYPEtree => - val qualifier = readTreeRef() - val selector = readNameRef() - SelectFromTypeTree(qualifier, selector) - - case COMPOUNDTYPEtree => - CompoundTypeTree(readTemplateRef()) - - case APPLIEDTYPEtree => - val tpt = readTreeRef() - val args = until(end, readTreeRef) - AppliedTypeTree(tpt, args) - - case TYPEBOUNDStree => - val lo = readTreeRef() - val hi = readTreeRef() - TypeBoundsTree(lo, hi) - - case EXISTENTIALTYPEtree => - val tpt = readTreeRef() - val whereClauses = until(end, readTreeRef) - ExistentialTypeTree(tpt, whereClauses) - - case _ => - errorBadSignature("unknown tree type (" + tag + ")") + super.noSuchTypeTag(tag, end) } - - if (symbol == null) t setType tpe - else t setSymbol symbol setType tpe } - def readModifiers(): Modifiers = { - val tag = readNat() - if (tag != MODIFIERS) - errorBadSignature("expected a modifiers tag (" + tag + ")") - val end = readNat() + readIndex - val pflagsHi = readNat() - val pflagsLo = readNat() - val pflags = (pflagsHi.toLong << 32) + pflagsLo - val flags = pickledToRawFlags(pflags) - val privateWithin = readNameRef() - Modifiers(flags, privateWithin, Nil, new Map.EmptyMap) - } + override protected def errorMissingRequirement(name: Name, owner: Symbol) = + errorMissingRequirement( + "reference " + (if (name.isTypeName) "type " else "value ") + + name.decode + " of " + owner.tpe.widen + " refers to nonexisting symbol.") - /* Read a reference to a pickled item */ - private def readNameRef(): Name = at(readNat(), readName) - private def readSymbolRef(): Symbol = at(readNat(), readSymbol) - private def readTypeRef(): Type = at(readNat(), readType) - private def readConstantRef(): Constant = at(readNat(), readConstant) - private def readAnnotationRef(): AnnotationInfo = - at(readNat(), readAnnotation) - private def readModifiersRef(): Modifiers = - at(readNat(), readModifiers) - private def readTreeRef(): Tree = - at(readNat(), readTree) + def inferMethodAlternative(fun: Tree, argtpes: List[Type], restpe: Type) = + typer.infer.inferMethodAlternative(fun, List(), argtpes, restpe) - private def readTemplateRef(): Template = - readTreeRef() match { - case templ:Template => templ - case other => - errorBadSignature("expected a template (" + other + ")") - } - private def readCaseDefRef(): CaseDef = - readTreeRef() match { - case tree:CaseDef => tree - case other => - errorBadSignature("expected a case def (" + other + ")") - } - private def readValDefRef(): ValDef = - readTreeRef() match { - case tree:ValDef => tree - case other => - errorBadSignature("expected a ValDef (" + other + ")") - } - private def readIdentRef(): Ident = - readTreeRef() match { - case tree:Ident => tree - case other => - errorBadSignature("expected an Ident (" + other + ")") - } - private def readTypeDefRef(): TypeDef = - readTreeRef() match { - case tree:TypeDef => tree - case other => - errorBadSignature("expected an TypeDef (" + other + ")") - } - - private def errorBadSignature(msg: String) = - throw new RuntimeException("malformed Scala signature of " + classRoot.name + " at " + readIndex + "; " + msg) - - private def errorMissingRequirement(msg: String) = - if (settings.debug.value) errorBadSignature(msg) - else throw new IOException("class file needed by "+classRoot.name+" is missing.\n"+msg) + def newLazyTypeRef(i: Int): LazyType = new LazyTypeRef(i) + def newLazyTypeRefAndAlias(i: Int, j: Int): LazyType = new LazyTypeRefAndAlias(i, j) + /** A lazy type which when completed returns type at index `i`. */ private class LazyTypeRef(i: Int) extends LazyType { private val definedAtRunId = currentRunId private val p = phase @@ -787,6 +64,9 @@ abstract class UnPickler { override def load(sym: Symbol) { complete(sym) } } + /** A lazy type which when completed returns type at index `i` and sets alias + * of completed symbol to symbol at index `j`. + */ private class LazyTypeRefAndAlias(i: Int, j: Int) extends LazyTypeRef(i) { override def complete(sym: Symbol) { super.complete(sym) diff --git a/src/compiler/scala/tools/nsc/symtab/clr/TypeParser.scala b/src/compiler/scala/tools/nsc/symtab/clr/TypeParser.scala index 7cea294ec8..a1a4545894 100644 --- a/src/compiler/scala/tools/nsc/symtab/clr/TypeParser.scala +++ b/src/compiler/scala/tools/nsc/symtab/clr/TypeParser.scala @@ -13,7 +13,6 @@ import java.io.IOException import ch.epfl.lamp.compiler.msil.{Type => MSILType, Attribute => MSILAttribute, _} import scala.collection.mutable.{HashMap, HashSet} -import scala.tools.nsc.util.{Position, NoPosition} import classfile.UnPickler /** diff --git a/src/compiler/scala/tools/nsc/transform/CleanUp.scala b/src/compiler/scala/tools/nsc/transform/CleanUp.scala index 81fe911328..6626ca56cd 100644 --- a/src/compiler/scala/tools/nsc/transform/CleanUp.scala +++ b/src/compiler/scala/tools/nsc/transform/CleanUp.scala @@ -9,7 +9,6 @@ package transform import symtab._ import Flags._ -import scala.tools.nsc.util.Position import scala.collection.mutable.{ListBuffer, HashMap} abstract class CleanUp extends Transform with ast.TreeDSL { diff --git a/src/compiler/scala/tools/nsc/transform/Erasure.scala b/src/compiler/scala/tools/nsc/transform/Erasure.scala index 1e0c661f0f..617967383a 100644 --- a/src/compiler/scala/tools/nsc/transform/Erasure.scala +++ b/src/compiler/scala/tools/nsc/transform/Erasure.scala @@ -10,7 +10,6 @@ package transform import scala.tools.nsc.symtab.classfile.ClassfileConstants._ import scala.collection.mutable.{HashMap,ListBuffer} import scala.collection.immutable.Set -import scala.tools.nsc.util.Position import symtab._ import Flags._ @@ -192,7 +191,7 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer with ast. traverse(st.supertype) case TypeRef(pre, sym, args) => if (sym == ArrayClass) args foreach traverse - else if (sym.isTypeParameterOrSkolem || sym.isExistential || !args.isEmpty) result = true + else if (sym.isTypeParameterOrSkolem || sym.isExistentiallyBound || !args.isEmpty) result = true else if (sym.isClass) traverse(rebindInnerClass(pre, sym)) // #2585 else if (!sym.owner.isPackageClass) traverse(pre) case PolyType(_, _) | ExistentialType(_, _) => @@ -254,7 +253,7 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer with ast. } } def classSig: String = - "L"+atPhase(currentRun.icodePhase)(sym.fullNameString + global.genJVM.moduleSuffix(sym)).replace('.', '/') + "L"+atPhase(currentRun.icodePhase)(sym.fullName + global.genJVM.moduleSuffix(sym)).replace('.', '/') def classSigSuffix: String = "."+sym.name if (sym == ArrayClass) diff --git a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala index defdeca9c0..5b1093d7c9 100644 --- a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala +++ b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala @@ -63,7 +63,7 @@ abstract class ExplicitOuter extends InfoTransform } def outerAccessor(clazz: Symbol): Symbol = { - val firstTry = clazz.info.decl(clazz expandedName nme.OUTER) + val firstTry = clazz.info.decl(nme.expandedName(nme.OUTER, clazz)) if (firstTry != NoSymbol && firstTry.outerSource == clazz) firstTry else clazz.info.decls find (_.outerSource == clazz) getOrElse NoSymbol } diff --git a/src/compiler/scala/tools/nsc/transform/LambdaLift.scala b/src/compiler/scala/tools/nsc/transform/LambdaLift.scala index 30fcc362d4..bd86ae42cc 100644 --- a/src/compiler/scala/tools/nsc/transform/LambdaLift.scala +++ b/src/compiler/scala/tools/nsc/transform/LambdaLift.scala @@ -11,7 +11,6 @@ import symtab._ import Flags._ import util.TreeSet import scala.collection.mutable.{HashMap, LinkedHashMap, ListBuffer} -import scala.tools.nsc.util.{Position, NoPosition} abstract class LambdaLift extends InfoTransform { import global._ diff --git a/src/compiler/scala/tools/nsc/transform/Mixin.scala b/src/compiler/scala/tools/nsc/transform/Mixin.scala index 8303ff592a..6ab6927412 100644 --- a/src/compiler/scala/tools/nsc/transform/Mixin.scala +++ b/src/compiler/scala/tools/nsc/transform/Mixin.scala @@ -9,7 +9,6 @@ package transform import symtab._ import Flags._ -import scala.tools.nsc.util.{Position,NoPosition} import collection.mutable.{ListBuffer, HashMap} abstract class Mixin extends InfoTransform with ast.TreeDSL { @@ -176,7 +175,7 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL { setter.setInfo(MethodType(setter.newSyntheticValueParams(List(field.info)), UnitClass.tpe)) if (needsExpandedSetterName(field)) { //println("creating expanded setter from "+field) - setter.name = clazz.expandedSetterName(setter.name) + setter.name = nme.expandedSetterName(setter.name, clazz) } setter } @@ -746,7 +745,7 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL { && !sym.isOuterAccessor) if (settings.debug.value) { - log("needsInitFlag(" + sym.fullNameString + "): " + res) + log("needsInitFlag(" + sym.fullName + "): " + res) log("\tsym.isGetter: " + sym.isGetter) log("\t!isInitializedToDefault: " + !sym.isInitializedToDefault + sym.hasFlag(DEFAULTINIT) + sym.hasFlag(ACCESSOR) + sym.isTerm) log("\t!sym.hasFlag(PARAMACCESSOR): " + !sym.hasFlag(PARAMACCESSOR)) @@ -820,7 +819,7 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL { def buildFieldPositions(clazz: Symbol) { var fields = usedBits(clazz) for (f <- clazz.info.decls.iterator if needsInitFlag(f) || f.hasFlag(LAZY)) { - if (settings.debug.value) log(f.fullNameString + " -> " + fields) + if (settings.debug.value) log(f.fullName + " -> " + fields) fieldOffset(f) = fields fields += 1 } diff --git a/src/compiler/scala/tools/nsc/transform/Reifiers.scala b/src/compiler/scala/tools/nsc/transform/Reifiers.scala index a588fccad5..eef260f5a3 100644 --- a/src/compiler/scala/tools/nsc/transform/Reifiers.scala +++ b/src/compiler/scala/tools/nsc/transform/Reifiers.scala @@ -219,8 +219,6 @@ trait Reifiers { if (rsym == reflect.NoSymbol) throw new TypeError("cannot reify symbol: " + tree.symbol) else reflect.Select(reify(qual), reify(tree.symbol)) - case _ : StubTree => reflect.Literal(0) - case Literal(constant) => reflect.Literal(constant.value) diff --git a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala index 6937658534..cc607bca26 100644 --- a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala +++ b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala @@ -9,7 +9,6 @@ package transform import scala.tools.nsc.symtab.Flags import scala.tools.nsc.util.FreshNameCreator -import scala.tools.nsc.util.Position import scala.collection.{mutable, immutable} @@ -459,7 +458,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { } else if (m.isDeferred) { // abstract methods val specMember = enterMember(m.cloneSymbol(cls)).setFlag(SPECIALIZED).resetFlag(DEFERRED) - log("deferred " + specMember.fullNameString + " is forwarded") + log("deferred " + specMember.fullName + " is forwarded") info(specMember) = new Forward(specMember) { override def target = m.owner.info.member(specializedName(m, env)) @@ -526,14 +525,14 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { typeEnv(specClass) = fullEnv specClass.name = specializedName(specClass, fullEnv) enterMember(specClass) - log("entered specialized class with info " + specClass.fullNameString + ": " + specClass.info) + log("entered specialized class with info " + specClass.fullName + ": " + specClass.info) info(specClass) = SpecializedInnerClass(m, fullEnv) } } cls } - log("specializeClass " + clazz.fullNameString) + log("specializeClass " + clazz.fullName) val decls1 = (clazz.info.decls.toList flatMap { m: Symbol => if (m.isAnonymousClass) List(m) else { normalizeMember(m.owner, m, outerEnv) flatMap { normalizedMember => @@ -649,8 +648,8 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { val opc = new overridingPairs.Cursor(clazz) val oms = new mutable.ListBuffer[Symbol] while (opc.hasNext) { - log("\toverriding pairs: " + opc.overridden.fullNameString + ": " + opc.overridden.info - + " overriden by " + opc.overriding.fullNameString + ": " + opc.overriding.info) + log("\toverriding pairs: " + opc.overridden.fullName + ": " + opc.overridden.info + + " overriden by " + opc.overriding.fullName + ": " + opc.overriding.info) if (opc.overriding.owner == clazz && !specializedTypeVars(opc.overridden.info).isEmpty) { log("\t\tspecializedTVars: " + specializedTypeVars(opc.overridden.info)) val env = unify(opc.overridden.info, opc.overriding.info, emptyEnv) @@ -660,7 +659,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { if (!env.isEmpty && TypeEnv.isValid(env, opc.overridden) && opc.overridden.owner.info.decl(specializedName(opc.overridden, env)) != NoSymbol) { - log("Added specialized overload for " + opc.overriding.fullNameString + " in env: " + env) + log("Added specialized overload for " + opc.overriding.fullName + " in env: " + env) val om = specializedOverload(clazz, opc.overridden, env) if (!opc.overriding.isDeferred) { concreteSpecMethods += opc.overriding @@ -942,7 +941,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { if (!env.isEmpty) { val specMember = overload(symbol, env) if (specMember.isDefined) { - log("** routing " + tree + " to " + specMember.get.sym.fullNameString + " tree: " + Select(qual1, specMember.get.sym.name)) + log("** routing " + tree + " to " + specMember.get.sym.fullName + " tree: " + Select(qual1, specMember.get.sym.name)) localTyper.typedOperator(atPos(tree.pos)(Select(qual1, specMember.get.sym.name))) } else { val specMember = qual1.tpe.member(specializedName(symbol, env)) @@ -981,7 +980,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { } else info(symbol) match { case Implementation(target) => - assert(body.isDefinedAt(target), "sym: " + symbol.fullNameString + " target: " + target.fullNameString) + assert(body.isDefinedAt(target), "sym: " + symbol.fullName + " target: " + target.fullName) // we have an rhs, specialize it val tree1 = duplicateBody(ddef, target) log("implementation: " + tree1) @@ -1019,7 +1018,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { } case SpecialOverload(original, env) => - log("completing specialized " + symbol.fullNameString + " calling " + original) + log("completing specialized " + symbol.fullName + " calling " + original) val t = DefDef(symbol, { vparamss => val fun = Apply(Select(This(symbol.owner), original), makeArguments(original, vparamss.head)) @@ -1047,7 +1046,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { case ValDef(mods, name, tpt, rhs) if symbol.hasFlag(SPECIALIZED) => assert(body.isDefinedAt(symbol.alias)) val tree1 = treeCopy.ValDef(tree, mods, name, tpt, body(symbol.alias).duplicate) - log("now typing: " + tree1 + " in " + tree.symbol.owner.fullNameString) + log("now typing: " + tree1 + " in " + tree.symbol.owner.fullName) val d = new Duplicator d.retyped(localTyper.context1.asInstanceOf[d.Context], tree1, @@ -1068,7 +1067,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { private def duplicateBody(tree: DefDef, target: Symbol): Tree = { val symbol = tree.symbol - log("specializing body of" + symbol.fullNameString + ": " + symbol.info) + log("specializing body of" + symbol.fullName + ": " + symbol.info) val DefDef(mods, name, tparams, vparamss, tpt, _) = tree val (_, origtparams) = splitParams(target.typeParams) log("substituting " + origtparams + " for " + symbol.typeParams) @@ -1091,7 +1090,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { val meth = treeCopy.DefDef(tree, mods, name, tparams, vparamss1, tpt, tmp) - log("now typing: " + meth + " in " + symbol.owner.fullNameString) + log("now typing: " + meth + " in " + symbol.owner.fullName) val d = new Duplicator d.retyped(localTyper.context1.asInstanceOf[d.Context], meth, @@ -1180,7 +1179,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { if m.hasFlag(SPECIALIZED) && (m.sourceFile ne null) && satisfiable(typeEnv(m), warn(cls))) { - log("creating tree for " + m.fullNameString) + log("creating tree for " + m.fullName) if (m.isMethod) { if (m.isClassConstructor) { val origParamss = parameters(info(m).target) @@ -1194,7 +1193,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { // param accessors for private members (the others are inherited from the generic class) for (param <- vparams if cls.info.nonPrivateMember(param.name) == NoSymbol; val acc = param.cloneSymbol(cls).setFlag(PARAMACCESSOR | PRIVATE)) { - log("param accessor for " + acc.fullNameString) + log("param accessor for " + acc.fullName) cls.info.decls.enter(acc) mbrs += ValDef(acc, EmptyTree).setType(NoType).setPos(m.pos) } @@ -1208,7 +1207,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { // mbrs += // ClassDef(m, Template(m.info.parents map TypeTree, emptyValDef, List()) // .setSymbol(m.newLocalDummy(m.pos))) -// log("created synthetic class: " + m.fullNameString) +// log("created synthetic class: " + m.fullName) } } mbrs.toList diff --git a/src/compiler/scala/tools/nsc/transform/TailCalls.scala b/src/compiler/scala/tools/nsc/transform/TailCalls.scala index 1575ec1384..a3fedc0819 100644 --- a/src/compiler/scala/tools/nsc/transform/TailCalls.scala +++ b/src/compiler/scala/tools/nsc/transform/TailCalls.scala @@ -162,7 +162,7 @@ abstract class TailCalls extends Transform newCtx.label.setInfo(MethodType(currentClassParam :: tree.symbol.tpe.params, tree.symbol.tpe.finalResultType)) newCtx.tailPos = true - val isEligible = newCtx.currentMethod.isFinal || (newCtx.currentMethod.enclClass hasFlag Flags.MODULE) + val isEligible = newCtx.currentMethod.isEffectivelyFinal || (newCtx.currentMethod.enclClass hasFlag Flags.MODULE) // If -Ytailrecommend is given, we speculatively try transforming ineligible methods and // report where we would have been successful. val recommend = settings.Ytailrec.value @@ -270,7 +270,7 @@ abstract class TailCalls extends Transform case Apply(tapply @ TypeApply(fun, targs), vargs) => lazy val defaultTree = treeCopy.Apply(tree, tapply, transformTrees(vargs, mkContext(ctx, false))) - if ( ctx.currentMethod.isFinal && + if ( ctx.currentMethod.isEffectivelyFinal && ctx.tailPos && isSameTypes(ctx.tparams, targs map (_.tpe.typeSymbol)) && isRecursiveCall(fun)) { @@ -299,7 +299,7 @@ abstract class TailCalls extends Transform case Apply(fun, args) => lazy val defaultTree = treeCopy.Apply(tree, fun, transformTrees(args, mkContext(ctx, false))) - if (ctx.currentMethod.isFinal && + if (ctx.currentMethod.isEffectivelyFinal && ctx.tailPos && isRecursiveCall(fun)) { fun match { diff --git a/src/compiler/scala/tools/nsc/transform/TypingTransformers.scala b/src/compiler/scala/tools/nsc/transform/TypingTransformers.scala index 4519f1a486..ab92b28735 100644 --- a/src/compiler/scala/tools/nsc/transform/TypingTransformers.scala +++ b/src/compiler/scala/tools/nsc/transform/TypingTransformers.scala @@ -7,7 +7,6 @@ package scala.tools.nsc package transform -import util.Position import scala.collection.mutable.{Map, HashMap} /** A base class for transforms. diff --git a/src/compiler/scala/tools/nsc/transform/UnCurry.scala b/src/compiler/scala/tools/nsc/transform/UnCurry.scala index dc475b4173..c9c7548e6d 100644 --- a/src/compiler/scala/tools/nsc/transform/UnCurry.scala +++ b/src/compiler/scala/tools/nsc/transform/UnCurry.scala @@ -9,7 +9,6 @@ package transform import symtab.Flags._ import scala.collection.mutable.{HashMap, HashSet} -import scala.tools.nsc.util.Position /*<export>*/ /** - uncurry all symbol and tree types (@see UnCurryPhase) @@ -64,8 +63,6 @@ abstract class UnCurry extends InfoTransform with TypingTransformers { case MethodType(params, ExistentialType(tparams, restpe @ MethodType(_, _))) => assert(false, "unexpected curried method types with intervening exitential") tp0 - case mt: ImplicitMethodType => - apply(MethodType(mt.params, mt.resultType)) case PolyType(List(), restpe) => // nullary method type apply(MethodType(List(), restpe)) case PolyType(tparams, restpe) => // polymorphic nullary method type, since it didn't occur in a higher-kinded position |