summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-01-06 20:06:49 -0800
committerPaul Phillips <paulp@improving.org>2012-01-06 20:28:52 -0800
commit6a37ada63977e5016204ffa3f325c233d0e342c0 (patch)
treee685bb765f10081dfb995c2ad0b37547ff6ca721 /src
parentd6346f7c567894e635d92fe9408d2b340c93b9b4 (diff)
downloadscala-6a37ada63977e5016204ffa3f325c233d0e342c0.tar.gz
scala-6a37ada63977e5016204ffa3f325c233d0e342c0.tar.bz2
scala-6a37ada63977e5016204ffa3f325c233d0e342c0.zip
Output improvements for TypeVar tracing.
You should really try this out, anonymous commit log reader. scala -Dscalac.debug.tvar
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/reflect/internal/Types.scala22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/compiler/scala/reflect/internal/Types.scala b/src/compiler/scala/reflect/internal/Types.scala
index b26c78677d..f5876291ea 100644
--- a/src/compiler/scala/reflect/internal/Types.scala
+++ b/src/compiler/scala/reflect/internal/Types.scala
@@ -2812,18 +2812,20 @@ A type's typeSymbol should never be inspected directly.
}
def originName = {
val name = origin.typeSymbolDirect.decodedName
- if (name startsWith "_$") origin.typeSymbol.decodedName else name
+ if (name contains "_$") origin.typeSymbolDirect.decodedName else name
}
def originLocation = {
- val sym = origin.typeSymbolDirect
- val owner = sym.owner
- val clazz = owner.enclClass
- val ownsString = (
- if (owner.isMethod) "#" + owner.name + tparamsOfSym(owner)
- else if (owner.isAbstractType) "#" + owner.defString
- else ""
- )
- clazz.decodedName + tparamsOfSym(clazz) + ownsString
+ val sym = origin.typeSymbolDirect
+ val encl = sym.owner.logicallyEnclosingMember
+
+ // This should display somewhere between one and three
+ // things which enclose the origin: at most, a class, a
+ // a method, and a term. At least, a class.
+ List(
+ Some(encl.enclClass),
+ if (encl.isMethod) Some(encl) else None,
+ if (sym.owner.isTerm && (sym.owner != encl)) Some(sym.owner) else None
+ ).flatten map (s => s.decodedName + tparamsOfSym(s)) mkString "#"
}
private def levelString = if (settings.explaintypes.value) level else ""
protected def typeVarString = originName