summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-05-14 14:01:34 -0700
committerPaul Phillips <paulp@improving.org>2012-05-14 14:03:12 -0700
commite722bb1c70fed83257aa1c1fc9276ae8b7839c60 (patch)
treeee14de8d0ca96f517aa81d4910a042419d1ac53a /src/compiler
parentb3f7bc996b7a59b951cd0f199a056b6ad99d153b (diff)
downloadscala-e722bb1c70fed83257aa1c1fc9276ae8b7839c60.tar.gz
scala-e722bb1c70fed83257aa1c1fc9276ae8b7839c60.tar.bz2
scala-e722bb1c70fed83257aa1c1fc9276ae8b7839c60.zip
Debugging output tweaks.
And undeprecated Positional.
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/Global.scala2
-rw-r--r--src/compiler/scala/tools/nsc/transform/LambdaLift.scala49
-rw-r--r--src/compiler/scala/tools/nsc/transform/TailCalls.scala7
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Namers.scala2
4 files changed, 35 insertions, 25 deletions
diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala
index 49a644ba3a..bdc5384078 100644
--- a/src/compiler/scala/tools/nsc/Global.scala
+++ b/src/compiler/scala/tools/nsc/Global.scala
@@ -998,7 +998,7 @@ class Global(var currentSettings: Settings, var reporter: Reporter) extends Symb
val info1 = formatExplain(
"while compiling" -> currentSource.path,
- "during phase" -> phase,
+ "during phase" -> ( if (globalPhase eq phase) phase else "global=%s, atPhase=%s".format(globalPhase, phase) ),
"library version" -> scala.util.Properties.versionString,
"compiler version" -> Properties.versionString,
"reconstructed args" -> settings.recreateArgs.mkString(" ")
diff --git a/src/compiler/scala/tools/nsc/transform/LambdaLift.scala b/src/compiler/scala/tools/nsc/transform/LambdaLift.scala
index 618a1cbba4..718e58b855 100644
--- a/src/compiler/scala/tools/nsc/transform/LambdaLift.scala
+++ b/src/compiler/scala/tools/nsc/transform/LambdaLift.scala
@@ -108,28 +108,30 @@ abstract class LambdaLift extends InfoTransform {
* }
*/
private def markFree(sym: Symbol, enclosure: Symbol): Boolean = {
- 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 {
- val ss = symSet(free, enclosure)
- if (!ss(sym)) {
- ss addEntry sym
- renamable addEntry sym
- beforePickler {
- // The param symbol in the MethodType should not be renamed, only the symbol in scope. This way,
- // parameter names for named arguments are not changed. Example: without cloning the MethodType,
- // def closure(x: Int) = { () => x }
- // would have the signature
- // closure: (x$1: Int)() => Int
- if (sym.isParameter && sym.owner.info.paramss.exists(_ contains sym))
- sym.owner modifyInfo (_ cloneInfo sym.owner)
+ debuglog("mark free: " + sym.fullLocationString + " marked free in " + enclosure)
+ (enclosure == sym.owner.logicallyEnclosingMember) || {
+ debuglog("%s != %s".format(enclosure, sym.owner.logicallyEnclosingMember))
+ if (enclosure.isPackageClass || !markFree(sym, enclosure.skipConstructor.owner.logicallyEnclosingMember)) false
+ else {
+ val ss = symSet(free, enclosure)
+ if (!ss(sym)) {
+ ss addEntry sym
+ renamable addEntry sym
+ beforePickler {
+ // The param symbol in the MethodType should not be renamed, only the symbol in scope. This way,
+ // parameter names for named arguments are not changed. Example: without cloning the MethodType,
+ // def closure(x: Int) = { () => x }
+ // would have the signature
+ // closure: (x$1: Int)() => Int
+ if (sym.isParameter && sym.owner.info.paramss.exists(_ contains sym))
+ sym.owner modifyInfo (_ cloneInfo sym.owner)
+ }
+ changedFreeVars = true
+ debuglog("" + sym + " is free in " + enclosure);
+ if (sym.isVariable) sym setFlag CAPTURED
}
- changedFreeVars = true
- debuglog("" + sym + " is free in " + enclosure);
- if (sym.isVariable) sym setFlag CAPTURED
+ !enclosure.isClass
}
- !enclosure.isClass
}
}
@@ -273,8 +275,11 @@ abstract class LambdaLift extends InfoTransform {
if (ps.isEmpty) searchIn(enclosure.skipConstructor.owner)
else ps.head
}
- debuglog("proxy " + sym + " in " + sym.owner + " from " + currentOwner.ownerChain.mkString(" -> ") +
- " " + sym.owner.logicallyEnclosingMember)
+ debuglog("proxy %s from %s has logical enclosure %s".format(
+ sym.debugLocationString,
+ currentOwner.debugLocationString,
+ sym.owner.logicallyEnclosingMember.debugLocationString)
+ )
if (isSameOwnerEnclosure(sym)) sym
else searchIn(currentOwner)
diff --git a/src/compiler/scala/tools/nsc/transform/TailCalls.scala b/src/compiler/scala/tools/nsc/transform/TailCalls.scala
index 9915f7e9fc..4c9d855413 100644
--- a/src/compiler/scala/tools/nsc/transform/TailCalls.scala
+++ b/src/compiler/scala/tools/nsc/transform/TailCalls.scala
@@ -154,7 +154,10 @@ abstract class TailCalls extends Transform {
def isTransformed = isEligible && accessed(label)
def tailrecFailure() = unit.error(failPos, "could not optimize @tailrec annotated " + method + ": " + failReason)
- def newThis(pos: Position) = method.newValue(nme.THIS, pos, SYNTHETIC) setInfo currentClass.typeOfThis
+ def newThis(pos: Position) = logResult("Creating new `this` during tailcalls\n method: %s\n current class: %s".format(
+ method.ownerChain.mkString(" -> "), currentClass.ownerChain.mkString(" -> "))) {
+ method.newValue(nme.THIS, pos, SYNTHETIC) setInfo currentClass.typeOfThis
+ }
override def toString(): String = (
"" + method.name + " tparams: " + tparams + " tailPos: " + tailPos +
@@ -222,7 +225,7 @@ abstract class TailCalls extends Transform {
if (!ctx.isEligible) fail("it is neither private nor final so can be overridden")
else if (!isRecursiveCall) {
- if (receiverIsSuper) failHere("it contains a recursive call targetting a supertype")
+ if (receiverIsSuper) failHere("it contains a recursive call targeting supertype " + receiver.tpe)
else failHere(defaultReason)
}
else if (!matchesTypeArgs) failHere("it is called recursively with different type arguments")
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
index e4b744dffc..7118436413 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
@@ -1423,6 +1423,8 @@ trait Namers extends MethodSynthesis {
fail(LazyAndEarlyInit)
if (sym.info.typeSymbol == FunctionClass(0) && sym.isValueParameter && sym.owner.isCaseClass)
fail(ByNameParameter)
+ if (sym.isTrait && sym.isFinal)
+ checkNoConflict(ABSTRACT, FINAL)
if (sym.isDeferred) {
// Is this symbol type always allowed the deferred flag?