Add Scala 3 code generation support (#2188)#2196
Open
Conversation
- Add ScalaVersion ADT to represent target Scala version (2.12, 2.13, 3) - Add Scala3Compat utility for generating `using` clauses instead of `implicit` - Add scalaVersion field to Context for version-aware code generation - Update AkkaHttp generators to use Scala3Compat.implicitsClause - Update Http4s client generator for Scala 3 compatibility - Add comprehensive tests for ScalaVersion, Scala3Compat, and generated code
blast-hardcheese
approved these changes
Dec 21, 2025
Member
blast-hardcheese
left a comment
There was a problem hiding this comment.
phenomenal. Pardon my delay on review, I've been quite sick over the past week.
I've adjusted this to be a major bump to make the release simpler. We've been on RC for over a year while the module system burned in, which ended up also scope creeping in my head to also improving the ergonomics for the client codegen, but I think it'll actually be both easier and more sensible to just release a revised client API with a standard deprecation cycle (interfaces annotated with @deprecated, 2.x to drop the deprecated client API)
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
ScalaVersionADT to represent target Scala version (2.12, 2.13, 3)Scala3Compatutility for generatingusingclauses instead ofimplicitfor Scala 3scalaVersionfield toContextfor version-aware code generationScala3Compat.implicitsClauseCloses #2188
Test plan
ScalaVersionparsing and behavior (16 tests)Scala3Compatclause generation (13 tests)usingfor Scala 3 (5 tests)usingfor Scala 3 (4 tests)Notes on Integration Testing
The current unit tests verify the AST structure contains correct
using/implicitsyntax based on Scala version. Full compilation-based integration testing (viamodules/sample-*) would require adding Scala 3 to the build infrastructure, as sample modules currently only compile with Scala 2.12/2.13.Options for future work:
sample-scala3module to validate compilationHappy to discuss the best approach for integration testing infrastructure.
Related PRs
scalaVersionparameter (pending)