The Scala Center team is dedicated to providing regular and transparent community updates about project plans & progress. In this forum we created a new topic category to allow quicker orientation going forward: “Scala Center Updates”. Even though all feedback is welcome, we keep the right to make executive decisions about projects we lead. Overview of all our activities can always be found at https://scala.epfl.ch/records.html .
tasty-query is a work-in-progress library by the Scala Center to read TASTy files, explore them, and ask semantic questions about them. It is an independent implementation that does not depend on the compiler. It is not usable yet. We are working on making it support the essential use cases of TASTy-MiMa, an upcoming tool “like MiMa, but for TASTy”.
Currently implemented
Thanks to the work of our former intern Katja Goltsova, the codebase can already read TASTy trees, and create symbols from them. It can read types in a “syntactic” form, but not yet with semantic information (like subtyping or type equivalence). It also has a good testing infrastructure.
In addition, we already have an open PR to create symbol information from Java .class files and Scala 2.13 so-called pickles.
Roadmap
Our roadmap for the next step is as follows.
Populate semantic type information
Now that we have syntactic information as well as symbols, the immediate next step is to populate symbols and trees with semantic type information. For Java and Scala 2, this is limited to public and protected APIs. For Scala 3 TASTy files, this also includes filling in type information for every single tree node, including in the bodies of methods. Few nodes directly store their type information inside the TASTy files, so it is up to tasty-query to fill them in, according to the Scala 3 type system.
We expect this phase to take about 1.5 months.
Semantic queries
To support the use cases of TASTy-MiMa, tasty-query will provide some critical semantic queries:
- Are two types equivalent?
- Is a type a subtype of another one?
- Is a method overriding/implementing a method from a superclass/trait?
For a first implementation, we expect to leave out difficult corner cases from the subtyping test. Excluding those, we expect this phase to take about 1 month.
Prototype of TASTy-MiMa
Based on the features of tasty-query, we will implement a first prototype of TASTy-MiMa. TASTy-MiMa will be like MiMa, but for TASTy APIs. It will be able to check that a new version of a library is TASTy-compatible (as opposed to binary-compatible) with an older version.
Based on the experience gained with this prototype, we will further plan the future of tasty-query and TASTy-MiMa.
We expect to build this prototype in about a month.
Documentation
This “milestone” will happen in parallel with the technical developments. There are several areas to document:
- The significance of TASTy as a compatibility medium, and why TASTy-MiMa will eventually become critical for the Scala ecosystem (like MiMa is today).
- The API and use cases for tasty-query. We expect tasty-query to be used in other tools than TASTy-MiMa. For example, it could be used by static analysis tools who require accurate, semantic information. It could also be used by IDEs for advanced features.
- The usage of TASTy-MiMa as a practical tool for library maintainers.