Skip to content

Commit a4fc774

Browse files
committed
Simplify TastyHeader
1 parent 2bfc55c commit a4fc774

File tree

2 files changed

+13
-20
lines changed

2 files changed

+13
-20
lines changed

compiler/src/dotty/tools/dotc/core/SymbolLoaders.scala

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -426,14 +426,8 @@ class TastyLoader(val tastyFile: AbstractFile) extends SymbolLoader {
426426
val tastyHeader = unpickler.unpickler.header
427427
new CompilationUnitInfo(
428428
tastyFile,
429-
tastyVersion = Some(
430-
TastyVersion(
431-
tastyHeader.majorVersion,
432-
tastyHeader.minorVersion,
433-
tastyHeader.experimentalVersion,
434-
)
435-
)
436-
)
429+
tastyVersion = Some(tastyHeader.version),
430+
)
437431

438432
def description(using Context): String = "TASTy file " + tastyFile.toString
439433

tasty/src/dotty/tools/tasty/TastyHeaderUnpickler.scala

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,21 @@ import TastyFormat.{MajorVersion, MinorVersion, ExperimentalVersion, header}
88
* The Tasty Header consists of four fields:
99
* - uuid
1010
* - contains a hash of the sections of the TASTy file
11-
* - majorVersion
12-
* - matching the TASTy format version that last broke backwards compatibility
13-
* - minorVersion
14-
* - matching the TASTy format version that last broke forward compatibility
15-
* - experimentalVersion
16-
* - 0 for final compiler version
17-
* - positive for between minor versions and forward compatibility
18-
* is broken since the previous stable version.
11+
* - version
12+
* - majorVersion
13+
* - matching the TASTy format version that last broke backwards compatibility
14+
* - minorVersion
15+
* - matching the TASTy format version that last broke forward compatibility
16+
* - experimentalVersion
17+
* - 0 for final compiler version
18+
* - positive for between minor versions and forward compatibility
19+
* is broken since the previous stable version.
1920
* - toolingVersion
2021
* - arbitrary string representing the tooling that produced the TASTy
2122
*/
2223
sealed abstract case class TastyHeader(
2324
uuid: UUID,
24-
majorVersion: Int,
25-
minorVersion: Int,
26-
experimentalVersion: Int,
25+
version: TastyVersion,
2726
toolingVersion: String
2827
)
2928

@@ -156,7 +155,7 @@ class TastyHeaderUnpickler(config: UnpicklerConfig, reader: TastyReader) {
156155
})
157156

158157
val uuid = new UUID(readUncompressedLong(), readUncompressedLong())
159-
new TastyHeader(uuid, fileMajor, fileMinor, fileExperimental, toolingVersion) {}
158+
new TastyHeader(uuid, TastyVersion(fileMajor, fileMinor, fileExperimental), toolingVersion) {}
160159
}
161160
}
162161

0 commit comments

Comments
 (0)