aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Types.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-09-17 15:00:18 +0200
committerMartin Odersky <odersky@gmail.com>2013-09-17 15:00:18 +0200
commit7dc50cbfdae17633aba97f1b96014f8be3b1a005 (patch)
treeaab2c00f8e672fb9d11b39dfb9db70a2ce2f77bd /src/dotty/tools/dotc/core/Types.scala
parentc091b80ba931e9f054963edf826f51341ca04036 (diff)
downloaddotty-7dc50cbfdae17633aba97f1b96014f8be3b1a005.tar.gz
dotty-7dc50cbfdae17633aba97f1b96014f8be3b1a005.tar.bz2
dotty-7dc50cbfdae17633aba97f1b96014f8be3b1a005.zip
Made lub/glb fail early when trying to mix a class info with another type type.
The previous alternative of creating a TypeBounds with the TypeRef back to the class leads to infinite loops when chasing type proxies. Example was infinite loop in baseClasses in showClass test.
Diffstat (limited to 'src/dotty/tools/dotc/core/Types.scala')
-rw-r--r--src/dotty/tools/dotc/core/Types.scala9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala
index 36a4986b4..0370d0a1f 100644
--- a/src/dotty/tools/dotc/core/Types.scala
+++ b/src/dotty/tools/dotc/core/Types.scala
@@ -2288,6 +2288,15 @@ object Types {
class CyclicReference(val denot: SymDenotation)
extends FatalTypeError(s"cyclic reference involving $denot")
+ class ClassMergeError(cinfo: ClassInfo, tp2: Type)(implicit ctx: Context)
+ extends FatalTypeError(s"cannot merge ${showTypeType(cinfo)} with ${showTypeType(tp2)} as members of ${cinfo.prefix.show}")
+
+ private def showTypeType(tp: Type)(implicit ctx: Context) = tp match {
+ case ClassInfo(_, cls, _, _, _) => cls.showLocated
+ case bounds: TypeBounds => "type bounds" + bounds.show
+ case _ => tp.show
+ }
+
// ----- Debug ---------------------------------------------------------
var debugTrace = false