From 6a37ada63977e5016204ffa3f325c233d0e342c0 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Fri, 6 Jan 2012 20:06:49 -0800 Subject: Output improvements for TypeVar tracing. You should really try this out, anonymous commit log reader. scala -Dscalac.debug.tvar --- src/compiler/scala/reflect/internal/Types.scala | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'src') 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 -- cgit v1.2.3