Skip to content

Commit 2cdd778

Browse files
committed
revert: Only leave added tests
1 parent 68728f4 commit 2cdd778

File tree

4 files changed

+6
-12
lines changed

4 files changed

+6
-12
lines changed

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ object SpaceEngine {
113113
def isSubspace(a: Space, b: Space)(using Context): Boolean = a.isSubspace(b)
114114
def canDecompose(typ: Typ)(using Context): Boolean = typ.canDecompose
115115
def decompose(typ: Typ)(using Context): List[Typ] = typ.decompose
116-
def nullSpace(using Context): Space = Typ(ConstantType(Constant(null)), decomposed = false)
117116

118117
/** Simplify space such that a space equal to `Empty` becomes `Empty` */
119118
def computeSimplify(space: Space)(using Context): Space = trace(i"simplify($space)")(space match {
@@ -904,11 +903,6 @@ object SpaceEngine {
904903
then project(OrType(selTyp, ConstantType(Constant(null)), soft = false))
905904
else project(selTyp)
906905
)
907-
def projectPat(pat: Tree): Space =
908-
// Project toplevel wildcard pattern to nullable
909-
if isNullable && isWildcardArg(pat) then Or(project(pat) :: nullSpace :: Nil)
910-
else project(pat)
911-
912906
var i = 0
913907
val len = cases.length
914908
var prevs = List.empty[Space]
@@ -917,7 +911,7 @@ object SpaceEngine {
917911
while (i < len) {
918912
val CaseDef(pat, guard, _) = cases(i)
919913

920-
val curr = trace(i"project($pat)")(projectPat(pat))
914+
val curr = trace(i"project($pat)")(project(pat))
921915

922916
val covered = trace("covered")(simplify(intersect(curr, targetSpace)))
923917

tests/patmat/null.check

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
6: Pattern Match
22
13: Pattern Match
3-
20: Pattern Match
4-
21: Match case Unreachable
3+
20: Match case Unreachable
4+
21: Pattern Match

tests/warn/i15503d.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ val a = Sum(S(S(Z)),Z) match {
1616
case Sum(a@S(b@S(_)), Z) => a // warn
1717
case Sum(a@S(b@(S(_))), Z) => Sum(a,b) // warn unreachable
1818
case Sum(_,_) => Z // OK
19-
case _ => Z
19+
case _ => Z // warn unreachable
2020
}
2121

2222
// todo : This should pass in the future

tests/warn/t2755.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ object Test {
1919
case x: Array[String] => x.size
2020
case x: Array[AnyRef] => 5
2121
case x: Array[?] => 6
22-
case _ => 7
22+
case _ => 7 // warn: only null is matched
2323
}
2424
def f3[T](a: Array[T]) = a match {
2525
case x: Array[Int] => x(0)
@@ -28,7 +28,7 @@ object Test {
2828
case x: Array[String] => x.size
2929
case x: Array[AnyRef] => 5
3030
case x: Array[?] => 6
31-
case _ => 7
31+
case _ => 7 // warn: only null is matched
3232
}
3333

3434

0 commit comments

Comments
 (0)