summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/reflect/internal/SymbolTable.scala4
-rw-r--r--src/compiler/scala/reflect/internal/TreeGen.scala2
-rw-r--r--src/compiler/scala/reflect/internal/Types.scala18
-rw-r--r--src/compiler/scala/tools/nsc/Global.scala2
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala4
-rw-r--r--src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala66
-rw-r--r--src/compiler/scala/tools/nsc/backend/opt/ClosureElimination.scala2
-rw-r--r--src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala5
-rw-r--r--src/compiler/scala/tools/nsc/matching/Matrix.scala3
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala15
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala6
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala2
-rw-r--r--src/compiler/scala/tools/nsc/transform/Constructors.scala2
-rw-r--r--src/compiler/scala/tools/nsc/transform/Erasure.scala14
-rw-r--r--src/compiler/scala/tools/nsc/transform/LambdaLift.scala22
-rw-r--r--src/compiler/scala/tools/nsc/transform/Mixin.scala14
-rw-r--r--src/compiler/scala/tools/nsc/transform/OverridingPairs.scala3
-rw-r--r--src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala3
-rw-r--r--src/compiler/scala/tools/nsc/transform/TailCalls.scala3
-rw-r--r--src/compiler/scala/tools/nsc/transform/UnCurry.scala7
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Contexts.scala8
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Duplicators.scala6
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Infer.scala25
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Namers.scala16
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala27
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala27
-rw-r--r--src/compiler/scala/tools/nsc/util/FlagsUtil.scala3
27 files changed, 124 insertions, 185 deletions
diff --git a/src/compiler/scala/reflect/internal/SymbolTable.scala b/src/compiler/scala/reflect/internal/SymbolTable.scala
index 81c4cef4d4..9e59c1d509 100644
--- a/src/compiler/scala/reflect/internal/SymbolTable.scala
+++ b/src/compiler/scala/reflect/internal/SymbolTable.scala
@@ -32,6 +32,9 @@ abstract class SymbolTable extends api.Universe
def abort(msg: String): Nothing = throw new Error(msg)
def abort(): Nothing = throw new Error()
+ /** Override with final implementation for inlining. */
+ def debuglog(msg: => String): Unit = if (settings.debug.value) log(msg)
+
/** Are we compiling for Java SE? */
// def forJVM: Boolean
@@ -119,7 +122,6 @@ abstract class SymbolTable extends api.Universe
import scala.tools.util.Signallable
import scala.runtime.ScalaRunTime.stringOf
-
// We can allow ourselves a structural type, these methods
// amount to a few calls per run at most. This does suggest
// a "Clearable" trait may be useful.
diff --git a/src/compiler/scala/reflect/internal/TreeGen.scala b/src/compiler/scala/reflect/internal/TreeGen.scala
index c17ab8be63..f184bcee51 100644
--- a/src/compiler/scala/reflect/internal/TreeGen.scala
+++ b/src/compiler/scala/reflect/internal/TreeGen.scala
@@ -150,7 +150,7 @@ abstract class TreeGen {
/** Cast `tree` to type `pt` */
def mkCast(tree: Tree, pt: Type): Tree = {
- if (settings.debug.value) log("casting " + tree + ":" + tree.tpe + " to " + pt)
+ debuglog("casting " + tree + ":" + tree.tpe + " to " + pt)
assert(!tree.tpe.isInstanceOf[MethodType], tree)
assert(!pt.typeSymbol.isPackageClass)
assert(!pt.typeSymbol.isPackageObjectClass)
diff --git a/src/compiler/scala/reflect/internal/Types.scala b/src/compiler/scala/reflect/internal/Types.scala
index 358258390f..2c626013b3 100644
--- a/src/compiler/scala/reflect/internal/Types.scala
+++ b/src/compiler/scala/reflect/internal/Types.scala
@@ -4034,14 +4034,13 @@ A type's typeSymbol should never be inspected directly.
def corresponds(sym1: Symbol, sym2: Symbol): Boolean =
sym1.name == sym2.name && (sym1.isPackageClass || corresponds(sym1.owner, sym2.owner))
if (!corresponds(sym.owner, rebind0.owner)) {
- if (settings.debug.value)
- log("ADAPT1 pre = "+pre+", sym = "+sym+sym.locationString+", rebind = "+rebind0+rebind0.locationString)
+ debuglog("ADAPT1 pre = "+pre+", sym = "+sym+sym.locationString+", rebind = "+rebind0+rebind0.locationString)
val bcs = pre.baseClasses.dropWhile(bc => !corresponds(bc, sym.owner));
if (bcs.isEmpty)
assert(pre.typeSymbol.isRefinementClass, pre) // if pre is a refinementclass it might be a structural type => OK to leave it in.
else
rebind0 = pre.baseType(bcs.head).member(sym.name)
- if (settings.debug.value) log(
+ debuglog(
"ADAPT2 pre = " + pre +
", bcs.head = " + bcs.head +
", sym = " + sym+sym.locationString +
@@ -4053,7 +4052,7 @@ A type's typeSymbol should never be inspected directly.
}
val rebind = rebind0.suchThat(sym => sym.isType || sym.isStable)
if (rebind == NoSymbol) {
- if (settings.debug.value) log("" + phase + " " +phase.flatClasses+sym.owner+sym.name+" "+sym.isType)
+ debuglog("" + phase + " " +phase.flatClasses+sym.owner+sym.name+" "+sym.isType)
throw new MalformedType(pre, sym.nameString)
}
rebind
@@ -5684,7 +5683,7 @@ A type's typeSymbol should never be inspected directly.
* of types.
*/
private def commonOwner(tps: List[Type]): Symbol = {
- // if (settings.debug.value) log("computing common owner of types " + tps)//DEBUG
+ // debuglog("computing common owner of types " + tps)//DEBUG
commonOwnerMap.init
tps foreach { tp => commonOwnerMap.apply(tp); () }
commonOwnerMap.result
@@ -5748,7 +5747,7 @@ A type's typeSymbol should never be inspected directly.
case ex: MalformedType => None
case ex: IndexOutOfBoundsException => // transpose freaked out because of irregular argss
// catching just in case (shouldn't happen, but also doesn't cost us)
- if (settings.debug.value) log("transposed irregular matrix!?"+ (tps, argss))
+ debuglog("transposed irregular matrix!?"+ (tps, argss))
None
}
case SingleType(_, sym) :: rest =>
@@ -5770,7 +5769,7 @@ A type's typeSymbol should never be inspected directly.
*/
def addMember(thistp: Type, tp: Type, sym: Symbol) {
assert(sym != NoSymbol)
- // if (settings.debug.value) log("add member " + sym+":"+sym.info+" to "+thistp) //DEBUG
+ // debuglog("add member " + sym+":"+sym.info+" to "+thistp) //DEBUG
if (!(thistp specializes sym)) {
if (sym.isTerm)
for (alt <- tp.nonPrivateDecl(sym.name).alternatives)
@@ -5909,7 +5908,7 @@ A type's typeSymbol should never be inspected directly.
if (!(declaredBoundsInst <:< argumentBounds))
stricterBound(hkarg, hkparam)
- if (settings.debug.value) log(
+ debuglog(
"checkKindBoundsHK base case: " + hkparam +
" declared bounds: " + declaredBounds +
" after instantiating earlier hkparams: " + declaredBoundsInst + "\n" +
@@ -5918,8 +5917,7 @@ A type's typeSymbol should never be inspected directly.
)
}
else {
- if (settings.debug.value)
- log("checkKindBoundsHK recursing to compare params of "+ hkparam +" with "+ hkarg)
+ debuglog("checkKindBoundsHK recursing to compare params of "+ hkparam +" with "+ hkarg)
val (am, vm, sb) = checkKindBoundsHK(
hkarg.typeParams,
hkarg,
diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala
index 5847563a63..2845ee8e03 100644
--- a/src/compiler/scala/tools/nsc/Global.scala
+++ b/src/compiler/scala/tools/nsc/Global.scala
@@ -167,7 +167,7 @@ class Global(var currentSettings: Settings, var reporter: Reporter) extends Symb
if (settings.debug.value)
body
}
- @inline final def debuglog(msg: => String) {
+ @inline final override def debuglog(msg: => String) {
if (settings.debug.value && (settings.log containsPhase globalPhase))
inform("[log " + phase + "] " + msg)
}
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 63ea572e2f..66acb8e4fe 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala
@@ -529,7 +529,7 @@ abstract class CopyPropagation {
var values = in.stack.take(1 + ctor.info.paramTypes.length).reverse.drop(1);
val bindings = mutable.HashMap[Symbol, Value]()
- if (settings.debug.value) log("getBindings for: " + ctor + " acc: " + paramAccessors)
+ debuglog("getBindings for: " + ctor + " acc: " + paramAccessors)
var paramTypes = ctor.tpe.paramTypes
val diff = paramTypes.length - paramAccessors.length
@@ -556,7 +556,7 @@ abstract class CopyPropagation {
values = values.tail;
}
- if (settings.debug.value) log("\t" + bindings)
+ debuglog("\t" + bindings)
bindings
}
diff --git a/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala b/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala
index f2f5ecb2fe..84f73223d5 100644
--- a/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala
+++ b/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala
@@ -279,8 +279,7 @@ abstract class GenMSIL extends SubComponent {
/*
- if (settings.debug.value)
- log("creating annotations: " + annotations + " for member : " + member)
+ debuglog("creating annotations: " + annotations + " for member : " + member)
for (annot@ AnnotationInfo(typ, annArgs, nvPairs) <- annotations ;
if annot.isConstant)
//!typ.typeSymbol.isJavaDefined
@@ -452,8 +451,7 @@ abstract class GenMSIL extends SubComponent {
val iclass = classes(sym)
val tBuilder = types(sym).asInstanceOf[TypeBuilder]
- if (settings.debug.value)
- log("Calling CreatType for " + sym + ", " + tBuilder.toString)
+ debuglog("Calling CreatType for " + sym + ", " + tBuilder.toString)
tBuilder.CreateType()
tBuilder.setSourceFilepath(iclass.cunit.source.file.path)
@@ -467,8 +465,7 @@ abstract class GenMSIL extends SubComponent {
private[GenMSIL] def genClass(iclass: IClass) {
val sym = iclass.symbol
- if (settings.debug.value)
- log("Generating class " + sym + " flags: " + Flags.flagsToString(sym.flags))
+ debuglog("Generating class " + sym + " flags: " + Flags.flagsToString(sym.flags))
clasz = iclass
val tBuilder = getType(sym).asInstanceOf[TypeBuilder]
@@ -480,8 +477,7 @@ abstract class GenMSIL extends SubComponent {
!((m.symbol.name.toString() != "clone" || m.symbol.name.toString() != "Clone") &&
m.symbol.tpe.paramTypes.length != 0)
})) {
- if (settings.debug.value)
- log("auto-generating cloneable method for " + sym)
+ debuglog("auto-generating cloneable method for " + sym)
val attrs: Short = (MethodAttributes.Public | MethodAttributes.Virtual |
MethodAttributes.HideBySig).toShort
val cloneMethod = tBuilder.DefineMethod("Clone", attrs, MOBJECT,
@@ -514,8 +510,7 @@ abstract class GenMSIL extends SubComponent {
private def genMethod(m: IMethod) {
- if (settings.debug.value)
- log("Generating method " + m.symbol + " flags: " + Flags.flagsToString(m.symbol.flags) +
+ debuglog("Generating method " + m.symbol + " flags: " + Flags.flagsToString(m.symbol.flags) +
" owner: " + m.symbol.owner)
method = m
localBuilders.clear
@@ -544,8 +539,7 @@ abstract class GenMSIL extends SubComponent {
if (mcode != null) {
for (local <- m.locals ; if !(m.params contains local)) {
- if (settings.debug.value)
- log("add local var: " + local + ", of kind " + local.kind)
+ debuglog("add local var: " + local + ", of kind " + local.kind)
val t: MsilType = msilType(local.kind)
val localBuilder = mcode.DeclareLocal(t)
localBuilder.SetLocalSymInfo(msilName(local.sym))
@@ -571,8 +565,7 @@ abstract class GenMSIL extends SubComponent {
def genCode(m: IMethod) {
def makeLabels(blocks: List[BasicBlock]) = {
- if (settings.debug.value)
- log("Making labels for: " + method)
+ debuglog("Making labels for: " + method)
for (bb <- blocks) labels(bb) = mcode.DefineLabel()
}
@@ -818,8 +811,7 @@ abstract class GenMSIL extends SubComponent {
def genBlock(block: BasicBlock, prev: BasicBlock, next: BasicBlock) {
def loadLocalOrAddress(local: Local, msg : String , loadAddr : Boolean) {
- if (settings.debug.value)
- log(msg + " for " + local)
+ debuglog(msg + " for " + local)
val isArg = local.arg
val i = local.index
if (isArg)
@@ -829,8 +821,7 @@ abstract class GenMSIL extends SubComponent {
}
def loadFieldOrAddress(field: Symbol, isStatic: Boolean, msg: String, loadAddr : Boolean) {
- if (settings.debug.value)
- log(msg + " with owner: " + field.owner +
+ debuglog(msg + " with owner: " + field.owner +
" flags: " + Flags.flagsToString(field.owner.flags))
var fieldInfo = fields.get(field) match {
case Some(fInfo) => fInfo
@@ -916,8 +907,7 @@ abstract class GenMSIL extends SubComponent {
}
mcode.MarkLabel(labels(block))
- if (settings.debug.value)
- log("Generating code for block: " + block)
+ debuglog("Generating code for block: " + block)
for (handler <- beginCatchBlock.get(block)) {
if (!currentHandlers.isEmpty && currentHandlers.top.covered == handler.covered) {
@@ -1017,8 +1007,7 @@ abstract class GenMSIL extends SubComponent {
mcode.Emit(OpCodes.Newobj, constructorInfo)
case LOAD_MODULE(module) =>
- if (settings.debug.value)
- log("Generating LOAD_MODULE for: " + showsym(module))
+ debuglog("Generating LOAD_MODULE for: " + showsym(module))
mcode.Emit(OpCodes.Ldsfld, getModuleInstanceField(module))
case STORE_ARRAY_ITEM(kind) =>
@@ -1040,8 +1029,7 @@ abstract class GenMSIL extends SubComponent {
case STORE_LOCAL(local) =>
val isArg = local.arg
val i = local.index
- if (settings.debug.value)
- log("store_local for " + local + ", index " + i)
+ debuglog("store_local for " + local + ", index " + i)
// there are some locals defined by the compiler that
// are isArg and are need to be stored.
@@ -1371,8 +1359,7 @@ abstract class GenMSIL extends SubComponent {
}
case Conversion(src, dst) =>
- if (settings.debug.value)
- log("Converting from: " + src + " to: " + dst)
+ debuglog("Converting from: " + src + " to: " + dst)
dst match {
case BYTE => mcode.Emit(OpCodes.Conv_I1) // I1 for System.SByte, i.e. a scala.Byte
@@ -1586,8 +1573,7 @@ abstract class GenMSIL extends SubComponent {
val params = m.params
for (l <- params) {
- if (settings.debug.value)
- log("Index value for parameter " + l + ": " + idx)
+ debuglog("Index value for parameter " + l + ": " + idx)
l.index = idx
idx += 1 // sizeOf(l.kind)
}
@@ -1596,8 +1582,7 @@ abstract class GenMSIL extends SubComponent {
idx = 0
for (l <- locvars) {
- if (settings.debug.value)
- log("Index value for local variable " + l + ": " + idx)
+ debuglog("Index value for local variable " + l + ": " + idx)
l.index = idx
idx += 1 // sizeOf(l.kind)
}
@@ -1856,8 +1841,7 @@ abstract class GenMSIL extends SubComponent {
else sym.info.parents.distinct
val superType : MsilType = if (isInterface(sym)) null else msilTypeFromSym(parents.head.typeSymbol)
- if (settings.debug.value)
- log("super type: " + parents(0).typeSymbol + ", msil type: " + superType)
+ debuglog("super type: " + parents(0).typeSymbol + ", msil type: " + superType)
val interfaces: Array[MsilType] =
parents.tail.map(p => msilTypeFromSym(p.typeSymbol)).toArray
@@ -1897,8 +1881,7 @@ abstract class GenMSIL extends SubComponent {
for (ifield <- iclass.fields) {
val sym = ifield.symbol
- if (settings.debug.value)
- log("Adding field: " + sym.fullName)
+ debuglog("Adding field: " + sym.fullName)
var attributes = msilFieldFlags(sym)
val fieldTypeWithCustomMods =
@@ -1929,8 +1912,7 @@ abstract class GenMSIL extends SubComponent {
if (iclass.symbol != definitions.ArrayClass) {
for (m: IMethod <- iclass.methods) {
val sym = m.symbol
- if (settings.debug.value)
- log("Creating MethodBuilder for " + Flags.flagsToString(sym.flags) + " " +
+ debuglog("Creating MethodBuilder for " + Flags.flagsToString(sym.flags) + " " +
sym.owner.fullName + "::" + sym.name)
val ownerType = getType(sym.enclClass).asInstanceOf[TypeBuilder]
@@ -1956,8 +1938,7 @@ abstract class GenMSIL extends SubComponent {
if (!methods.contains(sym))
mapMethod(sym, method)
addAttributes(method, sym.annotations)
- if (settings.debug.value)
- log("\t created MethodBuilder " + method)
+ debuglog("\t created MethodBuilder " + method)
}
}
} // method builders created for non-array iclass
@@ -1994,8 +1975,7 @@ abstract class GenMSIL extends SubComponent {
}
private def addModuleInstanceField(sym: Symbol) {
- if (settings.debug.value)
- log("Adding Module-Instance Field for " + showsym(sym))
+ debuglog("Adding Module-Instance Field for " + showsym(sym))
val tBuilder = getType(sym).asInstanceOf[TypeBuilder]
val fb = tBuilder.DefineField(MODULE_INSTANCE_NAME,
tBuilder,
@@ -2071,8 +2051,7 @@ abstract class GenMSIL extends SubComponent {
private def dumpMirrorClass(sym: Symbol) {
val tBuilder = getType(sym)
assert(sym.isModuleClass, "Can't generate Mirror-Class for the Non-Module class " + sym)
- if (settings.debug.value)
- log("Dumping mirror class for object: " + sym)
+ debuglog("Dumping mirror class for object: " + sym)
val moduleName = msilName(sym)
val mirrorName = moduleName.substring(0, moduleName.length() - 1)
val mirrorTypeBuilder = mmodule.DefineType(mirrorName,
@@ -2089,8 +2068,7 @@ abstract class GenMSIL extends SubComponent {
m.isMethod && !m.isClassConstructor && !m.isStaticMember && !m.isCase &&
!m.isDeferred)
{
- if (settings.debug.value)
- log(" Mirroring method: " + m)
+ debuglog(" Mirroring method: " + m)
val paramTypes = msilParamTypes(m)
val paramNames: Array[String] = new Array[String](paramTypes.length)
for (i <- 0 until paramTypes.length)
diff --git a/src/compiler/scala/tools/nsc/backend/opt/ClosureElimination.scala b/src/compiler/scala/tools/nsc/backend/opt/ClosureElimination.scala
index d5194346c9..e0d51aee16 100644
--- a/src/compiler/scala/tools/nsc/backend/opt/ClosureElimination.scala
+++ b/src/compiler/scala/tools/nsc/backend/opt/ClosureElimination.scala
@@ -101,7 +101,7 @@ abstract class ClosureElimination extends SubComponent {
for (bb <- linearizer.linearize(m)) {
var info = cpp.in(bb)
- if (settings.debug.value) log("Cpp info at entry to block " + bb + ": " + info)
+ debuglog("Cpp info at entry to block " + bb + ": " + info)
for (i <- bb) {
i match {
diff --git a/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala b/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala
index c591fee502..68e0a76a78 100644
--- a/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala
+++ b/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala
@@ -136,8 +136,7 @@ abstract class DeadCodeElimination extends SubComponent {
while (!worklist.isEmpty) {
val (bb, idx) = worklist.iterator.next
worklist -= ((bb, idx))
- if (settings.debug.value)
- log("Marking instr: \tBB_" + bb + ": " + idx + " " + bb(idx))
+ debuglog("Marking instr: \tBB_" + bb + ": " + idx + " " + bb(idx))
val instr = bb(idx)
if (!useful(bb)(idx)) {
@@ -211,7 +210,7 @@ abstract class DeadCodeElimination extends SubComponent {
log("skipped object creation: " + sym + "inside " + m)
case _ => ()
}
- if (settings.debug.value) log("Skipped: bb_" + bb + ": " + idx + "( " + i + ")")
+ debuglog("Skipped: bb_" + bb + ": " + idx + "( " + i + ")")
}
}
diff --git a/src/compiler/scala/tools/nsc/matching/Matrix.scala b/src/compiler/scala/tools/nsc/matching/Matrix.scala
index e5b0de6040..61864f0c8a 100644
--- a/src/compiler/scala/tools/nsc/matching/Matrix.scala
+++ b/src/compiler/scala/tools/nsc/matching/Matrix.scala
@@ -122,8 +122,7 @@ trait Matrix extends MatrixAdditions {
private val _syntheticSyms = mutable.HashSet[Symbol]()
def clearSyntheticSyms() = {
_syntheticSyms foreach (_ resetFlag (NO_EXHAUSTIVE|MUTABLE))
- if (settings.debug.value)
- log("Cleared NO_EXHAUSTIVE/MUTABLE on " + _syntheticSyms.size + " synthetic symbols.")
+ debuglog("Cleared NO_EXHAUSTIVE/MUTABLE on " + _syntheticSyms.size + " synthetic symbols.")
_syntheticSyms.clear()
}
def recordSyntheticSym(sym: Symbol): Symbol = {
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
index 1970a580a6..f121571d17 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
@@ -225,11 +225,9 @@ abstract class ClassfileParser {
first != CONSTANT_METHODREF &&
first != CONSTANT_INTFMETHODREF) errorBadTag(start)
val ownerTpe = getClassOrArrayType(in.getChar(start + 1))
- if (settings.debug.value)
- log("getMemberSymbol(static: " + static + "): owner type: " + ownerTpe + " " + ownerTpe.typeSymbol.originalName)
+ debuglog("getMemberSymbol(static: " + static + "): owner type: " + ownerTpe + " " + ownerTpe.typeSymbol.originalName)
val (name0, tpe0) = getNameAndType(in.getChar(start + 3), ownerTpe)
- if (settings.debug.value)
- log("getMemberSymbol: name and tpe: " + name0 + ": " + tpe0)
+ debuglog("getMemberSymbol: name and tpe: " + name0 + ": " + tpe0)
forceMangledName(tpe0.typeSymbol.name, false)
val (name, tpe) = getNameAndType(in.getChar(start + 3), ownerTpe)
@@ -904,8 +902,7 @@ abstract class ClassfileParser {
else println("failure to convert " + c + " to " + symtype); //debug
case tpnme.ScalaSignatureATTR =>
if (!isScalaAnnot) {
- if (settings.debug.value)
- log("warning: symbol " + sym.fullName + " has pickled signature in attribute")
+ debuglog("warning: symbol " + sym.fullName + " has pickled signature in attribute")
unpickler.unpickle(in.buf, in.bp, clazz, staticModule, in.file.toString())
}
in.skip(attrLen)
@@ -932,8 +929,7 @@ abstract class ClassfileParser {
case None =>
throw new RuntimeException("Scala class file does not contain Scala annotation")
}
- if (settings.debug.value)
- log("" + sym + "; annotations = " + sym.rawAnnotations)
+ debuglog("" + sym + "; annotations = " + sym.rawAnnotations)
} else
in.skip(attrLen)
@@ -1049,8 +1045,7 @@ abstract class ClassfileParser {
} catch {
case f: FatalError => throw f // don't eat fatal errors, they mean a class was not found
case ex: Throwable =>
- if (settings.debug.value)
- log("dropping annotation on " + sym + ", an error occured during parsing (e.g. annotation class not found)")
+ debuglog("dropping annotation on " + sym + ", an error occured during parsing (e.g. annotation class not found)")
None // ignore malformed annotations ==> t1135
}
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala
index b9e8abe53f..94a67bf375 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala
@@ -160,13 +160,13 @@ abstract class ICodeReader extends ClassfileParser {
val attributeCount = in.nextChar
for (i <- 0 until attributeCount) parseAttribute()
} else {
- if (settings.debug.value) log("Skipping non-existent method.");
+ debuglog("Skipping non-existent method.");
skipAttributes();
}
} catch {
case e: MissingRequirementError =>
in.bp = beginning; skipAttributes
- if (settings.debug.value) log("Skipping non-existent method. " + e.msg);
+ debuglog("Skipping non-existent method. " + e.msg);
}
}
@@ -932,7 +932,7 @@ abstract class ICodeReader extends ClassfileParser {
for ((i, idx) <- bb.toList.zipWithIndex) i match {
case CALL_METHOD(m, Static(true)) if m.isClassConstructor =>
val defs = rdef.findDefs(bb, idx, 1, m.info.paramTypes.length)
- if (settings.debug.value) log("ctor: " + i + " found defs: " + defs)
+ debuglog("ctor: " + i + " found defs: " + defs)
assert(defs.length == 1, "wrong defs at bb " + bb + "\n" + method.dump + rdef)
val (bb1, idx1) = defs.head
var producer = bb1(idx1)
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala b/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala
index e082e6c616..475804c2a6 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala
@@ -39,7 +39,7 @@ abstract class Pickler extends SubComponent {
def pickle(tree: Tree) {
def add(sym: Symbol, pickle: Pickle) = {
if (currentRun.compiles(sym) && !currentRun.symData.contains(sym)) {
- if (settings.debug.value) log("pickling " + sym)
+ debuglog("pickling " + sym)
pickle putSymbol sym
currentRun.symData(sym) = pickle
}
diff --git a/src/compiler/scala/tools/nsc/transform/Constructors.scala b/src/compiler/scala/tools/nsc/transform/Constructors.scala
index eb700f1610..e0c6e8678b 100644
--- a/src/compiler/scala/tools/nsc/transform/Constructors.scala
+++ b/src/compiler/scala/tools/nsc/transform/Constructors.scala
@@ -329,7 +329,7 @@ abstract class Constructors extends Transform with ast.TreeDSL {
val stat2 = rewriteArrayUpdate(stat1)
// statements coming from the original class need retyping in the current context
- if (settings.debug.value) log("retyping " + stat2)
+ debuglog("retyping " + stat2)
val d = new specializeTypes.Duplicator
d.retyped(localTyper.context1.asInstanceOf[d.Context],
diff --git a/src/compiler/scala/tools/nsc/transform/Erasure.scala b/src/compiler/scala/tools/nsc/transform/Erasure.scala
index c2013e77f9..99df069e3b 100644
--- a/src/compiler/scala/tools/nsc/transform/Erasure.scala
+++ b/src/compiler/scala/tools/nsc/transform/Erasure.scala
@@ -649,8 +649,7 @@ abstract class Erasure extends AddInterfaces
if (!atPhase(currentRun.refchecksPhase.next)(
root.thisType.memberType(opc.overriding) matches
root.thisType.memberType(opc.overridden))) {
- if (settings.debug.value)
- log("" + opc.overriding.locationString + " " +
+ debuglog("" + opc.overriding.locationString + " " +
opc.overriding.infosString +
opc.overridden.locationString + " " +
opc.overridden.infosString)
@@ -669,7 +668,7 @@ abstract class Erasure extends AddInterfaces
atPhase(phase.next)(member.tpe =:= other.tpe) &&
!atPhase(refchecksPhase.next)(
root.thisType.memberType(member) matches root.thisType.memberType(other))) {
- if (settings.debug.value) log("" + member.locationString + " " + member.infosString + other.locationString + " " + other.infosString);
+ debuglog("" + member.locationString + " " + member.infosString + other.locationString + " " + other.infosString);
doubleDefError(member, other)
}
}
@@ -745,8 +744,7 @@ abstract class Erasure extends AddInterfaces
(((Select(This(owner), member): Tree) /: bridge.paramss)
((fun, vparams) => Apply(fun, vparams map Ident)))
});
- if (settings.debug.value)
- log("generating bridge from " + other + "(" + Flags.flagsToString(bridge.flags) + ")" + ":" + otpe + other.locationString + " to " + member + ":" + erasure(owner, member.tpe) + member.locationString + " =\n " + bridgeDef);
+ debuglog("generating bridge from " + other + "(" + Flags.flagsToString(bridge.flags) + ")" + ":" + otpe + other.locationString + " to " + member + ":" + erasure(owner, member.tpe) + member.locationString + " =\n " + bridgeDef);
bridgeDef
}
} :: bridges
@@ -797,8 +795,7 @@ abstract class Erasure extends AddInterfaces
private val preTransformer = new TypingTransformer(unit) {
def preErase(tree: Tree): Tree = tree match {
case ClassDef(mods, name, tparams, impl) =>
- if (settings.debug.value)
- log("defs of " + tree.symbol + " = " + tree.symbol.info.decls)
+ debuglog("defs of " + tree.symbol + " = " + tree.symbol.info.decls)
treeCopy.ClassDef(tree, mods, name, List(), impl)
case DefDef(mods, name, tparams, vparamss, tpt, rhs) =>
treeCopy.DefDef(tree, mods, name, List(), vparamss, tpt, rhs)
@@ -997,8 +994,7 @@ abstract class Erasure extends AddInterfaces
val tree1 = preTransformer.transform(tree)
atPhase(phase.next) {
val tree2 = mixinTransformer.transform(tree1)
- if (settings.debug.value)
- log("tree after addinterfaces: \n" + tree2)
+ debuglog("tree after addinterfaces: \n" + tree2)
newTyper(rootContext(unit, tree, true)).typed(tree2)
}
diff --git a/src/compiler/scala/tools/nsc/transform/LambdaLift.scala b/src/compiler/scala/tools/nsc/transform/LambdaLift.scala
index 533caff078..e3cd9eb351 100644
--- a/src/compiler/scala/tools/nsc/transform/LambdaLift.scala
+++ b/src/compiler/scala/tools/nsc/transform/LambdaLift.scala
@@ -97,8 +97,7 @@ abstract class LambdaLift extends InfoTransform {
* }
*/
private def markFree(sym: Symbol, enclosure: Symbol): Boolean = {
- if (settings.debug.value)
- log("mark free: " + sym + " of " + sym.owner + " marked free in " + enclosure)
+ debuglog("mark free: " + sym + " of " + sym.owner + " marked free in " + enclosure)
if (enclosure == sym.owner.logicallyEnclosingMember) true
else if (enclosure.isPackageClass || !markFree(sym, enclosure.skipConstructor.owner.logicallyEnclosingMember)) false
else {
@@ -116,7 +115,7 @@ abstract class LambdaLift extends InfoTransform {
sym.owner.setInfo(sym.owner.info.cloneInfo(sym.owner))
}
changedFreeVars = true
- if (settings.debug.value) log("" + sym + " is free in " + enclosure);
+ debuglog("" + sym + " is free in " + enclosure);
if ((sym.isVariable || (sym.isValue && sym.isLazy)) && !sym.hasFlag(CAPTURED)) {
sym setFlag CAPTURED
val symClass = sym.tpe.typeSymbol
@@ -135,8 +134,7 @@ abstract class LambdaLift extends InfoTransform {
}
private def markCalled(sym: Symbol, owner: Symbol) {
- if (settings.debug.value)
- log("mark called: " + sym + " of " + sym.owner + " is called by " + owner)
+ debuglog("mark called: " + sym + " of " + sym.owner + " is called by " + owner)
symSet(called, owner) addEntry sym
}
@@ -204,14 +202,12 @@ abstract class LambdaLift extends InfoTransform {
if (sym.name.isTypeName) unit.freshTypeName(base)
else unit.freshTermName(base)
- if (settings.debug.value)
- log("renaming in %s: %s => %s".format(sym.owner.fullLocationString, originalName, sym.name))
+ debuglog("renaming in %s: %s => %s".format(sym.owner.fullLocationString, originalName, sym.name))
}
atPhase(phase.next) {
for ((owner, freeValues) <- free.toList) {
- if (settings.debug.value)
- log("free var proxy: %s, %s".format(owner.fullLocationString, freeValues.toList.mkString(", ")))
+ debuglog("free var proxy: %s, %s".format(owner.fullLocationString, freeValues.toList.mkString(", ")))
proxies(owner) =
for (fv <- freeValues.toList) yield {
@@ -228,15 +224,13 @@ abstract class LambdaLift extends InfoTransform {
private def proxy(sym: Symbol) = {
def searchIn(enclosure: Symbol): Symbol = {
- if (settings.debug.value)
- log("searching for " + sym + "(" + sym.owner + ") in " + enclosure + " " + enclosure.logicallyEnclosingMember)
+ debuglog("searching for " + sym + "(" + sym.owner + ") in " + enclosure + " " + enclosure.logicallyEnclosingMember)
val ps = (proxies get enclosure.logicallyEnclosingMember).toList.flatten filter (_.name == sym.name)
if (ps.isEmpty) searchIn(enclosure.skipConstructor.owner)
else ps.head
}
- if (settings.debug.value)
- log("proxy " + sym + " in " + sym.owner + " from " + currentOwner.ownerChain.mkString(" -> ") +
+ debuglog("proxy " + sym + " in " + sym.owner + " from " + currentOwner.ownerChain.mkString(" -> ") +
" " + sym.owner.logicallyEnclosingMember)
if (isSameOwnerEnclosure(sym)) sym
@@ -337,7 +331,7 @@ abstract class LambdaLift extends InfoTransform {
if (sym.isMethod) sym setFlag LIFTED
liftedDefs(sym.owner) ::= tree
sym.owner.info.decls enterUnique sym
- if (settings.debug.value) log("lifted: " + sym + " from " + oldOwner + " to " + sym.owner)
+ debuglog("lifted: " + sym + " from " + oldOwner + " to " + sym.owner)
EmptyTree
}
diff --git a/src/compiler/scala/tools/nsc/transform/Mixin.scala b/src/compiler/scala/tools/nsc/transform/Mixin.scala
index 39eb9be060..d43dfdd3d9 100644
--- a/src/compiler/scala/tools/nsc/transform/Mixin.scala
+++ b/src/compiler/scala/tools/nsc/transform/Mixin.scala
@@ -95,8 +95,7 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL {
atPhase(currentRun.picklerPhase.next) {
var bcs = base.info.baseClasses.dropWhile(mixinClass !=).tail
var sym: Symbol = NoSymbol
- if (settings.debug.value)
- log("starting rebindsuper " + base + " " + member + ":" + member.tpe +
+ debuglog("starting rebindsuper " + base + " " + member + ":" + member.tpe +
" " + mixinClass + " " + base.info.baseClasses + "/" + bcs)
while (!bcs.isEmpty && sym == NoSymbol) {
if (settings.debug.value) {
@@ -132,7 +131,7 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL {
/** Add given member to given class, and mark member as mixed-in.
*/
def addMember(clazz: Symbol, member: Symbol): Symbol = {
- if (settings.debug.value) log("new member of " + clazz + ":" + member.defString)
+ debuglog("new member of " + clazz + ":" + member.defString)
clazz.info.decls enter member
member.setFlag(MIXEDIN)
}
@@ -199,7 +198,7 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL {
}
}
}
- if (settings.debug.value) log("new defs of " + clazz + " = " + clazz.info.decls);
+ debuglog("new defs of " + clazz + " = " + clazz.info.decls);
}
}
@@ -609,7 +608,7 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL {
/** Attribute given tree and anchor at given position */
def attributedDef(pos: Position, tree: Tree): Tree = {
- if (settings.debug.value) log("add new def to " + clazz + ": " + tree)
+ debuglog("add new def to " + clazz + ": " + tree)
typedPos(pos)(tree)
}
@@ -669,8 +668,7 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL {
val rhs0 = (Super(clazz, tpnme.EMPTY) DOT stat.symbol.alias)(vparams map (v => Ident(v.symbol)): _*)
val rhs1 = localTyper.typed(atPos(stat.pos)(rhs0), stat.symbol.tpe.resultType)
val rhs2 = atPhase(currentRun.mixinPhase)(transform(rhs1))
- if (settings.debug.value)
- log("complete super acc " + stat.symbol + stat.symbol.locationString +
+ debuglog("complete super acc " + stat.symbol + stat.symbol.locationString +
" " + rhs1 + " " + stat.symbol.alias + stat.symbol.alias.locationString +
"/" + stat.symbol.alias.owner.hasFlag(lateINTERFACE))//debug
treeCopy.DefDef(stat, mods, name, tparams, List(vparams), tpt, rhs2)
@@ -999,7 +997,7 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL {
var fieldsCheckinitTransient = 0
for (f <- clazz0.info.decls.iterator) {
- if (settings.debug.value) log(f.fullName + " -> " + fields)
+ debuglog(f.fullName + " -> " + fields)
if (fieldWithBitmap(f)) {
val (idx, _) =
diff --git a/src/compiler/scala/tools/nsc/transform/OverridingPairs.scala b/src/compiler/scala/tools/nsc/transform/OverridingPairs.scala
index 1e6d86bb97..70f8d37585 100644
--- a/src/compiler/scala/tools/nsc/transform/OverridingPairs.scala
+++ b/src/compiler/scala/tools/nsc/transform/OverridingPairs.scala
@@ -136,8 +136,7 @@ abstract class OverridingPairs {
include(subParents(bcIndex), pIndex)
case None =>
}
- else if (settings.debug.value)
- log("SKIPPING "+p+" -> "+p.baseType(bc)+" / "+self.baseType(bc)+" from "+base)
+ else debuglog("SKIPPING "+p+" -> "+p.baseType(bc)+" / "+self.baseType(bc)+" from "+base)
case None =>
}
}
diff --git a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
index d155665de1..ade15f2c81 100644
--- a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
+++ b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
@@ -1389,8 +1389,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers {
case SpecialOverride(target) =>
assert(body.isDefinedAt(target), "sym: " + symbol.fullName + " target: " + target.fullName)
- //if (settings.debug.value)
- log("moving implementation, body of target " + target + ": " + body(target))
+ //debuglog("moving implementation, body of target " + target + ": " + body(target))
log("%s is param accessor? %b".format(ddef.symbol, ddef.symbol.isParamAccessor))
// we have an rhs, specialize it
val tree1 = addBody(ddef, target)
diff --git a/src/compiler/scala/tools/nsc/transform/TailCalls.scala b/src/compiler/scala/tools/nsc/transform/TailCalls.scala
index 79bcc76988..5013e8f21d 100644
--- a/src/compiler/scala/tools/nsc/transform/TailCalls.scala
+++ b/src/compiler/scala/tools/nsc/transform/TailCalls.scala
@@ -192,8 +192,7 @@ abstract class TailCalls extends Transform {
* Position is unchanged (by default, the method definition.)
*/
def fail(reason: String) = {
- if (settings.debug.value)
- log("Cannot rewrite recursive call at: " + fun.pos + " because: " + reason)
+ debuglog("Cannot rewrite recursive call at: " + fun.pos + " because: " + reason)
ctx.failReason = reason
treeCopy.Apply(tree, target, transformArgs)
diff --git a/src/compiler/scala/tools/nsc/transform/UnCurry.scala b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
index bd9f24177a..8ac69f15e1 100644
--- a/src/compiler/scala/tools/nsc/transform/UnCurry.scala
+++ b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
@@ -432,8 +432,7 @@ abstract class UnCurry extends InfoTransform
/** Transform tree `t` to { def f = t; f } where `f` is a fresh name
*/
def liftTree(tree: Tree) = {
- if (settings.debug.value)
- log("lifting tree at: " + (tree.pos))
+ debuglog("lifting tree at: " + (tree.pos))
val sym = currentOwner.newMethod(tree.pos, unit.freshTermName("liftedTree"))
sym.setInfo(MethodType(List(), tree.tpe))
new ChangeOwnerTraverser(currentOwner, sym).traverse(tree)
@@ -620,7 +619,7 @@ abstract class UnCurry extends InfoTransform
EmptyTree,
Match(Ident(exname), cases))
}
- if (settings.debug.value) log("rewrote try: " + catches + " ==> " + catchall);
+ debuglog("rewrote try: " + catches + " ==> " + catchall);
val catches1 = localTyper.typedCases(
tree, List(catchall), ThrowableClass.tpe, WildcardType)
treeCopy.Try(tree, body, catches1, finalizer)
@@ -633,7 +632,7 @@ abstract class UnCurry extends InfoTransform
case Select(_, _) | TypeApply(_, _) =>
applyUnary()
case Return(expr) if (tree.symbol != currentOwner.enclMethod || currentOwner.isLazy) =>
- if (settings.debug.value) log("non local return in "+tree.symbol+" from "+currentOwner.enclMethod)
+ debuglog("non local return in "+tree.symbol+" from "+currentOwner.enclMethod)
atPos(tree.pos)(nonLocalReturnThrow(expr, tree.symbol))
case TypeTree() =>
tree
diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
index 8e22da83b0..96b27b58ae 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
@@ -504,7 +504,7 @@ trait Contexts { self: Analyzer =>
def restoreTypeBounds(tp: Type): Type = {
var current = tp
for ((sym, info) <- savedTypeBounds) {
- if (settings.debug.value) log("resetting " + sym + " to " + info);
+ debuglog("resetting " + sym + " to " + info);
sym.info match {
case TypeBounds(lo, hi) if (hi <:< lo && lo <:< hi) =>
current = current.instantiateTypeParams(List(sym), List(lo))
@@ -558,7 +558,7 @@ trait Contexts { self: Analyzer =>
}
impls
}
- //if (settings.debug.value) log("collect implicit imports " + imp + "=" + collect(imp.tree.selectors))//DEBUG
+ //debuglog("collect implicit imports " + imp + "=" + collect(imp.tree.selectors))//DEBUG
collect(imp.tree.selectors)
}
@@ -570,14 +570,14 @@ trait Contexts { self: Analyzer =>
val newImplicits: List[ImplicitInfo] =
if (owner != nextOuter.owner && owner.isClass && !owner.isPackageClass && !inSelfSuperCall) {
if (!owner.isInitialized) return nextOuter.implicitss
- // if (settings.debug.value) log("collect member implicits " + owner + ", implicit members = " + owner.thisType.implicitMembers)//DEBUG
+ // debuglog("collect member implicits " + owner + ", implicit members = " + owner.thisType.implicitMembers)//DEBUG
val savedEnclClass = enclClass
this.enclClass = this
val res = collectImplicits(owner.thisType.implicitMembers, owner.thisType)
this.enclClass = savedEnclClass
res
} else if (scope != nextOuter.scope && !owner.isPackageClass) {
- if (settings.debug.value) log("collect local implicits " + scope.toList)//DEBUG
+ debuglog("collect local implicits " + scope.toList)//DEBUG
collectImplicits(scope.toList, NoPrefix)
} else if (imports != nextOuter.imports) {
assert(imports.tail == nextOuter.imports)
diff --git a/src/compiler/scala/tools/nsc/typechecker/Duplicators.scala b/src/compiler/scala/tools/nsc/typechecker/Duplicators.scala
index 44c566030b..16b01d3f05 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Duplicators.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Duplicators.scala
@@ -196,11 +196,11 @@ abstract class Duplicators extends Analyzer {
* namer/typer handle them, or Idents that refer to them.
*/
override def typed(tree: Tree, mode: Int, pt: Type): Tree = {
- if (settings.debug.value) log("typing " + tree + ": " + tree.tpe)
+ debuglog("typing " + tree + ": " + tree.tpe)
if (tree.hasSymbol && tree.symbol != NoSymbol
&& !tree.symbol.isLabel // labels cannot be retyped by the type checker as LabelDef has no ValDef/return type trees
&& invalidSyms.isDefinedAt(tree.symbol)) {
- if (settings.debug.value) log("removed symbol " + tree.symbol)
+ debuglog("removed symbol " + tree.symbol)
tree.symbol = NoSymbol
}
@@ -266,7 +266,7 @@ abstract class Duplicators extends Analyzer {
// log("selection on this: " + tree)
val tree1 = This(newClassOwner)
// log("tree1: " + tree1)
- if (settings.debug.value) log("mapped " + tree + " to " + tree1)
+ debuglog("mapped " + tree + " to " + tree1)
super.typed(atPos(tree.pos)(tree1), mode, pt)
case This(_) =>
diff --git a/src/compiler/scala/tools/nsc/typechecker/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
index d4986e3dc1..2a6fc122e2 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
@@ -1323,15 +1323,15 @@ trait Infer {
if (restpe.instantiateTypeParams(undetparams, tvars) <:< pt) {
computeArgs
} else if (isFullyDefined(pt)) {
- if (settings.debug.value) log("infer constr " + tree + ":" + restpe + ", pt = " + pt)
+ debuglog("infer constr " + tree + ":" + restpe + ", pt = " + pt)
var ptparams = freeTypeParamsOfTerms.collect(pt)
- if (settings.debug.value) log("free type params = " + ptparams)
+ debuglog("free type params = " + ptparams)
val ptWithWildcards = pt.instantiateTypeParams(ptparams, ptparams map (ptparam => WildcardType))
tvars = undetparams map freshVar
if (restpe.instantiateTypeParams(undetparams, tvars) <:< ptWithWildcards) {
computeArgs
restpe = skipImplicit(tree.tpe.resultType)
- if (settings.debug.value) log("new tree = " + tree + ":" + restpe)
+ debuglog("new tree = " + tree + ":" + restpe)
val ptvars = ptparams map freshVar
val pt1 = pt.instantiateTypeParams(ptparams, ptvars)
if (isPopulated(restpe, pt1)) {
@@ -1370,7 +1370,7 @@ trait Infer {
context.nextEnclosing(_.tree.isInstanceOf[CaseDef]).pushTypeBounds(tparam)
tparam setInfo tvar.constr.inst
tparam resetFlag DEFERRED
- if (settings.debug.value) log("new alias of " + tparam + " = " + tparam.info)
+ debuglog("new alias of " + tparam + " = " + tparam.info)
} else {
val (lo, hi) = instBounds(tvar)
if (lo <:< hi) {
@@ -1378,12 +1378,12 @@ trait Infer {
&& tparam != lo.typeSymbolDirect && tparam != hi.typeSymbolDirect) { // don't create illegal cycles
context.nextEnclosing(_.tree.isInstanceOf[CaseDef]).pushTypeBounds(tparam)
tparam setInfo TypeBounds(lo, hi)
- if (settings.debug.value) log("new bounds of " + tparam + " = " + tparam.info)
+ debuglog("new bounds of " + tparam + " = " + tparam.info)
} else {
- if (settings.debug.value) log("redundant: "+tparam+" "+tparam.info+"/"+lo+" "+hi)
+ debuglog("redundant: "+tparam+" "+tparam.info+"/"+lo+" "+hi)
}
} else {
- if (settings.debug.value) log("inconsistent: "+tparam+" "+lo+" "+hi)
+ debuglog("inconsistent: "+tparam+" "+lo+" "+hi)
}
}
}
@@ -1474,8 +1474,7 @@ trait Infer {
checkCheckable(pos, pattp, "pattern ")
if (pattp <:< pt) ()
else {
- if (settings.debug.value)
- log("free type params (1) = " + tpparams)
+ debuglog("free type params (1) = " + tpparams)
var tvars = tpparams map freshVar
var tp = pattp.instantiateTypeParams(tpparams, tvars)
@@ -1485,8 +1484,7 @@ trait Infer {
tvars = tpparams map freshVar
tp = pattp.instantiateTypeParams(tpparams, tvars)
- if (settings.debug.value)
- log("free type params (2) = " + ptparams)
+ debuglog("free type params (2) = " + ptparams)
val ptvars = ptparams map freshVar
val pt1 = pt.instantiateTypeParams(ptparams, ptvars)
@@ -1513,7 +1511,7 @@ trait Infer {
def inferModulePattern(pat: Tree, pt: Type) =
if (!(pat.tpe <:< pt)) {
val ptparams = freeTypeParamsOfTerms.collect(pt)
- if (settings.debug.value) log("free type params (2) = " + ptparams)
+ debuglog("free type params (2) = " + ptparams)
val ptvars = ptparams map freshVar
val pt1 = pt.instantiateTypeParams(ptparams, ptvars)
if (pat.tpe <:< pt1)
@@ -1655,8 +1653,7 @@ trait Infer {
case OverloadedType(pre, alts) =>
val pt = if (pt0.typeSymbol == UnitClass) WildcardType else pt0
tryTwice {
- if (settings.debug.value)
- log("infer method alt "+ tree.symbol +" with alternatives "+
+ debuglog("infer method alt "+ tree.symbol +" with alternatives "+
(alts map pre.memberType) +", argtpes = "+ argtpes +", pt = "+ pt)
var allApplicable = alts filter (alt =>
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
index 6bbb94bf29..9562862f0a 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
@@ -83,7 +83,7 @@ trait Namers { self: Analyzer =>
(moduleFlags & ModuleToClassFlags) | FINAL | inConstructorFlag
def updatePosFlags(sym: Symbol, pos: Position, flags: Long): Symbol = {
- if (settings.debug.value) log("overwriting " + sym)
+ debuglog("overwriting " + sym)
val lockedFlag = sym.flags & LOCKED
sym.reset(NoType)
sym setPos pos
@@ -305,7 +305,7 @@ trait Namers { self: Analyzer =>
private def enterSymFinishWith(tree: Tree, tparams: List[TypeDef]) {
val sym = tree.symbol
- if (settings.debug.value) log("entered " + sym + " in " + context.owner + ", scope-id = " + context.scope.## )
+ debuglog("entered " + sym + " in " + context.owner + ", scope-id = " + context.scope.## )
var ltype = namerOf(sym).typeCompleter(tree)
if (tparams nonEmpty) {
//@M! TypeDef's type params are handled differently
@@ -547,7 +547,7 @@ trait Namers { self: Analyzer =>
// --- Lazy Type Assignment --------------------------------------------------
def typeCompleter(tree: Tree) = mkTypeCompleter(tree) { sym =>
- if (settings.debug.value) log("defining " + sym + flagsToString(sym.flags)+sym.locationString)
+ debuglog("defining " + sym + flagsToString(sym.flags)+sym.locationString)
val tp = typeSig(tree)
tp match {
case TypeBounds(lo, hi) =>
@@ -565,7 +565,7 @@ trait Namers { self: Analyzer =>
!typer.checkNonCyclic(tree.pos, tp))
sym.setInfo(ErrorType) // this early test is there to avoid infinite baseTypes when
// adding setters and getters --> bug798
- if (settings.debug.value) log("defined " + sym);
+ debuglog("defined " + sym);
validate(sym)
}
@@ -579,18 +579,18 @@ trait Namers { self: Analyzer =>
}
def getterTypeCompleter(vd: ValDef) = mkTypeCompleter(vd) { sym =>
- if (settings.debug.value) log("defining " + sym)
+ debuglog("defining " + sym)
val tp = typeSig(vd)
sym.setInfo(NullaryMethodType(tp))
- if (settings.debug.value) log("defined " + sym)
+ debuglog("defined " + sym)
validate(sym)
}
def setterTypeCompleter(vd: ValDef) = mkTypeCompleter(vd) { sym =>
- if (settings.debug.value) log("defining " + sym)
+ debuglog("defining " + sym)
val param = sym.newSyntheticValueParam(typeSig(vd))
sym.setInfo(MethodType(List(param), UnitClass.tpe))
- if (settings.debug.value) log("defined " + sym)
+ debuglog("defined " + sym)
validate(sym)
}
diff --git a/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala b/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala
index f178274e3e..914e9c7dbc 100644
--- a/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala
@@ -95,7 +95,7 @@ abstract class SuperAccessors extends transform.Transform with transform.TypingT
val supername = nme.superName(sym.name)
var superAcc = clazz.info.decl(supername).suchThat(_.alias == sym)
if (superAcc == NoSymbol) {
- if (settings.debug.value) log("add super acc " + sym + sym.locationString + " to `" + clazz);//debug
+ debuglog("add super acc " + sym + sym.locationString + " to `" + clazz);//debug
superAcc =
clazz.newMethod(tree.pos, supername)
.setFlag(SUPERACCESSOR | PRIVATE)
@@ -133,8 +133,7 @@ abstract class SuperAccessors extends transform.Transform with transform.TypingT
def mayNeedProtectedAccessor(sel: Select, args: List[Tree], goToSuper: Boolean) =
if (needsProtectedAccessor(sym, tree.pos)) {
- if (settings.debug.value)
- log("Adding protected accessor for " + tree)
+ debuglog("Adding protected accessor for " + tree)
transform(makeAccessor(sel, args))
}
@@ -198,8 +197,7 @@ abstract class SuperAccessors extends transform.Transform with transform.TypingT
Super(qual, tpnme.EMPTY/*qual.symbol.info.parents.head.symbol.name*/) setPos qual.pos,
sym.alias) setPos tree.pos
}
- if (settings.debug.value)
- log("alias replacement: " + tree + " ==> " + result);//debug
+ debuglog("alias replacement: " + tree + " ==> " + result);//debug
localTyper.typed(gen.maybeMkAsInstanceOf(transformSuperSelect(result), sym.tpe, sym.alias.tpe, true))
}
else mayNeedProtectedAccessor(sel, List(EmptyTree), false)
@@ -224,10 +222,9 @@ abstract class SuperAccessors extends transform.Transform with transform.TypingT
if (lhs.symbol.isVariable &&
lhs.symbol.isJavaDefined &&
needsProtectedAccessor(lhs.symbol, tree.pos)) {
- if (settings.debug.value) log("Adding protected setter for " + tree)
+ debuglog("Adding protected setter for " + tree)
val setter = makeSetter(lhs);
- if (settings.debug.value)
- log("Replaced " + tree + " with " + setter);
+ debuglog("Replaced " + tree + " with " + setter);
transform(localTyper.typed(Apply(setter, List(qual, rhs))))
} else
super.transform(tree)
@@ -283,7 +280,7 @@ abstract class SuperAccessors extends transform.Transform with transform.TypingT
assert(clazz != NoSymbol, sym)
- if (settings.debug.value) log("Decided for host class: " + clazz)
+ debuglog("Decided for host class: " + clazz)
val accName = nme.protName(sym.originalName)
val hasArgs = sym.tpe.paramTypes != Nil
@@ -315,8 +312,7 @@ abstract class SuperAccessors extends transform.Transform with transform.TypingT
})
})
- if (settings.debug.value)
- log(code)
+ debuglog("" + code)
accDefBuf(clazz) += typers(clazz).typed(code)
}
var res: Tree = atPos(tree.pos) {
@@ -325,8 +321,7 @@ abstract class SuperAccessors extends transform.Transform with transform.TypingT
else
Apply(TypeApply(Select(This(clazz), protAcc), targs), List(qual))
}
- if (settings.debug.value)
- log("Replaced " + tree + " with " + res)
+ debuglog("Replaced " + tree + " with " + res)
if (hasArgs) localTyper.typedOperator(res) else localTyper.typed(res)
}
@@ -377,8 +372,7 @@ abstract class SuperAccessors extends transform.Transform with transform.TypingT
val field = tree.symbol
val clazz = hostForAccessorOf(field, currentOwner.enclClass)
assert(clazz != NoSymbol, field)
- if (settings.debug.value)
- log("Decided for host class: " + clazz)
+ debuglog("Decided for host class: " + clazz)
val accName = nme.protSetterName(field.originalName)
var protAcc = clazz.info.decl(accName)
if (protAcc == NoSymbol) {
@@ -394,8 +388,7 @@ abstract class SuperAccessors extends transform.Transform with transform.TypingT
Ident(value))
}
})
- if (settings.debug.value)
- log(code);
+ debuglog("" + code)
accDefBuf(clazz) += typers(clazz).typed(code)
}
var res: Tree = atPos(tree.pos) { Select(This(clazz), protAcc) }
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 1988bc887f..185529ed74 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -156,7 +156,7 @@ trait Typers extends Modes {
* whether one type is coercible to another.
*/
def inferView(tree: Tree, from: Type, to: Type, reportAmbiguous: Boolean): Tree = {
- if (settings.debug.value) log("infer view from "+from+" to "+to)//debug
+ debuglog("infer view from "+from+" to "+to)//debug
if (phase.id > currentRun.typerPhase.id) EmptyTree
else from match {
case MethodType(_, _) => EmptyTree
@@ -760,7 +760,7 @@ trait Typers extends Modes {
typer1.silent(tpr => tpr.typed(tpr.applyImplicitArgs(tree), mode, pt)) match {
case result: Tree => result
case ex: TypeError =>
- if (settings.debug.value) log("fallback on implicits: "+tree+"/"+resetAllAttrs(original))
+ debuglog("fallback on implicits: "+tree+"/"+resetAllAttrs(original))
val tree1 = typed(resetAllAttrs(original), mode, WildcardType)
tree1.tpe = addAnnotations(tree1, tree1.tpe)
if (tree1.isEmpty) tree1 else adapt(tree1, mode, pt, EmptyTree)
@@ -777,7 +777,7 @@ trait Typers extends Modes {
case _ => tree.symbol
}
if (!meth.isConstructor && isFunctionType(pt)) { // (4.2)
- if (settings.debug.value) log("eta-expanding "+tree+":"+tree.tpe+" to "+pt)
+ debuglog("eta-expanding "+tree+":"+tree.tpe+" to "+pt)
checkParamsConvertible(tree.pos, tree.tpe)
val tree0 = etaExpand(context.unit, tree)
// println("eta "+tree+" ---> "+tree0+":"+tree0.tpe+" undet: "+context.undetparams+ " mode: "+Integer.toHexString(mode))
@@ -919,18 +919,17 @@ trait Typers extends Modes {
}
if (context.implicitsEnabled && !tree.tpe.isError && !pt.isError) {
// (14); the condition prevents chains of views
- if (settings.debug.value) log("inferring view from "+tree.tpe+" to "+pt)
+ debuglog("inferring view from "+tree.tpe+" to "+pt)
val coercion = inferView(tree, tree.tpe, pt, true)
// convert forward views of delegate types into closures wrapped around
// the delegate's apply method (the "Invoke" method, which was translated into apply)
if (forMSIL && coercion != null && isCorrespondingDelegate(tree.tpe, pt)) {
val meth: Symbol = tree.tpe.member(nme.apply)
- if(settings.debug.value)
- log("replacing forward delegate view with: " + meth + ":" + meth.tpe)
+ debuglog("replacing forward delegate view with: " + meth + ":" + meth.tpe)
return typed(Select(tree, meth), mode, pt)
}
if (coercion != EmptyTree) {
- if (settings.debug.value) log("inferred view from "+tree.tpe+" to "+pt+" = "+coercion+":"+coercion.tpe)
+ debuglog("inferred view from "+tree.tpe+" to "+pt+" = "+coercion+":"+coercion.tpe)
return newTyper(context.makeImplicit(context.reportAmbiguousErrors)).typed(
new ApplyImplicitView(coercion, List(tree)) setPos tree.pos, mode, pt)
}
@@ -1024,7 +1023,7 @@ trait Typers extends Modes {
case result: Tree if result != qual =>
result
case _ =>
- if (settings.debug.value) log("fallback on implicits in adaptToArguments: "+qual+" . "+name)
+ debuglog("fallback on implicits in adaptToArguments: "+qual+" . "+name)
doAdapt(WildcardType)
}
} else
@@ -1583,7 +1582,7 @@ trait Typers extends Modes {
* @param rhs ...
*/
def computeParamAliases(clazz: Symbol, vparamss: List[List[ValDef]], rhs: Tree) {
- if (settings.debug.value) log("computing param aliases for "+clazz+":"+clazz.primaryConstructor.tpe+":"+rhs)//debug
+ debuglog("computing param aliases for "+clazz+":"+clazz.primaryConstructor.tpe+":"+rhs)//debug
def decompose(call: Tree): (Tree, List[Tree]) = call match {
case Apply(fn, args) =>
val (superConstr, args1) = decompose(fn)
@@ -1635,8 +1634,7 @@ trait Typers extends Modes {
if ((ownAcc hasFlag ACCESSOR) && !ownAcc.isDeferred)
ownAcc = ownAcc.accessed
if (!ownAcc.isVariable && !alias.accessed.isVariable) {
- if (settings.debug.value)
- log("" + ownAcc + " has alias "+alias + alias.locationString) //debug
+ debuglog("" + ownAcc + " has alias "+alias + alias.locationString) //debug
ownAcc.asInstanceOf[TermSymbol].setAlias(alias)
}
}
@@ -2497,7 +2495,7 @@ trait Typers extends Modes {
val args1 = (args, formals).zipped map typedArgToPoly
if (args1 exists (_.tpe.isError)) setError(tree)
else {
- if (settings.debug.value) log("infer method inst "+fun+", tparams = "+tparams+", args = "+args1.map(_.tpe)+", pt = "+pt+", lobounds = "+tparams.map(_.tpe.bounds.lo)+", parambounds = "+tparams.map(_.info)) //debug
+ debuglog("infer method inst "+fun+", tparams = "+tparams+", args = "+args1.map(_.tpe)+", pt = "+pt+", lobounds = "+tparams.map(_.tpe.bounds.lo)+", parambounds = "+tparams.map(_.info)) //debug
// define the undetparams which have been fixed by this param list, replace the corresponding symbols in "fun"
// returns those undetparams which have not been instantiated.
val undetparams = inferMethodInstance(fun, tparams, args1, pt)
@@ -3469,7 +3467,7 @@ trait Typers extends Modes {
}
typed1(tree1, mode, pt)
/*
- if (settings.debug.value) log("retry assign: "+tree1)
+ debuglog("retry assign: "+tree1)
silent(_.typed1(tree1, mode, pt)) match {
case t: Tree =>
t
@@ -4245,8 +4243,7 @@ trait Typers extends Modes {
def dropExistential(tp: Type): Type = tp match {
case ExistentialType(tparams, tpe) =>
- if (settings.debug.value)
- log("Dropping existential: " + tree + " " + tp)
+ debuglog("Dropping existential: " + tree + " " + tp)
new SubstWildcardMap(tparams).apply(tp)
case TypeRef(_, sym, _) if sym.isAliasType =>
val tp0 = tp.normalize
diff --git a/src/compiler/scala/tools/nsc/util/FlagsUtil.scala b/src/compiler/scala/tools/nsc/util/FlagsUtil.scala
index 7574859e03..b615775468 100644
--- a/src/compiler/scala/tools/nsc/util/FlagsUtil.scala
+++ b/src/compiler/scala/tools/nsc/util/FlagsUtil.scala
@@ -47,9 +47,6 @@ class TransFlagManager[T <: Global](val global: T) {
private val mask = symtab.Flags.TRANS_FLAG
private val seen = new mutable.HashSet[Symbol]
- private def debug(msg: String) = if (settings.debug.value) log(msg)
- private def trace(msg: String) = if (settings.debug.value && settings.verbose.value) log(msg)
- private def isDebug = settings.debug.value
private def doWeOwnFlag = trackerStack.headOption exists (_ eq this)
private def isOK = trackerStack.isEmpty || (trackerStack.head eq this)