File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed
compiler/src/dotty/tools/dotc/transform/patmat Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -865,14 +865,13 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {
865
865
}
866
866
867
867
/** Whehter counter-examples should be further checked? True for GADTs. */
868
- def shouldCheckExamples (tp : Type ): Boolean = {
868
+ private def shouldCheckExamples (tp : Type ): Boolean =
869
869
new TypeAccumulator [Boolean ] {
870
870
override def apply (b : Boolean , tp : Type ): Boolean = tp match {
871
871
case tref : TypeRef if tref.symbol.is(TypeParam ) && variance != 1 => true
872
872
case tp => b || foldOver(b, tp)
873
873
}
874
874
}.apply(false , tp)
875
- }
876
875
877
876
def checkExhaustivity (_match : Match ): Unit = {
878
877
val Match (sel, cases) = _match
@@ -904,14 +903,14 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {
904
903
val Match (sel, cases) = _match
905
904
val selTyp = sel.tpe.widen.dealias
906
905
907
- def targetSpace : Space =
906
+ if (! redundancyCheckable(sel)) return
907
+
908
+ val targetSpace =
908
909
if (selTyp.classSymbol.isPrimitiveValueClass)
909
910
Typ (selTyp, true )
910
911
else
911
912
Or (Typ (selTyp, true ) :: Typ (ConstantType (Constant (null ))) :: Nil )
912
913
913
- if (! redundancyCheckable(sel)) return
914
-
915
914
(0 until cases.length).foreach { i =>
916
915
// in redundancy check, take guard as false in order to soundly approximate
917
916
val prevs =
You can’t perform that action at this time.
0 commit comments