aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorliu fengyun <liu@fengy.me>2017-04-04 13:00:15 +0200
committerliu fengyun <liu@fengy.me>2017-04-04 23:17:11 +0200
commit9191d636138a025c9967c11e37900dacf0bab1c2 (patch)
treef7db6292f6b1a298a58877124f85a94d24369cc1
parenta71cb970b779692d2dd68cd9ba00d2be5e6759be (diff)
downloaddotty-9191d636138a025c9967c11e37900dacf0bab1c2.tar.gz
dotty-9191d636138a025c9967c11e37900dacf0bab1c2.tar.bz2
dotty-9191d636138a025c9967c11e37900dacf0bab1c2.zip
fix #2166: unpickling of shared CaseDef
-rw-r--r--compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala8
-rw-r--r--tests/pickling/i2166.scala5
2 files changed, 12 insertions, 1 deletions
diff --git a/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala b/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala
index a9ea49ad1..0e05fb348 100644
--- a/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala
+++ b/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala
@@ -1062,7 +1062,13 @@ class TreeUnpickler(reader: TastyReader, tastyName: TastyName.Table, posUnpickle
}
def readCases(end: Addr)(implicit ctx: Context): List[CaseDef] =
- collectWhile(nextByte == CASEDEF && currentAddr != end) { readCase()(ctx.fresh.setNewScope) }
+ collectWhile((nextByte == CASEDEF || nextByte == SHARED) && currentAddr != end) {
+ if (nextByte == SHARED) {
+ readByte()
+ forkAt(readAddr()).readCase()(ctx.fresh.setNewScope)
+ }
+ else readCase()(ctx.fresh.setNewScope)
+ }
def readCase()(implicit ctx: Context): CaseDef = {
val start = currentAddr
diff --git a/tests/pickling/i2166.scala b/tests/pickling/i2166.scala
new file mode 100644
index 000000000..7199b7a36
--- /dev/null
+++ b/tests/pickling/i2166.scala
@@ -0,0 +1,5 @@
+object Test {
+ @inline def f = "" match { case _ => false }
+
+ def main(args: Array[String]): Unit = f
+} \ No newline at end of file