diff options
-rw-r--r-- | src/reflect/scala/reflect/internal/tpe/TypeToStrings.scala | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/reflect/scala/reflect/internal/tpe/TypeToStrings.scala b/src/reflect/scala/reflect/internal/tpe/TypeToStrings.scala index ceb667365e..a062fc8209 100644 --- a/src/reflect/scala/reflect/internal/tpe/TypeToStrings.scala +++ b/src/reflect/scala/reflect/internal/tpe/TypeToStrings.scala @@ -20,11 +20,12 @@ private[internal] trait TypeToStrings { def toStringSubjects = _toStringSubjects protected def typeToString(tpe: Type): String = - if (toStringSubjects contains tpe) { - // handles self-referential anonymous classes and who knows what else - "..." - } - else if (toStringRecursions >= maxToStringRecursions) { + // if (toStringSubjects contains tpe) { + // // handles self-referential anonymous classes and who knows what else + // "..." + // } + // else + if (toStringRecursions >= maxToStringRecursions) { devWarning("Exceeded recursion depth attempting to print " + util.shortClassOfInstance(tpe)) if (settings.debug) (new Throwable).printStackTrace @@ -34,10 +35,14 @@ private[internal] trait TypeToStrings { else try { toStringRecursions += 1 - toStringSubjects += tpe + // TODO: study performance impact of this cache + // to quote Jason: + // I'm a little uneasy with the performance impact of the fail-safe. We end up calling Type#toString + // when we generate error messages, including, importantly, errors issued during silent mode that are never issued. + // toStringSubjects += tpe tpe.safeToString } finally { - toStringSubjects -= tpe + // toStringSubjects -= tpe toStringRecursions -= 1 } } |