Skip to content

Commit 7546edb

Browse files
fixup (same code path for both virtual and plain files)
1 parent 7586a43 commit 7546edb

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

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

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -916,22 +916,14 @@ class ClassfileParser(
916916
Array.empty
917917
}
918918
case _ =>
919-
if (classfile.jpath == null) {
920-
val tastyFileOrNull = classfile.container
921-
.lookupName(classfile.name.stripSuffix(".class") + ".tasty", false)
922-
if (tastyFileOrNull == null) {
923-
report.error("Could not load TASTY from .tasty for virtual file " + classfile)
924-
Array.empty
925-
} else
926-
tastyFileOrNull.toByteArray
927-
} else {
928-
val plainFile = new PlainFile(io.File(classfile.jpath).changeExtension("tasty"))
929-
if (plainFile.exists) plainFile.toByteArray
930-
else {
931-
report.error("Could not find " + plainFile)
932-
Array.empty
933-
}
934-
}
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")
924+
Array.empty
925+
} else
926+
tastyFileOrNull.toByteArray
935927
}
936928
if (tastyBytes.nonEmpty) {
937929
val reader = new TastyReader(bytes, 0, 16)

0 commit comments

Comments
 (0)