Skip to content

[2.x] feat: Add allowMismatchScala setting#8804

Merged
eed3si9n merged 5 commits intosbt:developfrom
dev-miro26:fix/allow-mismatch-scala-8802
Feb 25, 2026
Merged

[2.x] feat: Add allowMismatchScala setting#8804
eed3si9n merged 5 commits intosbt:developfrom
dev-miro26:fix/allow-mismatch-scala-8802

Conversation

@dev-miro26
Copy link
Copy Markdown
Contributor

@dev-miro26 dev-miro26 commented Feb 23, 2026

Fixes #8802

I successfully signed the Scala CLA.

Problem

sbt 2.x allows dependsOn(...) between subprojects with mismatched
Scala versions without any warning or error. This can lead to confusing
classpath issues at compile or runtime, especially now that Scala 3.8+
has dropped backward TASTy compatibility with 2.13.

Solution

  1. Added allowMismatchScala setting key (default false at global level).
  2. When false, errors on Scala binary version mismatches between
    dependsOn projects, with an exception for the Scala 2.13 ↔ 3.0–3.7
    sandwich (traditional TASTy compatibility).
  3. When true on a project, allows arbitrary Scala version dependencies.

Testing

  • 9 HedgeHog unit tests for isAllowedScalaMismatch edge cases
  • Scripted test project/allow-mismatch-scala covering:
    • 2.13 → 3.5 (allowed sandwich)
    • 2.13 → 3.8 (blocked mismatch)
    • Override with allowMismatchScala := true
  • mimaReportBinaryIssues passes (no bincompat issues)

AI Disclosure

This PR was created with AI assistance (Claude Opus 4.6). All changes
were compiled, tested, and verified.

Per review feedback, move the Scala version mismatch check from
compileTask to projectDependenciesTask, where PR sbt#8681 already handles
Scala version mixing logic. This provides earlier detection and keeps
the validation co-located with cross-version resolution.

Generated-by: Copilot
@dev-miro26 dev-miro26 requested a review from eed3si9n February 24, 2026 09:37
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.

Thanks!

@eed3si9n eed3si9n merged commit 3ca9a38 into sbt:develop Feb 25, 2026
15 checks passed
@dev-miro26 dev-miro26 deleted the fix/allow-mismatch-scala-8802 branch February 25, 2026 03:07
eed3si9n pushed a commit to eed3si9n/sbt that referenced this pull request Mar 1, 2026
sbt 2.x allows `dependsOn(...)` between subprojects with mismatched
Scala versions without any warning or error. This can lead to confusing
classpath issues at compile or runtime, especially now that Scala 3.8+
has dropped backward TASTy compatibility with 2.13.

Per review feedback, move the Scala version mismatch check from
compileTask to projectDependenciesTask, where PR sbt#8681 already handles
Scala version mixing logic. This provides earlier detection and keeps
the validation co-located with cross-version resolution.

Generated-by: Copilot
eed3si9n added a commit that referenced this pull request Mar 1, 2026
sbt 2.x allows `dependsOn(...)` between subprojects with mismatched
Scala versions without any warning or error. This can lead to confusing
classpath issues at compile or runtime, especially now that Scala 3.8+
has dropped backward TASTy compatibility with 2.13.

Per review feedback, move the Scala version mismatch check from
compileTask to projectDependenciesTask, where PR #8681 already handles
Scala version mixing logic. This provides earlier detection and keeps
the validation co-located with cross-version resolution.

Generated-by: Copilot

Co-authored-by: dev-miro26 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[2.x] allowMismatchScala setting

2 participants