Skip to content

Load .tasty files from in-memory file systems too #11308

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

Merged
merged 2 commits into from
Feb 5, 2021
Merged
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
17 changes: 7 additions & 10 deletions compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala
Original file line number Diff line number Diff line change
Expand Up @@ -916,17 +916,14 @@ class ClassfileParser(
Array.empty
}
case _ =>
if (classfile.jpath == null) {
report.error("Could not load TASTY from .tasty for virtual file " + classfile)
val dir = classfile.container
val name = classfile.name.stripSuffix(".class") + ".tasty"
val tastyFileOrNull = dir.lookupName(name, false)
if (tastyFileOrNull == null) {
report.error(s"Could not find TASTY file $name under $dir")
Array.empty
} else {
val plainFile = new PlainFile(io.File(classfile.jpath).changeExtension("tasty"))
if (plainFile.exists) plainFile.toByteArray
else {
report.error("Could not find " + plainFile)
Array.empty
}
}
} else
tastyFileOrNull.toByteArray
}
if (tastyBytes.nonEmpty) {
val reader = new TastyReader(bytes, 0, 16)
Expand Down