diff --git a/compiler/test/dotty/tools/dotc/core/tasty/TastyHeaderUnpicklerTest.scala b/compiler/test/dotty/tools/dotc/core/tasty/TastyHeaderUnpicklerTest.scala index c722af979d76..53c1f40638a4 100644 --- a/compiler/test/dotty/tools/dotc/core/tasty/TastyHeaderUnpicklerTest.scala +++ b/compiler/test/dotty/tools/dotc/core/tasty/TastyHeaderUnpicklerTest.scala @@ -56,7 +56,7 @@ class TastyHeaderUnpicklerTest { val file = TastyVersion(28, 4, 1) val read = TastyVersion(28, 4, 0) expectUnpickleError(runTest(file, read, "Scala 3.4.0-RC1-bin-SNAPSHOT")) { - """TASTy file produced by Scala 3.4.0-RC1-bin-SNAPSHOT has a backward incompatible TASTy version 28.4-experimental-1, + """Backward incompatible TASTy file has version 28.4-experimental-1, produced by Scala 3.4.0-RC1-bin-SNAPSHOT, | expected stable TASTy from 28.0 to 28.4. | The source of this file should be recompiled by a Scala 3.4.0 compiler or newer. | Usually this means that the library dependency containing this file should be updated. @@ -70,7 +70,7 @@ class TastyHeaderUnpicklerTest { val file = TastyVersion(28, 3, 1) val read = TastyVersion(28, 4, 0) expectUnpickleError(runTest(file, read, "Scala 3.2.1-RC1-bin-SNAPSHOT")) { - """TASTy file produced by Scala 3.2.1-RC1-bin-SNAPSHOT has a backward incompatible TASTy version 28.3-experimental-1, + """Backward incompatible TASTy file has version 28.3-experimental-1, produced by Scala 3.2.1-RC1-bin-SNAPSHOT, | expected stable TASTy from 28.0 to 28.4. | The source of this file should be recompiled by a Scala 3.3.0 compiler or newer. | Usually this means that the library dependency containing this file should be updated. @@ -84,7 +84,7 @@ class TastyHeaderUnpicklerTest { val file = TastyVersion(27, 3, 0) val read = TastyVersion(28, 3, 0) expectUnpickleError(runTest(file, read, "Scala 3.0.0-M1")) { - """TASTy file has a backward incompatible TASTy version 27.3, + """Backward incompatible TASTy file has version 27.3, | expected stable TASTy from 28.0 to 28.3. | The source of this file should be recompiled by a Scala 3.0.0 compiler or newer. | Usually this means that the library dependency containing this file should be updated. @@ -99,7 +99,7 @@ class TastyHeaderUnpicklerTest { val file = TastyVersion(27, 3, 0) val read = TastyVersion(28, 3, 0) expectUnpickleError(runTest(file, read, "Scala 3.0.0-M1", generic = true)) { - """TASTy file has a backward incompatible TASTy version 27.3, + """Backward incompatible TASTy file has version 27.3, | expected stable TASTy from 28.0 to 28.3. | The source of this file should be recompiled by a later version. | Usually this means that the classpath entry of this file should be updated. @@ -113,7 +113,7 @@ class TastyHeaderUnpicklerTest { val file = TastyVersion(28, 4, 1) val read = TastyVersion(28, 4, 2) expectUnpickleError(runTest(file, read, "Scala 3.3.3-RC1-NIGHTLY")) { - """TASTy file produced by Scala 3.3.3-RC1-NIGHTLY has a backward incompatible TASTy version 28.4-experimental-1, + """Backward incompatible TASTy file has version 28.4-experimental-1, produced by Scala 3.3.3-RC1-NIGHTLY, | expected stable TASTy from 28.0 to 28.3, or exactly 28.4-experimental-2. | The source of this file should be recompiled by the same nightly or snapshot Scala 3.3 compiler. | Usually this means that the library dependency containing this file should be updated. @@ -128,7 +128,7 @@ class TastyHeaderUnpicklerTest { val file = TastyVersion(28, 4, 1) val read = TastyVersion(28, 4, 2) expectUnpickleError(runTest(file, read, "Scala 3.3.3-RC1-NIGHTLY", generic = true)) { - """TASTy file produced by Scala 3.3.3-RC1-NIGHTLY has a backward incompatible TASTy version 28.4-experimental-1, + """Backward incompatible TASTy file has version 28.4-experimental-1, produced by Scala 3.3.3-RC1-NIGHTLY, | expected stable TASTy from 28.0 to 28.3, or exactly 28.4-experimental-2. | The source of this file should be recompiled by a later version. | Usually this means that the classpath entry of this file should be updated. @@ -142,7 +142,7 @@ class TastyHeaderUnpicklerTest { val file = TastyVersion(28, 3, 0) val read = TastyVersion(28, 2, 0) expectUnpickleError(runTest(file, read, "Scala 3.3.1")) { - """TASTy file produced by Scala 3.3.1 has a forward incompatible TASTy version 28.3, + """Forward incompatible TASTy file has version 28.3, produced by Scala 3.3.1, | expected stable TASTy from 28.0 to 28.2. | To read this TASTy file, use a Scala 3.3.0 compiler or newer. | Please refer to the documentation for information on TASTy versioning: @@ -156,7 +156,7 @@ class TastyHeaderUnpicklerTest { val file = TastyVersion(28, 3, 0) val read = TastyVersion(28, 2, 0) expectUnpickleError(runTest(file, read, "Scala 3.3.1", generic = true)) { - """TASTy file produced by Scala 3.3.1 has a forward incompatible TASTy version 28.3, + """Forward incompatible TASTy file has version 28.3, produced by Scala 3.3.1, | expected stable TASTy from 28.0 to 28.2. | To read this TASTy file, use a newer version of this tool compatible with TASTy 28.3. | Please refer to the documentation for information on TASTy versioning: @@ -169,7 +169,7 @@ class TastyHeaderUnpicklerTest { val file = TastyVersion(28, 3, 1) val read = TastyVersion(28, 2, 0) expectUnpickleError(runTest(file, read, "Scala 3.2.2-RC1-NIGHTLY")) { - """TASTy file produced by Scala 3.2.2-RC1-NIGHTLY has a forward incompatible TASTy version 28.3-experimental-1, + """Forward incompatible TASTy file has version 28.3-experimental-1, produced by Scala 3.2.2-RC1-NIGHTLY, | expected stable TASTy from 28.0 to 28.2. | To read this experimental TASTy file, use the same nightly or snapshot Scala 3.2 compiler. | Note that you are using a stable compiler, which can not read experimental TASTy. @@ -183,7 +183,7 @@ class TastyHeaderUnpicklerTest { val file = TastyVersion(29, 0, 0) val read = TastyVersion(28, 3, 0) expectUnpickleError(runTest(file, read, "Scala 4.0.0")) { - """TASTy file produced by Scala 4.0.0 has a forward incompatible TASTy version 29.0, + """Forward incompatible TASTy file has version 29.0, produced by Scala 4.0.0, | expected stable TASTy from 28.0 to 28.3. | To read this TASTy file, use a more recent Scala compiler. | Please refer to the documentation for information on TASTy versioning: @@ -196,7 +196,7 @@ class TastyHeaderUnpicklerTest { val file = TastyVersion(29, 0, 1) val read = TastyVersion(28, 3, 0) expectUnpickleError(runTest(file, read, "Scala 4.0.0-M1")) { - """TASTy file produced by Scala 4.0.0-M1 has a forward incompatible TASTy version 29.0-experimental-1, + """Forward incompatible TASTy file has version 29.0-experimental-1, produced by Scala 4.0.0-M1, | expected stable TASTy from 28.0 to 28.3. | To read this experimental TASTy file, use the same Scala compiler. | Note that you are using a stable compiler, which can not read experimental TASTy. @@ -211,7 +211,7 @@ class TastyHeaderUnpicklerTest { val file = TastyVersion(29, 0, 1) val read = TastyVersion(28, 3, 0) expectUnpickleError(runTest(file, read, "Scala 4.0.0-M1", generic = true)) { - """TASTy file produced by Scala 4.0.0-M1 has a forward incompatible TASTy version 29.0-experimental-1, + """Forward incompatible TASTy file has version 29.0-experimental-1, produced by Scala 4.0.0-M1, | expected stable TASTy from 28.0 to 28.3. | To read this experimental TASTy file, use the version of this tool compatible with TASTy 29.0-experimental-1. | Note that this tool does not support reading experimental TASTy. @@ -225,7 +225,7 @@ class TastyHeaderUnpicklerTest { val file = TastyVersion(28, 4, 0) val read = TastyVersion(28, 4, 1) // 3.4.0-RC1-NIGHTLY expectUnpickleError(runTest(file, read, "Scala 3.4.2")) { - """TASTy file produced by Scala 3.4.2 has a forward incompatible TASTy version 28.4, + """Forward incompatible TASTy file has version 28.4, produced by Scala 3.4.2, | expected stable TASTy from 28.0 to 28.3, or exactly 28.4-experimental-1. | To read this TASTy file, use a Scala 3.4.0 compiler or newer. | Please refer to the documentation for information on TASTy versioning: @@ -238,7 +238,7 @@ class TastyHeaderUnpicklerTest { val file = TastyVersion(28, 4, 2) val read = TastyVersion(28, 4, 1) expectUnpickleError(runTest(file, read, "Scala 3.3.3-RC2-NIGHTLY")) { - """TASTy file produced by Scala 3.3.3-RC2-NIGHTLY has a forward incompatible TASTy version 28.4-experimental-2, + """Forward incompatible TASTy file has version 28.4-experimental-2, produced by Scala 3.3.3-RC2-NIGHTLY, | expected stable TASTy from 28.0 to 28.3, or exactly 28.4-experimental-1. | To read this experimental TASTy file, use the same nightly or snapshot Scala 3.3 compiler. | Please refer to the documentation for information on TASTy versioning: @@ -252,7 +252,7 @@ class TastyHeaderUnpicklerTest { val file = TastyVersion(28, 4, 2) val read = TastyVersion(28, 4, 1) expectUnpickleError(runTest(file, read, "Scala 3.3.3-RC2-NIGHTLY", generic = true)) { - """TASTy file produced by Scala 3.3.3-RC2-NIGHTLY has a forward incompatible TASTy version 28.4-experimental-2, + """Forward incompatible TASTy file has version 28.4-experimental-2, produced by Scala 3.3.3-RC2-NIGHTLY, | expected stable TASTy from 28.0 to 28.3, or exactly 28.4-experimental-1. | To read this experimental TASTy file, use the version of this tool compatible with TASTy 28.4-experimental-2. | Please refer to the documentation for information on TASTy versioning: diff --git a/tasty/src/dotty/tools/tasty/TastyHeaderUnpickler.scala b/tasty/src/dotty/tools/tasty/TastyHeaderUnpickler.scala index 1a67913e68ca..db07666d3be1 100644 --- a/tasty/src/dotty/tools/tasty/TastyHeaderUnpickler.scala +++ b/tasty/src/dotty/tools/tasty/TastyHeaderUnpickler.scala @@ -103,7 +103,7 @@ class TastyHeaderUnpickler(config: UnpicklerConfig, reader: TastyReader) { val fileMinor = readNat() val fileVersion = TastyVersion(fileMajor, fileMinor, 0) val toolVersion = TastyVersion(toolMajor, toolMinor, toolExperimental) - val signature = signatureString(fileVersion, toolVersion, what = "backward", tool = None) + val signature = signatureString(fileVersion, toolVersion, what = "Backward", tool = None) val fix = recompileFix(toolVersion.minStable) throw new UnpickleException(signature + fix + tastyAddendum) } @@ -141,7 +141,7 @@ class TastyHeaderUnpickler(config: UnpicklerConfig, reader: TastyReader) { val compat = Compatibility.failReason(file = fileVersion, read = toolVersion) - val what = if (compat < 0) "backward" else "forward" + val what = if (compat < 0) "Backward" else "Forward" val signature = signatureString(fileVersion, toolVersion, what, tool = Some(toolingVersion)) val fix = ( if (compat < 0) { @@ -169,8 +169,8 @@ class TastyHeaderUnpickler(config: UnpicklerConfig, reader: TastyReader) { private def signatureString( fileVersion: TastyVersion, toolVersion: TastyVersion, what: String, tool: Option[String]) = { - val optProducedBy = tool.fold("")(t => s" produced by $t") - s"""TASTy file$optProducedBy has a $what incompatible TASTy version ${fileVersion.show}, + val optProducedBy = tool.fold("")(t => s", produced by $t") + s"""$what incompatible TASTy file has version ${fileVersion.show}$optProducedBy, | expected ${toolVersion.validRange}. |""".stripMargin }