Use the most up-to-date analysis for binary to source class name lookup #1287
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes #1268
Cause
During Dependency Extraction,
internalBinaryToSourceClassName
is used to map binary class name to source class name. It is constructed at the first cycle. Hence in subsequent cycles, it is outdated. This results in missing internal member reference dependency betweena.Use
pkgName.Test
.To fix it, we rebuild lookup using the most up-to-date analysis.
Other changes
This PR also removed
internalSourceToClassNamesMap
. It is currently not used, but it has the same staleness problem asinternalBinaryToSourceClassName
. So might as well remove it to prevent someone from accidentally using it in the future.Why
empty-package
erroneously passed on zinc repoThe complier bridge did recognize a dependency between
a.Use
andpkgName.Test
exists. However, sinceinternalBinaryToSourceClassName
was stale, zinc failed to mappkgName.Test
back to its.scala
source file, and instead misclassified the dependency as a external library dependency. This can be observed in the zinc test log:Then in
invalidateInitial
, all sources that depends onpkgName.Test
library is invalidated viaval byLibraryDep = changes.libraryDeps.flatMap(previous.usesLibrary)
Validating the fix
empty-package
test is modified to assert dependency betweena.Use
pkgName.Test
must exist after the 2nd compilation run.Running the modified
empty-package
on current latestdevelop
branch commit now results in test failure.