aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/core/TypeOps.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-12-02 18:37:28 +0100
committerMartin Odersky <odersky@gmail.com>2016-12-02 18:39:36 +0100
commit306c31214b8f729b810d1f162da20ff8ca6a2848 (patch)
treebdfcd4c55151463e1b2ddae4413d6f8ea69e38b3 /compiler/src/dotty/tools/dotc/core/TypeOps.scala
parent47d208448e614125446c7f294f8231c3fb7108d6 (diff)
downloaddotty-306c31214b8f729b810d1f162da20ff8ca6a2848.tar.gz
dotty-306c31214b8f729b810d1f162da20ff8ca6a2848.tar.bz2
dotty-306c31214b8f729b810d1f162da20ff8ca6a2848.zip
Fix #1751: Make dominator work after erasure
i1751.scala shows a case where we need to compute the approximation of an or-type during erasure. This can lead to an empty set of common classes because Any does not exist anymore after erasure.
Diffstat (limited to 'compiler/src/dotty/tools/dotc/core/TypeOps.scala')
-rw-r--r--compiler/src/dotty/tools/dotc/core/TypeOps.scala3
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/src/dotty/tools/dotc/core/TypeOps.scala b/compiler/src/dotty/tools/dotc/core/TypeOps.scala
index 92e5f9d57..39214dd0c 100644
--- a/compiler/src/dotty/tools/dotc/core/TypeOps.scala
+++ b/compiler/src/dotty/tools/dotc/core/TypeOps.scala
@@ -197,6 +197,9 @@ trait TypeOps { this: Context => // TODO: Make standalone object.
case c :: rest =>
val accu1 = if (accu exists (_ derivesFrom c)) accu else c :: accu
if (cs == c.baseClasses) accu1 else dominators(rest, accu1)
+ case Nil => // this case can happen because after erasure we do not have a top class anymore
+ assert(ctx.erasedTypes)
+ defn.ObjectClass :: Nil
}
def mergeRefined(tp1: Type, tp2: Type): Type = {