Skip to content

Commit 8275cef

Browse files
committed
Enable short circuiting for CoveredStatus.CombinedWith
1 parent 33c8b60 commit 8275cef

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3014,7 +3014,9 @@ object TypeComparer {
30143014

30153015
object Repr:
30163016
extension (s: Repr)
3017-
inline def combinedWith(that: Repr): Repr = s min that
3017+
def combinedWith(that: => Repr): Repr =
3018+
if s == Uncovered then Uncovered
3019+
else s min that
30183020

30193021
inline def bothHaveOr(s1: Repr, s2: Repr): Boolean = ~((s1 | s2) & NotHasOr) != 0
30203022
inline def bothCovered(s1: Repr, s2: Repr): Boolean = (s1 & s2 & IsCovered) != 0

0 commit comments

Comments
 (0)