From b19a54a1ef9a23de688742240009939ac6b19c94 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Sun, 14 Apr 2024 21:17:05 -0400 Subject: [PATCH] Improve the SIP-51 error message --- main/src/main/scala/sbt/Defaults.scala | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/main/src/main/scala/sbt/Defaults.scala b/main/src/main/scala/sbt/Defaults.scala index 360dbad40..ab7e52261 100644 --- a/main/src/main/scala/sbt/Defaults.scala +++ b/main/src/main/scala/sbt/Defaults.scala @@ -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 ) }