Skip to content

Commit d50b984

Browse files
committed
Add comment suggested by @AleksanderBG
1 parent 1c42eb3 commit d50b984

File tree

1 file changed

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

1 file changed

+5
-0
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,11 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {
718718
}
719719

720720
private def redundancyCheckable(sel: Tree): Boolean =
721+
// Ignore Expr for unreachability as a special case.
722+
// Quote patterns produce repeated calls to the same unapply method, but with different implicit parameters.
723+
// Since we assume that repeated calls to the same unapply method overlap
724+
// and implicit parameters cannot normally differ between two patterns in one `match`,
725+
// the easiest solution is just to ignore Expr.
721726
!sel.tpe.hasAnnotation(defn.UncheckedAnnot) && !sel.tpe.widen.isRef(defn.QuotedExprClass)
722727

723728
def checkRedundancy(_match: Match): Unit = {

0 commit comments

Comments
 (0)