From b7b210db14a2d59730603cc7cbf41c55275a4520 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Fri, 17 Jan 2014 18:25:53 +0100 Subject: Avoid cycles in Symbol toString under -Ydebug This is the first of two commits to restore workingness to the compiler under `-Ydebug`. `ResetAttrs` is now called during case class unapply synthesis, after the UnTyper was recently banished. But, this class has some low-level tracing that is triggered under `-Ydebug` (irrespective of any `-Ylog` settings.) This tracing code calls `Symbol#toString`, which, in an attempt to discriminate primary from secondary constructors, accesses the info of its owner. This is sufficient to hit a dreaded `CyclicReferenceError`. The enclosed test compiles a case class under this option to show that things now compile. It still spews out unwanted output; this will be removed in the next commit. --- src/reflect/scala/reflect/internal/Symbols.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/reflect/scala/reflect/internal/Symbols.scala b/src/reflect/scala/reflect/internal/Symbols.scala index e15b33e5d7..c2689fe7e9 100644 --- a/src/reflect/scala/reflect/internal/Symbols.scala +++ b/src/reflect/scala/reflect/internal/Symbols.scala @@ -2419,7 +2419,7 @@ trait Symbols extends api.Symbols { self: SymbolTable => else if (isTrait) ("trait", "trait", "TRT") else if (isClass) ("class", "class", "CLS") else if (isType) ("type", "type", "TPE") - else if (isClassConstructor && isPrimaryConstructor) ("primary constructor", "constructor", "PCTOR") + else if (isClassConstructor && (owner.hasCompleteInfo && isPrimaryConstructor)) ("primary constructor", "constructor", "PCTOR") else if (isClassConstructor) ("constructor", "constructor", "CTOR") else if (isSourceMethod) ("method", "method", "METH") else if (isTerm) ("value", "value", "VAL") -- cgit v1.2.3