summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/transform/InfoTransform.scala15
-rw-r--r--src/compiler/scala/tools/nsc/transform/UnCurry.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala8
3 files changed, 14 insertions, 11 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/InfoTransform.scala b/src/compiler/scala/tools/nsc/transform/InfoTransform.scala
index fa93a9b534..03076dc6aa 100644
--- a/src/compiler/scala/tools/nsc/transform/InfoTransform.scala
+++ b/src/compiler/scala/tools/nsc/transform/InfoTransform.scala
@@ -6,12 +6,15 @@
package scala.tools.nsc
package transform
-/** <p>
- * A base class for transforms.
- * </p>
- * <p>
- * A transform contains a compiler phase which applies a tree transformer.
- * </p>
+/**
+ * An InfoTransform contains a compiler phase that transforms trees and symbol infos -- making sure they stay consistent.
+ * The symbol info is transformed assuming it is consistent right before this phase.
+ * The info transformation is triggered by Symbol::rawInfo, which caches the results in the symbol's type history.
+ * This way sym.info (during an atPhase(p)) can look up what the symbol's info should look like at the beginning of phase p.
+ * (If the transformed info had not been stored yet, rawInfo will compute the info by composing the info-transformers
+ * of the most recent phase before p, up to the transformer of the phase right before p.)
+ *
+ * Concretely, atPhase(p) { sym.info } yields the info *before* phase p has transformed it. Imagine you're a phase and it all makes sense.
*/
trait InfoTransform extends Transform {
import global.{Symbol, Type, InfoTransformer, infoTransformers}
diff --git a/src/compiler/scala/tools/nsc/transform/UnCurry.scala b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
index 2f56180c8d..1a6a36691d 100644
--- a/src/compiler/scala/tools/nsc/transform/UnCurry.scala
+++ b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
@@ -10,7 +10,7 @@ import symtab.Flags._
import scala.collection.{ mutable, immutable }
/*<export> */
-/** - uncurry all symbol and tree types (@see UnCurryPhase)
+/** - uncurry all symbol and tree types (@see UnCurryPhase) -- this includes normalizing all proper types.
* - for every curried parameter list: (ps_1) ... (ps_n) ==> (ps_1, ..., ps_n)
* - for every curried application: f(args_1)...(args_n) ==> f(args_1, ..., args_n)
* - for every type application: f[Ts] ==> f[Ts]() unless followed by parameters
diff --git a/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala b/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala
index 2042b08d83..4199008754 100644
--- a/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala
@@ -261,12 +261,12 @@ abstract class TreeCheckers extends Analyzer {
if (sym.ownerChain contains currentOwner) ()
else fail(sym + " owner chain does not contain currentOwner " + currentOwner)
case _ =>
- def cond(s: Symbol) = s.isTerm && !s.isMethod && s != sym.owner
+ def cond(s: Symbol) = !s.isTerm || s.isMethod || s == sym.owner
if (sym.owner != currentOwner) {
- val found = currentOwner.ownerChain find (x => !cond(x)) getOrElse fail("DefTree can't find owner: ")
- if (sym.owner != found)
- fail("Expected owner %s, found %s: ".format(found, sym.owner))
+ val expected = currentOwner.ownerChain find (x => cond(x)) getOrElse fail("DefTree can't find owner: ")
+ if (sym.owner != expected)
+ fail("Expected owner %s (out of %s), found %s: ".format(expected, currentOwner.ownerChain, sym.owner))
}
}
}