summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Suereth <Joshua.Suereth@gmail.com>2012-07-31 07:34:43 -0700
committerJosh Suereth <Joshua.Suereth@gmail.com>2012-07-31 07:34:43 -0700
commitb35894c2c341f69f61a7a0eb6131c6b3d828b1a3 (patch)
tree49e71afd2ef2915c7fabb543d247856c17f8d688
parentf4693871f4aad1fdbdbb743feaed8a848a9e2dca (diff)
parent8d4b4262b0f9b2b59643ad20d30af7f5ad7ef1c7 (diff)
downloadscala-b35894c2c341f69f61a7a0eb6131c6b3d828b1a3.tar.gz
scala-b35894c2c341f69f61a7a0eb6131c6b3d828b1a3.tar.bz2
scala-b35894c2c341f69f61a7a0eb6131c6b3d828b1a3.zip
Merge pull request #1024 from paulp/topic/type-printing
Fixed maddening "..." lately in printed types.
-rw-r--r--src/reflect/scala/reflect/internal/Types.scala10
-rw-r--r--test/files/run/t6028.check20
2 files changed, 18 insertions, 12 deletions
diff --git a/src/reflect/scala/reflect/internal/Types.scala b/src/reflect/scala/reflect/internal/Types.scala
index 3a218c18f1..8972dfa828 100644
--- a/src/reflect/scala/reflect/internal/Types.scala
+++ b/src/reflect/scala/reflect/internal/Types.scala
@@ -2078,7 +2078,8 @@ trait Types extends api.Types { self: SymbolTable =>
override protected def finishPrefix(rest: String) = objectPrefix + rest
override def directObjectString = super.safeToString
override def toLongString = toString
- override def safeToString = narrow.toString
+ override def safeToString = prefixString + "type"
+ override def prefixString = if (sym.isOmittablePrefix) "" else prefix.prefixString + sym.nameString + "."
}
class PackageTypeRef(pre0: Type, sym0: Symbol) extends ModuleTypeRef(pre0, sym0) {
require(sym.isPackageClass, sym)
@@ -6950,8 +6951,13 @@ trait Types extends api.Types { self: SymbolTable =>
private var tostringRecursions = 0
protected def typeToString(tpe: Type): String =
- if (tostringRecursions >= maxTostringRecursions)
+ if (tostringRecursions >= maxTostringRecursions) {
+ debugwarn("Exceeded recursion depth attempting to print type.")
+ if (settings.debug.value)
+ (new Throwable).printStackTrace
+
"..."
+ }
else
try {
tostringRecursions += 1
diff --git a/test/files/run/t6028.check b/test/files/run/t6028.check
index dca61115ad..34f4b22134 100644
--- a/test/files/run/t6028.check
+++ b/test/files/run/t6028.check
@@ -15,16 +15,16 @@ package <empty> {
}
};
def bar(barParam: Int): Object = {
- @volatile var MethodLocalObject$module: scala.runtime.VolatileObjectRef = new scala.runtime.VolatileObjectRef(<empty>);
+ @volatile var MethodLocalObject$module: runtime.VolatileObjectRef = new runtime.VolatileObjectRef(<empty>);
T.this.MethodLocalObject$1(barParam, MethodLocalObject$module)
};
def tryy(tryyParam: Int): Function0 = {
- var tryyLocal: scala.runtime.IntRef = new scala.runtime.IntRef(0);
+ var tryyLocal: runtime.IntRef = new runtime.IntRef(0);
{
(new anonymous class $anonfun$tryy$1(T.this, tryyParam, tryyLocal): Function0)
}
};
- @SerialVersionUID(0) final <synthetic> class $anonfun$foo$1 extends scala.runtime.AbstractFunction0$mcI$sp with Serializable {
+ @SerialVersionUID(0) final <synthetic> class $anonfun$foo$1 extends runtime.AbstractFunction0$mcI$sp with Serializable {
def <init>($outer: T, methodParam$1: Int, methodLocal$1: Int): anonymous class $anonfun$foo$1 = {
$anonfun$foo$1.super.<init>();
()
@@ -41,7 +41,7 @@ package <empty> {
<synthetic> <stable> def T$MethodLocalTrait$$$outer(): T
};
object MethodLocalObject$2 extends Object with T#MethodLocalTrait$1 {
- def <init>($outer: T, barParam$1: Int): ... = {
+ def <init>($outer: T, barParam$1: Int): T#MethodLocalObject$2.type = {
MethodLocalObject$2.super.<init>();
MethodLocalObject$2.this.$asInstanceOf[T#MethodLocalTrait$1$class]()./*MethodLocalTrait$1$class*/$init$(barParam$1);
()
@@ -50,9 +50,9 @@ package <empty> {
<synthetic> <stable> def T$MethodLocalObject$$$outer(): T = MethodLocalObject$2.this.$outer;
<synthetic> <stable> def T$MethodLocalTrait$$$outer(): T = MethodLocalObject$2.this.$outer
};
- final <stable> private[this] def MethodLocalObject$1(barParam$1: Int, MethodLocalObject$module$1: scala.runtime.VolatileObjectRef): ... = {
- MethodLocalObject$module$1.elem = new ...(T.this, barParam$1);
- MethodLocalObject$module$1.elem.$asInstanceOf[...]()
+ final <stable> private[this] def MethodLocalObject$1(barParam$1: Int, MethodLocalObject$module$1: runtime.VolatileObjectRef): T#MethodLocalObject$2.type = {
+ MethodLocalObject$module$1.elem = new T#MethodLocalObject$2.type(T.this, barParam$1);
+ MethodLocalObject$module$1.elem.$asInstanceOf[T#MethodLocalObject$2.type]()
};
abstract trait MethodLocalTrait$1$class extends Object with T#MethodLocalTrait$1 {
def /*MethodLocalTrait$1$class*/$init$(barParam$1: Int): Unit = {
@@ -60,8 +60,8 @@ package <empty> {
};
scala.this.Predef.print(scala.Int.box(barParam$1))
};
- @SerialVersionUID(0) final <synthetic> class $anonfun$tryy$1 extends scala.runtime.AbstractFunction0$mcV$sp with Serializable {
- def <init>($outer: T, tryyParam$1: Int, tryyLocal$1: scala.runtime.IntRef): anonymous class $anonfun$tryy$1 = {
+ @SerialVersionUID(0) final <synthetic> class $anonfun$tryy$1 extends runtime.AbstractFunction0$mcV$sp with Serializable {
+ def <init>($outer: T, tryyParam$1: Int, tryyLocal$1: runtime.IntRef): anonymous class $anonfun$tryy$1 = {
$anonfun$tryy$1.super.<init>();
()
};
@@ -76,7 +76,7 @@ package <empty> {
scala.runtime.BoxedUnit.UNIT
};
<synthetic> <paramaccessor> private[this] val tryyParam$1: Int = _;
- <synthetic> <paramaccessor> private[this] val tryyLocal$1: scala.runtime.IntRef = _
+ <synthetic> <paramaccessor> private[this] val tryyLocal$1: runtime.IntRef = _
}
}
}