diff --git a/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala b/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala index a9ea49ad1fde..0e05fb3484cc 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 000000000000..7199b7a3613c --- /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