File tree 2 files changed +19
-1
lines changed
compiler/src/dotty/tools/dotc/transform/patmat 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -299,7 +299,10 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {
299
299
300
300
debug.println(s " atomic intersection: ${and.show} = ${res}" )
301
301
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 )
303
306
}
304
307
305
308
/** Whether the extractor is irrefutable */
Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments