Skip to content

Commit 40bd71c

Browse files
committed
Fail fast if LHS of subtype is Nothing
This is purely an optimization. It would have fixed by itself the subtype loop in the first part of i3627.scala but not the one in the second part.
1 parent 62dd634 commit 40bd71c

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

compiler/src/dotty/tools/dotc/core/TypeComparer.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
288288
if (isSubType(info1.alias, tp2)) return true
289289
if (tp1.prefix.isStable) return false
290290
case _ =>
291+
if (tp1 eq NothingType) return tp1 == tp2.bottomType
291292
}
292293
thirdTry(tp1, tp2)
293294
case tp1: TypeParamRef =>

0 commit comments

Comments
 (0)