Add method unrolling to Scala 3
- Start: Oct/2024
- 1 minute read
- all projects
Project URL this project is still in progress...
Summary: Enhance the Scala language to support binary compatible addition of parameters.
About the Project
Implement the specification of SIP-61, which specifies code generation of forwarder methods that match the signature of a method, before a parameter was added.
Current Status
The PR is open, tracking the current progress.
The feature is implemented, and passing the automated tests. The PR is currently under review from the SIP committee and Scala 3 maintainers.
Done:
- ✅ New annotation
@scala.annotation.unroll
to enable the feature. - ✅ New phase after typechecking, before pickling, to generate forwarder methods.
- ✅ Detect correct usage of the annotation in prior "posttyper" phase.
- ✅ Lazy transform - only run transform where the annotation is used.
- ✅ Documentation page
- ✅ Report errors with incorrect usage.
- ✅ Detect problematic cases with transparent inline (where forwarders are not yet visible).
- ✅ Test edge cases such as incremental compilation.
- ✅ Test usage on
case class
,enum
,class
,trait
andobject
.
Still to do:
- 🚧 Potentially change implementation based on feedback.