Skip to content

Commit fdb9e99

Browse files
Blaisorbladeliufengyun
authored andcommitted
add further examples
1 parent 450d0c4 commit fdb9e99

File tree

3 files changed

+34
-1
lines changed

3 files changed

+34
-1
lines changed

tests/patmat/i4880.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ abstract class ZipArchive(path: String) extends AbstractFile {
77
}
88

99
object Test {
10-
def foo(file: AbstractFile) = file match {
10+
def foo(file: AbstractFile) = file match {
1111
case ze: ZipArchive#Entry =>
1212
}
1313
}

tests/patmat/i4880a.scala

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
sealed 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 a: PlainFile =>
12+
case b: ZipArchive =>
13+
case c1: ZipArchive#Entry =>
14+
case c1: ZipArchive#DirEntry =>
15+
case c: VirtualFile =>
16+
}
17+
}

tests/patmat/i4880b.scala

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
sealed 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 a: PlainFile =>
12+
case b: ZipArchive =>
13+
case c1: ZipArchive#Entry =>
14+
case c: VirtualFile =>
15+
}
16+
}

0 commit comments

Comments
 (0)