@@ -882,7 +882,7 @@ object SpaceEngine {
882882 case _ => tp
883883 })
884884
885- def checkExhaustivity (m : Match )(using Context ): Unit = if exhaustivityCheckable(m.selector) then trace(i " checkExhaustivity( $m) " , debug) {
885+ def checkExhaustivity (m : Match )(using Context ): Unit = trace(i " checkExhaustivity( $m) " , debug) {
886886 val selTyp = toUnderlying(m.selector.tpe).dealias
887887 debug.println(i " selTyp = $selTyp" )
888888
@@ -905,7 +905,7 @@ object SpaceEngine {
905905 report.warning(PatternMatchExhaustivity (showSpaces(deduped), m), m.selector)
906906 }
907907
908- private def redundancyCheckable (sel : Tree )(using Context ): Boolean =
908+ private def reachabilityCheckable (sel : Tree )(using Context ): Boolean =
909909 // Ignore Expr[T] and Type[T] for unreachability as a special case.
910910 // Quote patterns produce repeated calls to the same unapply method, but with different implicit parameters.
911911 // Since we assume that repeated calls to the same unapply method overlap
@@ -915,7 +915,7 @@ object SpaceEngine {
915915 && ! sel.tpe.widen.isRef(defn.QuotedExprClass )
916916 && ! sel.tpe.widen.isRef(defn.QuotedTypeClass )
917917
918- def checkRedundancy (m : Match )(using Context ): Unit = if redundancyCheckable(m.selector) then trace(i " checkRedundancy ( $m) " , debug) {
918+ def checkReachability (m : Match )(using Context ): Unit = trace(i " checkReachability ( $m) " , debug) {
919919 val cases = m.cases.toIndexedSeq
920920
921921 val selTyp = toUnderlying(m.selector.tpe).dealias
@@ -967,4 +967,8 @@ object SpaceEngine {
967967 i += 1
968968 }
969969 }
970+
971+ def checkMatch (m : Match )(using Context ): Unit =
972+ if exhaustivityCheckable(m.selector) then checkExhaustivity(m)
973+ if reachabilityCheckable(m.selector) then checkReachability(m)
970974}
0 commit comments