Skip to content

Commit

Permalink
Simplify TastyHeader
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasstucki committed Nov 21, 2023
1 parent 2bfc55c commit a4fc774
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 20 deletions.
10 changes: 2 additions & 8 deletions compiler/src/dotty/tools/dotc/core/SymbolLoaders.scala
Original file line number Diff line number Diff line change
Expand Up @@ -426,14 +426,8 @@ class TastyLoader(val tastyFile: AbstractFile) extends SymbolLoader {
val tastyHeader = unpickler.unpickler.header
new CompilationUnitInfo(
tastyFile,
tastyVersion = Some(
TastyVersion(
tastyHeader.majorVersion,
tastyHeader.minorVersion,
tastyHeader.experimentalVersion,
)
)
)
tastyVersion = Some(tastyHeader.version),
)

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

Expand Down
23 changes: 11 additions & 12 deletions tasty/src/dotty/tools/tasty/TastyHeaderUnpickler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,21 @@ import TastyFormat.{MajorVersion, MinorVersion, ExperimentalVersion, header}
* The Tasty Header consists of four fields:
* - uuid
* - contains a hash of the sections of the TASTy file
* - majorVersion
* - matching the TASTy format version that last broke backwards compatibility
* - minorVersion
* - matching the TASTy format version that last broke forward compatibility
* - experimentalVersion
* - 0 for final compiler version
* - positive for between minor versions and forward compatibility
* is broken since the previous stable version.
* - version
* - majorVersion
* - matching the TASTy format version that last broke backwards compatibility
* - minorVersion
* - matching the TASTy format version that last broke forward compatibility
* - experimentalVersion
* - 0 for final compiler version
* - positive for between minor versions and forward compatibility
* is broken since the previous stable version.
* - toolingVersion
* - arbitrary string representing the tooling that produced the TASTy
*/
sealed abstract case class TastyHeader(
uuid: UUID,
majorVersion: Int,
minorVersion: Int,
experimentalVersion: Int,
version: TastyVersion,
toolingVersion: String
)

Expand Down Expand Up @@ -156,7 +155,7 @@ class TastyHeaderUnpickler(config: UnpicklerConfig, reader: TastyReader) {
})

val uuid = new UUID(readUncompressedLong(), readUncompressedLong())
new TastyHeader(uuid, fileMajor, fileMinor, fileExperimental, toolingVersion) {}
new TastyHeader(uuid, TastyVersion(fileMajor, fileMinor, fileExperimental), toolingVersion) {}
}
}

Expand Down

0 comments on commit a4fc774

Please sign in to comment.