forked from scala/scala3
-
Notifications
You must be signed in to change notification settings - Fork 0
Backport build changes and TASTy version tests from main #185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
WojciechMazur
merged 7 commits into
scala:lts-3.3
from
WojciechMazur:build/lts-backports
Mar 19, 2025
+186
−29
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
45c2e63
[build] Improve, document and group versioning code in `Build.scala` …
WojciechMazur df73cad
Improve mima test for previous version - test against first version i…
WojciechMazur b15b55d
Document referenceVersion
WojciechMazur bf9e225
Update reference, MiMa previous version and sync TASTy version (#22187)
WojciechMazur f7e6c4c
Adapt `checkReleasedTastyVersion` to LTS series - nightlies of LTS ar…
WojciechMazur b0f75e0
Adjust expected tasty version comments to LTS versioning
WojciechMazur 1c8a2f3
Adjust MiMaFilter for backported dotty.tools.tasty.TastyVersion class
WojciechMazur File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package dotty.tools.tasty | ||
|
||
import scala.annotation.internal.sharable | ||
|
||
case class TastyVersion private(major: Int, minor: Int, experimental: Int) { | ||
def isExperimental: Boolean = experimental > 0 | ||
|
||
def nextStable: TastyVersion = copy(experimental = 0) | ||
|
||
def minStable: TastyVersion = copy(minor = 0, experimental = 0) | ||
|
||
def show: String = { | ||
val suffix = if (isExperimental) s"-experimental-$experimental" else "" | ||
s"$major.$minor$suffix" | ||
} | ||
|
||
def kind: String = | ||
if (isExperimental) "experimental TASTy" else "TASTy" | ||
|
||
def validRange: String = { | ||
val min = TastyVersion(major, 0, 0) | ||
val max = if (experimental == 0) this else TastyVersion(major, minor - 1, 0) | ||
val extra = Option.when(experimental > 0)(this) | ||
s"stable TASTy from ${min.show} to ${max.show}${extra.fold("")(e => s", or exactly ${e.show}")}" | ||
} | ||
} | ||
|
||
object TastyVersion { | ||
|
||
@sharable | ||
private val cache: java.util.concurrent.ConcurrentHashMap[TastyVersion, TastyVersion] = | ||
new java.util.concurrent.ConcurrentHashMap() | ||
|
||
def apply(major: Int, minor: Int, experimental: Int): TastyVersion = { | ||
val version = new TastyVersion(major, minor, experimental) | ||
val cachedVersion = cache.putIfAbsent(version, version) | ||
if (cachedVersion == null) version else cachedVersion | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package dotty.tools.tasty | ||
|
||
import org.junit.Assert._ | ||
import org.junit.Test | ||
|
||
import TastyBuffer._ | ||
|
||
// Tests ensuring TASTY version emitted by compiler is matching expected TASTY version | ||
class BuildTastyVersionTest { | ||
|
||
val CurrentTastyVersion = TastyVersion(TastyFormat.MajorVersion, TastyFormat.MinorVersion, TastyFormat.ExperimentalVersion) | ||
|
||
// Needs to be defined in build Test/envVars | ||
val ExpectedTastyVersionEnvVar = "EXPECTED_TASTY_VERSION" | ||
|
||
@Test def testBuildTastyVersion(): Unit = { | ||
val expectedVersion = sys.env.get(ExpectedTastyVersionEnvVar) | ||
.getOrElse(fail(s"Env variable $ExpectedTastyVersionEnvVar not defined")) | ||
.match { | ||
case s"$major.$minor-experimental-$experimental" => TastyVersion(major.toInt, minor.toInt, experimental.toInt) | ||
case s"$major.$minor" if minor.forall(_.isDigit) => TastyVersion(major.toInt, minor.toInt, 0) | ||
case other => fail(s"Invalid TASTY version string: $other") | ||
} | ||
assertEquals(expectedVersion, CurrentTastyVersion) | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we were once discussing that TASTy version of all nightlies, including LTS nightlies, should be experimental. However it's not so obvious which version of TASTy format should be used in such case.
In Scala Next that would be
28.{minorVersion + 1}-experimental-1
(assuming patch > 0), however such schema cannot be used for LTS - TASTy 28.4 already exists and is stable.We can potentially use
28.3-experimental-2
but it also seems to not make sense becouse28.3
is already stabilised.In such case I think it's best to assume that LTS always emits stable TASTy. It should be fine, becouse every backported change is carefully checked and tested in both Scala CI and OpenCB before merging which should detect potential issues
Any opinions @prolativ @tgodzik
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm quite tempted to say that from TASTy's perspective we should treat LTS as any other minor version series. In theory we could also have nightly versions and backport PRs to 3.4, 3.5, etc. but we don't do that just because we don't have enough resources to manage that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Totally agree
The main problem here comes from versioning, especially because we do actually release LTS nightlies. However, the versioning schema of TASTy seems to not be compatible with our needs.
With version
28.3-experimental-2
we'd get into issue in non-bootstrapped tests - these require that reference version of compiler has version in range28.0 - 28.2
or exactly the same version experimental TASTy28.3-experimental-2
. We use 3.3.5 producing Tasty 28.3 which would not fit the required version bounds.Unless you're suggesting to use
28.4-experimental-1
which would make the non-bootstrapped tests happy. Is it what you're refering to?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But what versions do we use normally? If we have 28.7 tasty currently being release, what will be the Scala 3 nightlies have as tasty version? 3.6.2 has
28.7
and 3.6.3 has28.7
, what did the nightlies between have as tasty version?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Scala 3.3 LTS uses 28.3 for both RC and nightlies
Scala 3.4.0 uses 28.4 for stable and 28.4-experimental-1 for RC and nightly
Scala 3.4.1 uses 28.4 for RC/stable and 28.5-experimental-1 for nightlies
I think we can skip potential change to TASTy LTS versions for the future. Currently we'll continue to use existing schema - always stable TASTy