From 0fb4800c15264ab610225e10d4f930f32fbd4989 Mon Sep 17 00:00:00 2001 From: Krzysztof Romanowski Date: Wed, 3 May 2023 17:39:52 +0200 Subject: [PATCH 1/2] Better message on TASTY mismatch --- .../tools/tasty/TastyHeaderUnpickler.scala | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/tasty/src/dotty/tools/tasty/TastyHeaderUnpickler.scala b/tasty/src/dotty/tools/tasty/TastyHeaderUnpickler.scala index c0ed5dbd58fa..e7b4a07c25b3 100644 --- a/tasty/src/dotty/tools/tasty/TastyHeaderUnpickler.scala +++ b/tasty/src/dotty/tools/tasty/TastyHeaderUnpickler.scala @@ -107,11 +107,20 @@ object TastyHeaderUnpickler { } val minorVersion = showMinorVersion(MinorVersion, ExperimentalVersion) val fileMinorVersion = showMinorVersion(fileMinor, fileExperimental) - s"""TASTy signature has wrong version. - | expected: {majorVersion: $MajorVersion, minorVersion: $minorVersion} - | found : {majorVersion: $fileMajor, minorVersion: $fileMinorVersion} - | - |""".stripMargin + + if (MajorVersion == 28 && fileMajor == 28) + s"""Found a file on classpath, that was compiled with a newer Scala version than the one currently used. + | Found: 3.$fileMinorVersion + | Supported: 3.$minorVersion or older + | + | Try updating your Scala version to 3.$fileMinorVersion or change the classpath.""".stripMargin + else + // This should not happen in practice but better safe than sorry + s"""TASTy signature has wrong version that cannot be expressed as Scala version. + | expected: {majorVersion: $MajorVersion, minorVersion: $minorVersion} + | found : {majorVersion: $fileMajor, minorVersion: $fileMinorVersion} + |""".stripMargin + } private def unstableAddendum = From 979c9dc7d76d5f2c3934e089521e6d52f45b156d Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Fri, 12 May 2023 14:28:32 +0200 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Chris Kipp --- tasty/src/dotty/tools/tasty/TastyHeaderUnpickler.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasty/src/dotty/tools/tasty/TastyHeaderUnpickler.scala b/tasty/src/dotty/tools/tasty/TastyHeaderUnpickler.scala index e7b4a07c25b3..917f0840f1c4 100644 --- a/tasty/src/dotty/tools/tasty/TastyHeaderUnpickler.scala +++ b/tasty/src/dotty/tools/tasty/TastyHeaderUnpickler.scala @@ -109,11 +109,11 @@ object TastyHeaderUnpickler { val fileMinorVersion = showMinorVersion(fileMinor, fileExperimental) if (MajorVersion == 28 && fileMajor == 28) - s"""Found a file on classpath, that was compiled with a newer Scala version than the one currently used. + s"""Found a file on classpath that was compiled with a newer Scala version than the one currently used. | Found: 3.$fileMinorVersion | Supported: 3.$minorVersion or older | - | Try updating your Scala version to 3.$fileMinorVersion or change the classpath.""".stripMargin + | To fix this issue, try updating your Scala version to 3.$fileMinorVersion.""".stripMargin else // This should not happen in practice but better safe than sorry s"""TASTy signature has wrong version that cannot be expressed as Scala version.