Skip to content

Commit fdef860

Browse files
committed
simplify checkable
1 parent 79e9434 commit fdef860

File tree

1 file changed

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

1 file changed

+5
-7
lines changed

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -733,12 +733,10 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {
733733
}
734734

735735
def checkable(tree: Match): Boolean = {
736-
def isCheckable(tp: Type): Boolean = tp match {
737-
case AnnotatedType(tp, annot) =>
738-
(ctx.definitions.UncheckedAnnot != annot.symbol) && isCheckable(tp)
739-
case _ =>
740-
// Possible to check everything, but be compatible with scalac by default
741-
ctx.settings.YcheckAllPatmat.value ||
736+
// Possible to check everything, but be compatible with scalac by default
737+
def isCheckable(tp: Type): Boolean =
738+
!tp.hasAnnotation(defn.UncheckedAnnot) && (
739+
ctx.settings.YcheckAllPatmat.value ||
742740
tp.typeSymbol.is(Sealed) ||
743741
tp.isInstanceOf[OrType] ||
744742
(tp.isInstanceOf[AndType] && {
@@ -749,7 +747,7 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {
749747
tp.typeSymbol.is(Enum) ||
750748
canDecompose(tp) ||
751749
(defn.isTupleType(tp) && tp.dealias.argInfos.exists(isCheckable(_)))
752-
}
750+
)
753751

754752
val Match(sel, cases) = tree
755753
val res = isCheckable(sel.tpe.widen.dealiasKeepAnnots)

0 commit comments

Comments
 (0)