Skip to content

Commit ffa3ed7

Browse files
committed
fix CI
1 parent 5dccc29 commit ffa3ed7

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,10 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {
299299

300300
debug.println(s"atomic intersection: ${and.show} = ${res}")
301301

302-
if (res) Typ(and, true) else Empty
302+
if (!res) Empty
303+
else if (tp1.isSingleton) Typ(tp1, true)
304+
else if (tp2.isSingleton) Typ(tp2, true)
305+
else Typ(and, true)
303306
}
304307

305308
/** Whether the extractor is irrefutable */

tests/patmat/file.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
abstract class AbstractFile
2+
class PlainFile(path: String) extends AbstractFile
3+
class VirtualFile(name: String) extends AbstractFile
4+
abstract class ZipArchive(path: String) extends AbstractFile {
5+
sealed abstract class Entry(name: String) extends VirtualFile(name)
6+
class DirEntry(path: String) extends Entry(path)
7+
}
8+
9+
object Test {
10+
def foo(file: AbstractFile) = file match {
11+
case ze: ZipArchive#Entry =>
12+
case pf: PlainFile =>
13+
case _ =>
14+
}
15+
}

0 commit comments

Comments
 (0)