Skip to content
Permalink
Browse files

Debugging output tweaks.

And undeprecated Positional.
  • Loading branch information
paulp committed May 14, 2012
1 parent b3f7bc9 commit e722bb1c70fed83257aa1c1fc9276ae8b7839c60
@@ -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(" ")
@@ -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)
@@ -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")
@@ -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?
@@ -12,7 +12,6 @@ package scala.util.parsing.input
*
* @author Martin Odersky, Adriaan Moors
*/
@deprecated("This class will be removed", "2.10.0")
trait Positional {

/** The source position of this object, initially set to undefined. */
@@ -1,4 +1,4 @@
tailrec-2.scala:8: error: could not optimize @tailrec annotated method f: it contains a recursive call targetting a supertype
tailrec-2.scala:8: error: could not optimize @tailrec annotated method f: it contains a recursive call targeting supertype Super[A]
@annotation.tailrec final def f[B >: A](mem: List[B]): List[B] = (null: Super[A]).f(mem)
^
tailrec-2.scala:9: error: @tailrec annotated method contains no recursive calls

0 comments on commit e722bb1

Please sign in to comment.
You can’t perform that action at this time.