You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix undercompilation when depending on inner class
To communicate to sbt a dependency between a class currently being
compiled and some other class on the classpath, we use the
`binaryDependency` callback which requires passing the "binary class
name": for a class A in a package pkg, this is just "pkg.A", but for an
inner class B in A, that would be "pkg.A$B", in other words the last
component of the binary class name is the name of the corresponding
classfile.
Before this commit, we computed this name by extracting it from the path
of the `associatedFile` but it turns out that `associatedFile` for an
inner Scala class returns the classfile of the corresponding top-level
class! This happens because the compiler never actually reads inner
Scala classfiles since all the information is present in the top-level
.class and .tasty files. This means that under separate compilation a
dependency to an inner class was not recorded which could lead to
undercompilation (see added tests).
This commit fixes this by computing binary class names manually: they're
just made of the fullName of the enclosing package, followed by ".",
followed by the flatName of the current class. This is similar to what
is done in the Scala 2 compiler bridge in Zinc.
0 commit comments