Skip to content

Fix #10143: Handle shared package references #10153

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions compiler/src/dotty/tools/dotc/core/tasty/TastyClassName.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,14 @@ class TastyClassName(bytes: Array[Byte]) {
import dotty.tools.tasty.TastyFormat._
def unpickle(reader: TastyReader, tastyName: NameTable): (TermName, TermName) = {
import reader._
def readName() = {
val idx = readNat()
nameAtRef(NameRef(idx))
}
def readNames(packageName: TermName): (TermName, TermName) = {
val tag = readByte()
if (tag >= firstLengthTreeTag) {
val len = readNat()
val end = currentAddr + len
tag match {
case TYPEDEF =>
val className = readName()
val className = reader.readName()
goto(end)
(packageName, className)
case IMPORT | VALDEF =>
Expand All @@ -48,13 +44,26 @@ class TastyClassName(bytes: Array[Byte]) {
}
else tag match {
case TERMREFpkg | TYPEREFpkg =>
val subPackageName = readName()
val subPackageName = reader.readName()
readNames(subPackageName)
case SHAREDtype =>
val addr = reader.readAddr()
val reader2 = reader.subReader(addr, reader.endAddr)
val tag2 = reader2.readByte()
assert(tag2 == TERMREFpkg || tag2 == TYPEREFpkg)
val subPackageName = reader2.readName()
readNames(subPackageName)
case _ =>
readNames(packageName)
}
}
readNames(nme.EMPTY_PACKAGE)
}

extension (reader: TastyReader) def readName() = {
val idx = reader.readNat()
nameAtRef(NameRef(idx))
}
}

}