Skip to content

Commit ce30e26

Browse files
authored
Merge pull request #2773 from dotty-staging/fix-all-references
Fix "Find all references" in the IDE
2 parents e1564d4 + cebef3b commit ce30e26

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

compiler/src/dotty/tools/dotc/core/Symbols.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,9 +556,10 @@ object Symbols {
556556
type ThisName = TypeName
557557

558558
/** If this is a top-level class, and if `-Yretain-trees` is set, return the TypeDef tree
559-
* for this class, otherwise EmptyTree.
559+
* for this class, otherwise EmptyTree. This will force the info of the class.
560560
*/
561561
def tree(implicit ctx: Context): tpd.Tree /* tpd.TypeDef | tpd.EmptyTree */ = {
562+
denot.info
562563
// TODO: Consider storing this tree like we store lazy trees for inline functions
563564
if (unpickler != null && !denot.isAbsent) {
564565
assert(myTree.isEmpty)

compiler/src/dotty/tools/dotc/interactive/InteractiveDriver.scala

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ class InteractiveDriver(settings: List[String]) extends Driver {
6969
}
7070
}
7171

72+
// Presence of a file with one of these suffixes indicates that the
73+
// corresponding class has been pickled with TASTY.
74+
private val tastySuffixes = List(".hasTasty", ".tasty")
75+
7276
private def classNames(cp: ClassPath, packageName: String): List[String] = {
7377
def className(classSegments: List[String]) =
7478
classSegments.mkString(".").stripSuffix(".class")
@@ -85,9 +89,6 @@ class InteractiveDriver(settings: List[String]) extends Driver {
8589
binFile.name.stripSuffix(".class")
8690
else
8791
null
88-
// Presence of a file with one of these suffixes indicates that the
89-
// corresponding class has been pickled with TASTY.
90-
val tastySuffixes = List(".hasTasty", ".tasty")
9192
prefix != null && {
9293
binFile match {
9394
case pf: PlainFile =>
@@ -123,8 +124,12 @@ class InteractiveDriver(settings: List[String]) extends Driver {
123124
.stream
124125
.toArray(new IntFunction[Array[ZipEntry]] { def apply(size: Int) = new Array(size) })
125126
.toSeq
126-
entries.filter(_.getName.endsWith(".tasty"))
127-
.map(_.getName.replace("/", ".").stripSuffix(".tasty"))
127+
for {
128+
entry <- entries
129+
name = entry.getName
130+
tastySuffix <- tastySuffixes
131+
if name.endsWith(tastySuffix)
132+
} yield name.replace("/", ".").stripSuffix(tastySuffix)
128133
}
129134

130135
// FIXME: classfiles in directories may change at any point, so we retraverse
@@ -136,8 +141,14 @@ class InteractiveDriver(settings: List[String]) extends Driver {
136141
val root = dirCp.dir.toPath
137142
Files.walkFileTree(root, new SimpleFileVisitor[Path] {
138143
override def visitFile(path: Path, attrs: BasicFileAttributes) = {
139-
if (!attrs.isDirectory && path.getFileName.toString.endsWith(".tasty")) {
140-
names += root.relativize(path).toString.replace("/", ".").stripSuffix(".tasty")
144+
if (!attrs.isDirectory) {
145+
val name = path.getFileName.toString
146+
for {
147+
tastySuffix <- tastySuffixes
148+
if name.endsWith(tastySuffix)
149+
} {
150+
names += root.relativize(path).toString.replace("/", ".").stripSuffix(tastySuffix)
151+
}
141152
}
142153
FileVisitResult.CONTINUE
143154
}

0 commit comments

Comments
 (0)