Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion compiler/src/dotty/tools/dotc/core/Symbols.scala
Original file line number Diff line number Diff line change
Expand Up @@ -556,9 +556,10 @@ object Symbols {
type ThisName = TypeName

/** If this is a top-level class, and if `-Yretain-trees` is set, return the TypeDef tree
* for this class, otherwise EmptyTree.
* for this class, otherwise EmptyTree. This will force the info of the class.
*/
def tree(implicit ctx: Context): tpd.Tree /* tpd.TypeDef | tpd.EmptyTree */ = {
denot.info
// TODO: Consider storing this tree like we store lazy trees for inline functions
if (unpickler != null && !denot.isAbsent) {
assert(myTree.isEmpty)
Expand Down
25 changes: 18 additions & 7 deletions compiler/src/dotty/tools/dotc/interactive/InteractiveDriver.scala
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ class InteractiveDriver(settings: List[String]) extends Driver {
}
}

// Presence of a file with one of these suffixes indicates that the
// corresponding class has been pickled with TASTY.
private val tastySuffixes = List(".hasTasty", ".tasty")

private def classNames(cp: ClassPath, packageName: String): List[String] = {
def className(classSegments: List[String]) =
classSegments.mkString(".").stripSuffix(".class")
Expand All @@ -85,9 +89,6 @@ class InteractiveDriver(settings: List[String]) extends Driver {
binFile.name.stripSuffix(".class")
else
null
// Presence of a file with one of these suffixes indicates that the
// corresponding class has been pickled with TASTY.
val tastySuffixes = List(".hasTasty", ".tasty")
prefix != null && {
binFile match {
case pf: PlainFile =>
Expand Down Expand Up @@ -123,8 +124,12 @@ class InteractiveDriver(settings: List[String]) extends Driver {
.stream
.toArray(new IntFunction[Array[ZipEntry]] { def apply(size: Int) = new Array(size) })
.toSeq
entries.filter(_.getName.endsWith(".tasty"))
.map(_.getName.replace("/", ".").stripSuffix(".tasty"))
for {
entry <- entries
name = entry.getName
tastySuffix <- tastySuffixes
if name.endsWith(tastySuffix)
} yield name.replace("/", ".").stripSuffix(tastySuffix)
}

// FIXME: classfiles in directories may change at any point, so we retraverse
Expand All @@ -136,8 +141,14 @@ class InteractiveDriver(settings: List[String]) extends Driver {
val root = dirCp.dir.toPath
Files.walkFileTree(root, new SimpleFileVisitor[Path] {
override def visitFile(path: Path, attrs: BasicFileAttributes) = {
if (!attrs.isDirectory && path.getFileName.toString.endsWith(".tasty")) {
names += root.relativize(path).toString.replace("/", ".").stripSuffix(".tasty")
if (!attrs.isDirectory) {
val name = path.getFileName.toString
for {
tastySuffix <- tastySuffixes
if name.endsWith(tastySuffix)
} {
names += root.relativize(path).toString.replace("/", ".").stripSuffix(tastySuffix)
}
}
FileVisitResult.CONTINUE
}
Expand Down