Permalink
Browse files

Add more logging.

  • Loading branch information...
axel22 committed May 15, 2012
1 parent aa555de commit c7699ebe45820a34de2e9f5c9bfba3dea6b56bd3
@@ -1550,7 +1550,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers {
val meth = addBody(tree, source)
val d = new Duplicator
debuglog("-->d DUPLICATING: " + meth)
log("-->d DUPLICATING: " + meth)
d.retyped(
localTyper.context1.asInstanceOf[d.Context],
meth,
@@ -144,7 +144,7 @@ abstract class Duplicators extends Analyzer {
sym
private def invalidate(tree: Tree) {
debuglog("attempting to invalidate " + tree.symbol + ", owner - " + (if (tree.symbol ne null) tree.symbol.owner else "<NULL>"))
log("attempting to invalidate " + tree.symbol + ", owner - " + (if (tree.symbol ne null) tree.symbol.owner else "<NULL>"))
if (tree.isDef && tree.symbol != NoSymbol) {
debuglog("invalid " + tree.symbol)
invalidSyms(tree.symbol) = tree
@@ -160,12 +160,12 @@ abstract class Duplicators extends Analyzer {
debuglog("newsym: " + newsym + " info: " + newsym.info)
case vdef @ ValDef(mods, name, _, rhs) if mods.hasFlag(Flags.LAZY) =>
debuglog("ValDef " + name + " sym.info: " + vdef.symbol.info)
log("ValDef " + name + " sym.info: " + vdef.symbol.info + ", owner: " + vdef.symbol.owner + " vs. context owner: " + context.owner)
invalidSyms(vdef.symbol) = vdef
val newsym = vdef.symbol.cloneSymbol(context.owner)
newsym.setInfo(fixType(vdef.symbol.info))
vdef.symbol = newsym
debuglog("newsym: " + newsym + " info: " + newsym.info)
log("newsym: " + newsym + " info: " + newsym.info + ", " + newsym.owner + ", whereas symbol.owner is: " + vdef.symbol.owner)
case DefDef(_, name, tparams, vparamss, _, rhs) =>
// invalidate parameters
@@ -245,7 +245,7 @@ abstract class Duplicators extends Analyzer {
super.typed(tree, mode, pt)
case ClassDef(_, _, _, tmpl @ Template(parents, _, stats)) =>
// log("invalidating classdef " + tree.tpe)
log("invalidating classdef " + tree.tpe)
tmpl.symbol = tree.symbol.newLocalDummy(tree.pos)
invalidate(stats)
tree.tpe = null
@@ -257,6 +257,7 @@ abstract class Duplicators extends Analyzer {
super.typed(ddef, mode, pt)
case vdef @ ValDef(mods, name, tpt, rhs) =>
log("vdef: " + vdef)
// log("vdef fixing tpe: " + tree.tpe + " with sym: " + tree.tpe.typeSymbol + " and " + invalidSyms)
//if (mods.hasFlag(Flags.LAZY)) vdef.symbol.resetFlag(Flags.MUTABLE) // Martin to Iulian: lazy vars can now appear because they are no longer boxed; Please check that deleting this statement is OK.
vdef.tpt.tpe = fixType(vdef.tpt.tpe)
@@ -358,11 +359,15 @@ abstract class Duplicators extends Analyzer {
tree
case _ =>
debuglog("Duplicators default case: " + tree.summaryString)
log("Duplicators default case: " + tree.summaryString)
if (tree.hasSymbol && tree.symbol != NoSymbol && (tree.symbol.owner == definitions.AnyClass)) {
tree.symbol = NoSymbol // maybe we can find a more specific member in a subclass of Any (see AnyVal members, like ==)
}
tree.tpe = null
tree match {
case Select(q, n) => log("Select: " + q + ", " + n + " = " + q.tpe.member(n) + ", members: " + q.tpe.members)
case _ => log(tree.getClass)
}
super.typed(tree, mode, pt)
}
}
@@ -3657,6 +3657,10 @@ trait Typers extends Modes with Adaptations with Taggings {
def typed1(tree: Tree, mode: Int, pt: Type): Tree = {
def isPatternMode = inPatternMode(mode)
tree match {
case This(_) => log("typed1: " + tree + ", " + tree.tpe)
case _ =>
}
//Console.println("typed1("+tree.getClass()+","+Integer.toHexString(mode)+","+pt+")")
//@M! get the type of the qualifier in a Select tree, otherwise: NoType
@@ -4235,6 +4239,7 @@ trait Typers extends Modes with Adaptations with Taggings {
def typedThis(qual: Name) = tree.symbol orElse qualifyingClass(tree, qual, packageOK = false) match {
case NoSymbol => tree
case clazz =>
log("typedThis: " + qual + ", " + clazz.thisType.underlying)
tree setSymbol clazz setType clazz.thisType.underlying
if (isStableContext(tree, mode, pt)) tree setType clazz.thisType else tree
}
@@ -4247,6 +4252,7 @@ trait Typers extends Modes with Adaptations with Taggings {
* @return ...
*/
def typedSelect(qual: Tree, name: Name): Tree = {
log("typedSelect: " + qual + ", name: " + name + ", member: " + (qual.tpe.members))
def asDynamicCall = dyna.mkInvoke(context.tree, tree, qual, name) map (typed1(_, mode, pt))
val sym = tree.symbol orElse member(qual, name) orElse {
@@ -4870,9 +4876,12 @@ trait Typers extends Modes with Adaptations with Taggings {
case Select(qual, name) =>
incCounter(typedSelectCount)
var qual1 = checkDead(typedQualifier(qual, mode))
val tpq = typedQualifier(qual, mode)
if (qual.tpe ne null) log("Select: " + qual + ", " + name + " = " + qual.tpe.member(name) + ", members: " + qual.tpe.members)
var qual1 = checkDead(tpq)
if (name.isTypeName) qual1 = checkStable(qual1)
log("members: " + qual.tpe.members)
val tree1 = // temporarily use `filter` and an alternative for `withFilter`
if (name == nme.withFilter)
silent(_ => typedSelect(qual1, name)) match {
View
@@ -0,0 +1,39 @@
/*
trait Bug1[@specialized(Boolean) A] extends TraversableOnce[A] {
def ++[B >: A](that: TraversableOnce[B]): Iterator[B] = new Iterator[B] {
lazy val it = that.toIterator
def hasNext = it.hasNext
def next = it.next
}
}
*/
/*
trait WorksFine[@specialized(Boolean) A] {
class SubBounds[B >: A] extends Bounds[B] {
lazy val it = ???
it
}
def x[B >: A]: Unit = new SubBounds[B]
}
*/
trait Bounds[@specialized(Boolean) A] {
// okay without `>: A`
def x[B >: A]: Unit = new Bounds[B] {
lazy val it = ??? // def or val okay
it
}
}

0 comments on commit c7699eb

Please sign in to comment.