Skip to content

Commit

Permalink
tweak message header
Browse files Browse the repository at this point in the history
  • Loading branch information
bishabosha committed Nov 3, 2023
1 parent 02ec718 commit df4da02
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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.
Expand All @@ -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:
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand Down
8 changes: 4 additions & 4 deletions tasty/src/dotty/tools/tasty/TastyHeaderUnpickler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit df4da02

Please sign in to comment.