Skip to content
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

Support Scala 3.4 type wildcards #1662

Closed
saeltz opened this issue Mar 15, 2024 · 2 comments
Closed

Support Scala 3.4 type wildcards #1662

saeltz opened this issue Mar 15, 2024 · 2 comments

Comments

@saeltz
Copy link
Contributor

saeltz commented Mar 15, 2024

ScalaPB works just fine up to Scala 3.3.3. Yesterday, I was hunting down a bug in Chimney (scalalandio/chimney#479) and wanted to check if it still exists in Scala 3.4.

After updating my branch to Scala 3.4 compiling the tests started failing because some protos are compiled into Scala as well. Scala 3.4 deprecated the underscore syntax for type wildcards (scala/scala3#18813). With fatal warnings enabled, one gets the warnings below:

[error] -- Error: /teleproto/target/scala-3.4.0/src_managed/test/scalapb/io/moia/migration/migration/V3.scala:71:106 
[error] 71 |  def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber)
[error]    |                                                                                                          ^
[error]    |`_` is deprecated for wildcard arguments of types: use `?` instead
[error]    |This construct can be rewritten automatically under -rewrite -source 3.4-migration.

The rewrite isn't an option here since we're talking about target files.

Do you have plans to fix this issue? I don't fell comfortable disabling fatal warnings.

@thesamet
Copy link
Contributor

Please search for scala3_sources at https://scalapb.github.io/docs/customizations/ - the option is available as a generator parameter or package option.

@saeltz
Copy link
Contributor Author

saeltz commented Mar 16, 2024

Thanks! I totally missed that configuration option. Solved it via scalapb.gen(scala3Sources = true).

@saeltz saeltz closed this as completed Mar 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants