zinc
zinc copied to clipboard
Extractor outputs are different in Scala 2.13.0-RC1
In https://github.com/sbt/zinc/pull/651, I bumped the 2.13 used for compiler bridge testing to 2.13.0-RC1, but the extractor output have changed.
For example:
acme.Tupler(whereacmeis a package name) doesn't extractacmeas used name.- spurious names like
package,Class, andSealedare extracted.
These would lead to either under compilation or over compilation since name hashing uses these information to determine where incremental compilation is necessary.
Thanks for opening the ticket :+1:
The one I'm concerned about is "scala;runtime;ModuleSerializationProxy;init;" which suggests we might not be handling incremental compilation correctly when initializers are involved
The ones involving ModuleSerializationProxy likely are legitimate changes introduced in Scala 2.13.0-RC1.
Some changes are likely benign products of the fact that the patmat phase now succeeds xsbt-api.
I'm glad SBT has some tests for the name extraction, as it will now see untranslated patterns, so some code paths will not be hit.
In particular, we probably need to rework the collection of names in the UseScope.PatMatTarget. That's why the test for "Sealed" started failing. We look in the patterns of a CaseDef and collect for type or constructor sub-patterns.
I'm still having trouble figuring out the workflow to edit ExtractUsedNames and running the tests. ;publishBridge;compilerBridgeTest213/testQuick does not seem to work.
IIRC publishing the bridge is not necessary if you're unit testing compilerBridgeTest213
It seems to build to:
[info] Compiling 1 Scala source to /Users/jz/code/zinc/internal/compiler-bridge/target-2.12/scala-2.12/classes ...
[warn] /Users/jz/code/zinc/internal/compiler-bridge/src/main/scala/xsbt/ExtractUsedNames.scala:57:3: dead code following this construct
[warn] ???
[warn] ^
[warn] there were four inliner warnings; re-run enabling -opt-warnings for details, or try -help
[warn] two warnings found
[info] Done compiling.
[info] Packaging /Users/jz/code/zinc/internal/compiler-bridge/target-2.12/scala-2.12/compiler-bridge_2.12-1.3.0-SNAPSHOT.jar ...
(after I edit /Users/jz/code/zinc/internal/compiler-bridge/src/main/scala/xsbt/ExtractUsedNames.scala)
But the classpath for the test is:
sbt:zinc Root> show compilerBridgeTest213/Test/fullClasspath
[info] * Attributed(/Users/jz/code/zinc/internal/compiler-bridge-test/target-2.13/scala-2.12/test-classes)
[info] * Attributed(/Users/jz/code/zinc/internal/compiler-bridge-test/target-2.13/scala-2.12/classes)
[info] * Attributed(/Users/jz/code/zinc/zinc/target/scala-2.12/classes)
[info] * Attributed(/Users/jz/code/zinc/internal/zinc-core/target/scala-2.12/classes)
You might need
compilerBridge213/publishLocal
from sbt (quicker than publishBridges after first run) then
rm -rf internal/compiler-bridge-test/target/zinc-components
from shell. This used to be done automatically, but it regressed when we starting running bridge test for different Scala versions.
[info] ExtractUsedNamesPerformanceSpecification:
[info] - should be executed in reasonable time *** FAILED ***
[info] java.lang.RuntimeException: ?0
[info] at scala.sys.package$.error(package.scala:30)
[info] at xsbt.ExtractUsedNames$JavaSet.add(ExtractUsedNames.scala:65)
[info] at xsbt.GlobalHelpers$TypeDependencyTraverser.traverse(GlobalHelpers.scala:74)
[info] at xsbt.GlobalHelpers$TypeDependencyTraverser.$anonfun$traverse$6(GlobalHelpers.scala:114)
[info] at xsbt.GlobalHelpers$TypeDependencyTraverser.$anonfun$traverse$6$adapted(GlobalHelpers.scala:114)
[info] at scala.collection.immutable.List.foreach(List.scala:313)
[info] at xsbt.GlobalHelpers$TypeDependencyTraverser.traverse(GlobalHelpers.scala:114)
[info] at xsbt.GlobalHelpers$TypeDependencyTraverser.$anonfun$traverse$2(GlobalHelpers.scala:86)
[info] at xsbt.GlobalHelpers$TypeDependencyTraverser.$anonfun$traverse$2$adapted(GlobalHelpers.scala:86)
[info] at scala.collection.immutable.List.foreach(List.scala:313)
git bisecting landed on https://github.com/scala/scala/pull/7297.