File tree 2 files changed +12
-3
lines changed
compiler/src/dotty/tools/dotc/transform/patmat
2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -839,12 +839,14 @@ class SpaceEngine(using Context) extends SpaceLogic {
839
839
}
840
840
841
841
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.
843
843
// Quote patterns produce repeated calls to the same unapply method, but with different implicit parameters.
844
844
// Since we assume that repeated calls to the same unapply method overlap
845
845
// 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 )
848
850
849
851
def checkRedundancy (_match : Match ): Unit = {
850
852
val Match (sel, cases) = _match
Original file line number Diff line number Diff line change
1
+ import scala .quoted ._
2
+
3
+ def summonTypedType [T : Type ](using QuoteContext ): String = ' [T ] match {
4
+ case ' [Boolean ] => " Boolean"
5
+ case ' [Byte ] => " Byte"
6
+ case _ => " Other"
7
+ }
You can’t perform that action at this time.
0 commit comments