Skip to content

Commit dbf7f02

Browse files
committed
Fix #9489: skip redundancy check for Type[T]
1 parent 8eea8d8 commit dbf7f02

File tree

1 file changed

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

1 file changed

+5
-3
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -839,12 +839,14 @@ class SpaceEngine(using Context) extends SpaceLogic {
839839
}
840840

841841
private def redundancyCheckable(sel: Tree): Boolean =
842-
// Ignore Expr for unreachability as a special case.
842+
// Ignore Expr[T] and Type[T] for unreachability as a special case.
843843
// Quote patterns produce repeated calls to the same unapply method, but with different implicit parameters.
844844
// Since we assume that repeated calls to the same unapply method overlap
845845
// and implicit parameters cannot normally differ between two patterns in one `match`,
846-
// the easiest solution is just to ignore Expr.
847-
!sel.tpe.hasAnnotation(defn.UncheckedAnnot) && !sel.tpe.widen.isRef(defn.QuotedExprClass)
846+
// the easiest solution is just to ignore Expr[T] and Type[T].
847+
!sel.tpe.hasAnnotation(defn.UncheckedAnnot)
848+
&& !sel.tpe.widen.isRef(defn.QuotedExprClass)
849+
&& !sel.tpe.widen.isRef(defn.QuotedTypeClass)
848850

849851
def checkRedundancy(_match: Match): Unit = {
850852
val Match(sel, cases) = _match

0 commit comments

Comments
 (0)