aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/TypeOps.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/dotty/tools/dotc/core/TypeOps.scala')
-rw-r--r--src/dotty/tools/dotc/core/TypeOps.scala4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/core/TypeOps.scala b/src/dotty/tools/dotc/core/TypeOps.scala
index 42dd34f18..efededd7a 100644
--- a/src/dotty/tools/dotc/core/TypeOps.scala
+++ b/src/dotty/tools/dotc/core/TypeOps.scala
@@ -90,6 +90,8 @@ trait TypeOps { this: Context =>
final def glb(tp1: Type, tp2: Type): Type =
if (tp1 eq tp2) tp1
+ else if (!tp1.exists) tp2
+ else if (!tp2.exists) tp1
else tp2 match { // normalize to disjunctive normal form if possible.
case OrType(tp21, tp22) =>
tp1 & tp21 | tp1 & tp22
@@ -113,6 +115,8 @@ trait TypeOps { this: Context =>
def lub(tp1: Type, tp2: Type): Type =
if (tp1 eq tp2) tp1
+ else if (!tp1.exists) tp1
+ else if (!tp2.exists) tp2
else {
val t1 = mergeIfSuper(tp1, tp2)
if (t1.exists) t1