Skip to content

[2.x] fix: Fix ProjectMatrix invalid project ID with CrossVersion.full#8484

Merged
eed3si9n merged 2 commits intosbt:developfrom
byteforge38:fix/8458-project-matrix-cross-version-full
Jan 12, 2026
Merged

[2.x] fix: Fix ProjectMatrix invalid project ID with CrossVersion.full#8484
eed3si9n merged 2 commits intosbt:developfrom
byteforge38:fix/8458-project-matrix-cross-version-full

Conversation

@byteforge38
Copy link
Copy Markdown
Contributor

Summary

Fixes #8458

When using ProjectMatrix with CrossVersion.full and Scala 2 versions like 2.13.18, the project ID incorrectly became $1$2_13_18 instead of foo2_13_18.

Root cause: The Scala 3 compiler creates synthetic intermediate vals (e.g., $1) during macro expansion. The enclosingTerm function in the macros was stopping at these synthetic symbols instead of continuing up the symbol tree to find the actual val name.

Fix: Added Flags.Synthetic check to skip compiler-generated symbols in:

  • main-settings/src/main/scala/sbt/std/KeyMacro.scala
  • lm-core/src/main/scala/sbt/librarymanagement/ConfigurationExtra.scala

Test

// build.sbt
val foo = projectMatrix
  .jvmPlatform(
    scalaVersions = Seq("2.13.18", "3.3.7"),
    crossVersion = CrossVersion.full
  )

Before: sbt projects shows $1$2_13_18, $1$3_3_7
After: sbt projects shows foo2_13_18, foo3_3_7


Contribution by Gittensor, see my contribution statistics at https://gittensor.io/miners/details?githubId=4217675

Copy link
Copy Markdown
Member

@eed3si9n eed3si9n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing. Thanks!

@byteforge38
Copy link
Copy Markdown
Contributor Author

I've just signed CLA

@eed3si9n eed3si9n merged commit bd03184 into sbt:develop Jan 12, 2026
14 checks passed
@eed3si9n eed3si9n changed the title [2.x] Fix ProjectMatrix invalid project ID with CrossVersion.full [2.x] fix: Fix ProjectMatrix invalid project ID with CrossVersion.full Jan 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[2.x] Invalid project ID error if ProjectMatrix with CrossVersion.full

2 participants