Skip to content

Commit

Permalink
Merge pull request #983 from retronym/ticket/690-package-object
Browse files Browse the repository at this point in the history
Fix package object invalidation when ancestor has inner class (avoiding "Symbol 'type b.A' is missing from the classpath" error)
  • Loading branch information
jvican authored Jun 3, 2021
2 parents d56686b + 7eeca24 commit a020abf
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,16 @@ private[inc] class IncrementalNameHashingCommon(
apis: APIs
): Set[String] = {
val findSubclasses = relations.inheritance.internal.reverse _
val invalidatedClassesAndCodefinedClasses = for {
cls <- invalidatedClasses.iterator
file <- relations.definesClass(cls).iterator
cls1 <- relations.classNames(file)
} yield cls1

debug("Invalidate package objects by inheritance only...")
val invalidatedPackageObjects =
transitiveDeps(invalidatedClasses, log)(findSubclasses).filter(_.endsWith(".package"))
transitiveDeps(invalidatedClassesAndCodefinedClasses.toSet, log)(findSubclasses)
.filter(_.endsWith(".package"))
debug(s"Package object invalidations: ${invalidatedPackageObjects.mkString(", ")}")
invalidatedPackageObjects
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package b

class A {
class Inner {
O.o
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package b

object O {
def o = ""
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package object b extends A
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package b

object O {
def o = 42
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
> compile
$ copy-file changes/O1.scala O.scala
> compile
> checkIterations 3

0 comments on commit a020abf

Please sign in to comment.