Skip to content

Commit f6ccc8c

Browse files
authored
Merge pull request #11308 from alexarchambault/in-memory-tasty
Load .tasty files from in-memory file systems too
2 parents 36159bb + 7546edb commit f6ccc8c

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -916,17 +916,14 @@ class ClassfileParser(
916916
Array.empty
917917
}
918918
case _ =>
919-
if (classfile.jpath == null) {
920-
report.error("Could not load TASTY from .tasty for virtual file " + classfile)
919+
val dir = classfile.container
920+
val name = classfile.name.stripSuffix(".class") + ".tasty"
921+
val tastyFileOrNull = dir.lookupName(name, false)
922+
if (tastyFileOrNull == null) {
923+
report.error(s"Could not find TASTY file $name under $dir")
921924
Array.empty
922-
} else {
923-
val plainFile = new PlainFile(io.File(classfile.jpath).changeExtension("tasty"))
924-
if (plainFile.exists) plainFile.toByteArray
925-
else {
926-
report.error("Could not find " + plainFile)
927-
Array.empty
928-
}
929-
}
925+
} else
926+
tastyFileOrNull.toByteArray
930927
}
931928
if (tastyBytes.nonEmpty) {
932929
val reader = new TastyReader(bytes, 0, 16)

0 commit comments

Comments
 (0)