Skip to content

Commit 2059a9a

Browse files
committed
Refactor
1 parent ce9413b commit 2059a9a

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

compiler/src/dotty/tools/dotc/classpath/AggregateClassPath.scala

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,6 @@ case class AggregateClassPath(aggregates: Seq[ClassPath]) extends ClassPath {
115115
* having the TASTy in a later classpath entry.
116116
*/
117117
private def mergeClassesAndSources(entries: scala.collection.Seq[ClassRepresentation]): Seq[ClassRepresentation] = {
118-
def onlyClassEntry(entry: ClassRepresentation): Boolean = !entry.tasty.isDefined && entry.classfile.isDefined
119-
def onlyTastyEntry(entry: ClassRepresentation): Boolean = !entry.classfile.isDefined && entry.tasty.isDefined
120118
// based on the implementation from MergedClassPath
121119
var count = 0
122120
val indices = util.HashMap[String, Int]()
@@ -133,10 +131,10 @@ case class AggregateClassPath(aggregates: Seq[ClassPath]) extends ClassPath {
133131
mergedEntries(index) = BinaryAndSourceFilesEntry(existing, entry)
134132
case (entry: BinaryFileEntry, existing: SourceFileEntry) =>
135133
mergedEntries(index) = BinaryAndSourceFilesEntry(entry, existing)
136-
case (entry: BinaryFileEntry, existing: BinaryFileEntry) if onlyClassEntry(existing) && onlyTastyEntry(entry) =>
134+
case (entry @ TastyFileEntry(_, None), _: ClassFileEntry) =>
137135
mergedEntries(index) = entry
138-
case (entry: BinaryFileEntry, existing: BinaryAndSourceFilesEntry) if onlyClassEntry(existing) && onlyTastyEntry(entry) =>
139-
mergedEntries(index) = BinaryAndSourceFilesEntry(entry, existing.sourceEntry)
136+
case (entry @ TastyFileEntry(_, None), BinaryAndSourceFilesEntry(_: ClassFileEntry, sourceEntry)) =>
137+
mergedEntries(index) = BinaryAndSourceFilesEntry(entry, sourceEntry)
140138
case _ =>
141139
}
142140
else {

0 commit comments

Comments
 (0)