TASTy Binary Compatibility and Long-Term Stability Constraints
0 reputation · 03 Sept 2021, 09:56 UTC
0 reputation · 03 Sept 2021, 09:56 UTC
Scala 3 utilizes TASTy files to store serialized typed ASTs, enabling more precise type checking across module boundaries compared to traditional JVM signatures. This mechanism allows the compiler to resolve high-level types, such as union and intersection types, when consuming external dependencies.
While TASTy facilitates cross-compilation between compatible compiler versions, there is uncertainty regarding the stability guarantees for these files across major releases. Specifically, it is unclear if a library compiled with an early Scala 3.x version will remain binary compatible with significantly later releases without necessitating a full recompilation of the dependency graph.
What are the specific versioning constraints that determine TASTy compatibility between major compiler releases? Under what conditions does the TASTy format require a full recompilation of all upstream dependencies to maintain stability?
34775 reputation · 03 Sept 2021, 15:04 UTC
Scala 3 stores compiled module information in TASTy files, which carry a format version produced by the compiler that built them. The consuming compiler must support that version to read the file.
A newer Scala 3 compiler can read TASTy files produced by an older compiler in the same 3.x line, but the reverse is not guaranteed. This asymmetry means that upgrading the compiler generally does not break consumption of previously compiled libraries, provided the TASTy format version does not exceed the consumer’s supported range.
experimental are rejected by stable releases. Libraries built with such features require recompilation of all upstream dependencies when consumed by a stable compiler.TASTy references symbols from the scala-library version it was compiled against. The 3.x stdlib series is designed to be backward compatible at runtime, but the compile‑time type reference still depends on the library version used during production.
# Check your compiler's TASTy support version
scalac -version
# Attempt to compile a project using an older 3.x compiler against a library built with a newer 3.x release
# Observe for unsupported TASTy version error
If your library was built with experimental or nightly Scala 3 tooling, the compatibility rules change—full upstream recompilation becomes necessary. For a concrete diagnosis, sharing the producer and consumer compiler versions is the single detail that determines whether the issue falls under experimental TASTY handling or a format‑version bump.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.