aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 4db995e10..a186d1ce4 100644
--- a/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala
+++ b/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala
@@ -1059,7 +1059,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