Repository navigation
[1.x] Tell objects and classes apart in inheritance dependency tracking (backport of #1807, #1809, #1837) - #1839
Merged
Conversation
retronym
force-pushed
the
backport/1.12.x-z2-name-kinds
branch
from
October 5, 2026 12:12
a8d5eb6 to
2793555
Compare
retronym
marked this pull request as draft
October 5, 2026 12:12
Backport of sbt#1837 (develop 7080f96). Scripted picked a bridge by Scala version and took the first match, so "2.13.y" projects ran on zinc's own compiler-bridge sources rather than on scala2-sbt-bridge. Select bridges by label instead, add a checkBridge scripted command with a general/bridge-* test per label, fail a scripted test whose projects use different labels, and add module-inheritance-extra-hash-213-bin as a pending test of sbt#1807's bridge side on scala2-sbt-bridge. Deviations from upstream: - IncHandler and BridgeProviderTestkit are ported to Scala 2 syntax; 1.12.x's ScalaBridge entries keep their class directory only. - project/Dependencies.scala is unchanged: scala213ForBridge is already 2.13.18 on 1.12.x. - contributing-docs/03_scripted_tests.md does not exist on 1.12.x, so the documentation of the labels is not ported.
retronym
force-pushed
the
backport/1.12.x-z2-name-kinds
branch
from
October 5, 2026 21:24
2793555 to
a4d31f9
Compare
retronym
marked this pull request as ready for review
October 5, 2026 21:24
eed3si9n
approved these changes
Oct 5, 2026
| * can tell the two apart. A bridge that only calls the inherited overloads keeps | ||
| * the previous behaviour, where they are conflated. | ||
| */ | ||
| public interface AnalysisCallback4 extends AnalysisCallback3 { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Backports #1807 and #1809 to 1.12.x. Unlike the rest of the 1.12.x backports, this one adds public API to
compiler-interface, so it is separate and needs a maintainer decision.Problem
Dependency tracking records
object B extends Aandtrait B extends Aas the same edge fromBtoA. With a plaintrait Band a companionobject B extends A, subclasses ofBthen depend onA's private members, so changes inArecompile them needlessly (#1795).Change
The bridge reports whether the dependent name is a term or a type, and only the type side's parents go into a trait's extraHash.
API addition:
compiler-interfacegainsxsbti.AnalysisCallback4(extendsAnalysisCallback3),xsbti.ClassRefandxsbti.NameKind. It is purely additive. Bridges that don't implement it (older zinc bridges, the currentscala2-sbt-bridge, Scala 3) fall back to the String overloads, which treat every name as a type and so behave as before.scala2-sbt-bridgecan only adopt it once this is in a zinc release.The last commit makes scripted select bridges by label, so "2.13.y" projects run on
scala2-sbt-bridgeinstead of zinc's own bridge sources. Its pendingmodule-inheritance-extra-hash-213-binfails on the stock bridge and passes with retronym/scala#135, which shows the bridge half of #1807 is needed on 2.13.Deviations from upstream
Incremental.scalais ported to Scala 2 syntax, keepingprivate[this]as on 1.12.x. The Java interfaces, bridge sources,JavaAnalyze,TestCallbackand the tests apply unchanged.IncHandlerandBridgeProviderTestkitare ported to Scala 2 syntax.project/Dependencies.scalais unchanged (scala213ForBridgeis already 2.13.18), and the scripted-test docs it extends don't exist on 1.12.x.Tests
module-inheritance-extra-hash(scripted, new) fails without the change and passes with it.pipelining/trait-extends-java-interface(scripted, new) guards the Java-parent path of the new code.AI disclosure
LLM assisted, but fully human reviewed.