Skip to content

Commit 5dccc29

Browse files
committed
optimize isSubType by checking nullType first
1 parent f9a56a2 commit 5dccc29

File tree

1 file changed

+1
-1
lines changed
  • compiler/src/dotty/tools/dotc/transform/patmat

1 file changed

+1
-1
lines changed

compiler/src/dotty/tools/dotc/transform/patmat/Space.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {
379379

380380
/** Is `tp1` a subtype of `tp2`? */
381381
def isSubType(tp1: Type, tp2: Type): Boolean = {
382-
val res = tp1 <:< tp2 && (tp1 != nullType || tp2 == nullType)
382+
val res = (tp1 != nullType || tp2 == nullType) && tp1 <:< tp2
383383
debug.println(s"${tp1.show} <:< ${tp2.show} = $res")
384384
res
385385
}

0 commit comments

Comments
 (0)