Repository navigation
Conversation
Forward-port of sbt/zinc#1316 (zinc develop merge cfd5081860). Record dependencies on the type arguments passed to a macro as a DependencyByMacroExpansion, so that changes to those types invalidate call sites whose macro expansion depends on them. Differences from upstream: - Boolean literals passed to addTypeDependencies use named arguments (forMacro = ...) to avoid 2.13 lint warnings. - No unit test: upstream only added scripted tests (macro-type-change-*).
… argument changes (sbt/zinc#1324) Forward-port of sbt/zinc#1324 (zinc develop fc22a8e322). Give constructor default-argument getters (`<init>$default$N`) a name that includes the enclosing class and the argument index, so that default getters of different classes' constructors do not collide in the API. Differences from upstream: - simpleName / simpleNameForMethod call `.decode.toString` because in 2.13's Global `Name#decode` is a String; the rest is identical. - No unit test: upstream only added scripted tests.
Forward-port of zinc develop 9e0c663561, a follow-up to sbt/zinc#1324. Follow-up to the sbt/zinc#1324 forward-port: compile the <init>$default$N pattern once instead of on every method name.
Forward-port of sbt/zinc#1507 (zinc develop af2004f4f2). Do not register a class dependency on an anonymous class. Before scala#10940 an anonymous class could be the enclosing class of an existential type symbol inferred from a refinement, producing a dependency on a class name that does not exist. Also documents why a symbol may have no associated file. Includes the unit-test counterpart of the scripted test added in sbt/zinc#1517 (source-dependencies/anon-class-dep). Differences from upstream: - The test from sbt/zinc#1517 is a scripted test (checkNumberOfLibraries), which has no equivalent here. It is adapted to a DependencyTest case asserting no anonymous-class dependency is recorded; with this repo's compiler (which already has scala#10940) it passes with or without the guard, so it is only a smoke test.
Forward-port of sbt/zinc#1782 (zinc develop 0f120a9f89). Name a type parameter declared inside a refinement relative to the outermost refinement class, because the pickler rewrites that class's owner and the full name otherwise differs between compiling from source and unpickling, flipping the API hash (sbt/sbt#1079). Differences from upstream: - The ported test only asserts SameAPI between the from-source and unpickled Impl; upstream also asserts on ShowAPI output (`<refinement>.a`), but ShowAPI is not available to scala/scala's junit tests. Verified the test fails without the ExtractAPI change.
sbt/zinc#1803) Forward-port of sbt/zinc#1803 (zinc develop 738fc6e89b). Traverse the parents of a CompoundTypeTree (`B with C`) as ordinary member references instead of through the Template case, which treated them as inheritance parents of the enclosing class.
retronym
force-pushed
the
bridge/2.13.x-s1-forward-ports
branch
from
October 2, 2026 23:39
2bb65b2 to
bbbb372
Compare
retronym
force-pushed
the
bridge/2.13.x-s1-forward-ports
branch
from
October 3, 2026 12:04
bbbb372 to
27f5d88
Compare
Upstream only has scripted tests for this. Compile a macro in one run and call it with a type argument in a second run, then check that the type argument is recorded as a DependencyByMacroExpansion dependency.
Upstream only has a scripted test for this. Check that each class's constructor default getter is named after that class, instead of the shared name `<init>$default$N`.
Since sbt/zinc#1782, a type parameter declared inside a refinement is named relative to the outermost refinement, so the parameters of two sibling type lambdas get the same name. A parameter is only referenced inside its own refinement, so the API structure still tells them apart.
DependencyContext.DependencyByMacroExpansion only exists since Zinc 1.10. sbt 1.9.x also loads scala2-sbt-bridge for Scala 2.13.12+, so reading it eagerly when the Dependency phase starts would fail every compilation there with NoSuchFieldError. Like the AnalysisCallback3 guard in CallbackGlobal, catch the linkage error and record those dependencies as DependencyByMemberRef instead.
retronym
force-pushed
the
bridge/2.13.x-s1-forward-ports
branch
from
October 5, 2026 01:41
21ff5e8 to
b4ad445
Compare
This branch has not been deployed
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.
Requested by Jason · project thread
Staging PR in retronym/scala. Work in progress. Its base is this fork's
2.13.x, synced to scala/scala2.13.xat 8b318bf. It goes to scala/scala once reviewed here. This is S1 in the backport plan. S2, which ports the bridge side of sbt/zinc#1807 (AnalysisCallback4), waits on a zinc 1.12.x release.Before: on Scala 2.13.12 and later, sbt and other build tools use
scala2-sbt-bridgefrom this repo instead of zinc's own bridge. Several fixes made to zinc's bridge never reached it. That leaves both over-compilation (spurious invalidations from constructor default arguments, compound types recorded as inheritance, unstable type-lambda parameter names) and under-compilation (macro call sites not invalidated when a type argument changes).After:
scala2-sbt-bridgehas those fixes, with unit tests where upstream had them.DependencyTestcase (upstream test is scripted only)ExtractAPITestcase (upstream test is scripted only)DependencyTestcaseExtractAPITest, plus the sibling-refinement test from sbt/zinc@1e54146d8DependencyTestDeviations from upstream:
forMacro = true/falseis passed by name, to satisfy 2.13's boolean-literal lint.DependencyByMacroExpansiononly exists in Zinc 1.10+, and sbt 1.9.x also loads this bridge for 2.13.12+. The context is read through a guardedlazy valthat falls back toDependencyByMemberRefonNoSuchFieldError, like the existingAnalysisCallback3guard..decode.toStringwhere zinc has.decode.ShowAPIisn't available intest/junit, so the test keeps only theSameAPI(fromSource, unpickled)assertion.Test coverage beyond upstream:
DependencyByMacroExpansiondependency on it, and each class's constructor default getter is named after that class (B;init;default;2) rather than the shared<init>$default$N.substSymreplaces owners ofRefinementClassSymbols scala/scala#10940 does not cover this case, so the guard is still needed.To do: run zinc's scripted tests against a
publishLocal'd bridge from this branch, using the sbt/zinc#1829 harness, so thepending-2.13tests for these PRs should pass.