Merge pull request #7533 from eed3si9n/wip/sip51-error-message

Improve the SIP-51 error message
This commit is contained in:
eugene yokota 2024-04-14 21:38:23 -04:00 committed by GitHub
commit e254370384
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 3 deletions

View File

@ -1180,11 +1180,16 @@ object Defaults extends BuildCommon {
} {
for (lib <- compileReport.modules.find(_.module.name == libName)) {
val libVer = lib.module.revision
val n = name.value
if (VersionNumber(sv).matchesSemVer(SemanticSelector(s"<$libVer")))
sys.error(
s"""`${name.value}/scalaVersion` needs to be upgraded to $libVer. To support backwards-only
|binary compatibility (SIP-51), the Scala compiler cannot be older than $libName on the
|dependency classpath. See `${name.value}/evicted` why $libName was upgraded from $sv to $libVer.
s"""expected `$n/scalaVersion` to be "$libVer" or later,
|but found "$sv"; upgrade scalaVerion to fix the build.
|
|to support backwards-only binary compatibility (SIP-51),
|the Scala 2.13 compiler cannot be older than $libName on the
|dependency classpath.
|see `$n/evicted` to know why $libName $libVer is getting pulled in.
|""".stripMargin
)
}