summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2010-07-02 04:20:28 +0000
committerPaul Phillips <paulp@improving.org>2010-07-02 04:20:28 +0000
commit58adc8d999687d1cfa6394d7f4201dfaf411ccfe (patch)
tree2cf655283d5c10f75f208e1a37854b3548faf879 /src/compiler
parent38912509aff9ae84d0129b7fbdfcee19222090d0 (diff)
downloadscala-58adc8d999687d1cfa6394d7f4201dfaf411ccfe.tar.gz
scala-58adc8d999687d1cfa6394d7f4201dfaf411ccfe.tar.bz2
scala-58adc8d999687d1cfa6394d7f4201dfaf411ccfe.zip
Normalized protected type aliases before repl p...
Normalized protected type aliases before repl printing, so we don't see things like x.Self. Closes #3193, no review.
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/Interpreter.scala17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/Interpreter.scala b/src/compiler/scala/tools/nsc/Interpreter.scala
index 128c378e23..78eadb05d8 100644
--- a/src/compiler/scala/tools/nsc/Interpreter.scala
+++ b/src/compiler/scala/tools/nsc/Interpreter.scala
@@ -146,7 +146,7 @@ class Interpreter(val settings: Settings, out: PrintWriter) {
else null
}
- import compiler.{ Traverser, CompilationUnit, Symbol, Name, Type }
+ import compiler.{ Traverser, CompilationUnit, Symbol, Name, Type, TypeRef, PolyType }
import compiler.{
Tree, TermTree, ValOrDefDef, ValDef, DefDef, Assign, ClassDef,
ModuleDef, Ident, Select, TypeDef, Import, MemberDef, DocDef,
@@ -946,14 +946,19 @@ class Interpreter(val settings: Settings, out: PrintWriter) {
lazy val typeOf: Map[Name, String] = {
def getTypes(names: List[Name], nameMap: Name => Name): Map[Name, String] = {
names.foldLeft(Map.empty[Name, String]) { (map, name) =>
- val rawType = atNextPhase(resObjSym.info.member(name).tpe)
+ val tp1 = atNextPhase(resObjSym.info.member(name).tpe)
// the types are all =>T; remove the =>
- val cleanedType = rawType match {
- case compiler.PolyType(Nil, rt) => rt
- case rawType => rawType
+ val tp2 = tp1 match {
+ case PolyType(Nil, tp) => tp
+ case tp => tp
}
+ // normalize non-public types so we don't see protected aliases like Self
+ val tp3 = compiler.atPhase(objRun.typerPhase)(tp2 match {
+ case TypeRef(_, sym, _) if !sym.isPublic => tp2.normalize.toString
+ case tp => tp.toString
+ })
- map + (name -> atNextPhase(cleanedType.toString))
+ map + (name -> tp3)
}
}