Skip to content

Compiler warnings with -Xsource:3.0 flag enabled #768

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

Closed
ghost opened this issue Feb 21, 2020 · 3 comments
Closed

Compiler warnings with -Xsource:3.0 flag enabled #768

ghost opened this issue Feb 21, 2020 · 3 comments

Comments

@ghost
Copy link

ghost commented Feb 21, 2020

I'm trying to compile with both the -Werror and -Xsource:3.0 compiler flags in preparation for Scala 3. However, the generated code gives warnings, which -Werror treats as errors. An example,

[warn] .../target/scala-2.13/src_managed/.../Color.scala: Auto-application to `()` is deprecated. Supply the empty argument list `()` explicitly to invoke method unary_!,
[warn] or remove the empty argument list from its definition (Java-defined methods are exempt)
[warn] In Scala 3, an unapplied method like this will be eta-expanded into a function.
[warn]   lazy val values = scala.collection.immutable.Seq(RED, GREEN, BLUE)

For the protobuf enum,

enum Color {
    RED = 0;
    GREEN = 1;
    BLUE = 2;
}

Versions,

addSbtPlugin("com.thesamet" % "sbt-protoc" % "0.99.27")
libraryDependencies += "com.thesamet.scalapb" %% "compilerplugin" % "0.10.0-M6"
@thesamet
Copy link
Contributor

I've tried enabling Xsource:3.0 and work through the warnings. I might be wrong, but my impression is that many of the warnings are spurious. I filed scala/bug#11889 and scala/bug#11890.

Given that the bugs reported are pretty obvious and Xsource:3.0 is rarely referenced online, I am suspecting this is not the best way to ensure source compatibility. Probably better just to try and compile with Scala 3.

BTW, what's the context of this Scala 3 preparation? Generally, you can always generate ScalaPB source code in a sub-project, compile in Scala 2 and depend on it from a Scala 3 project.

@thesamet
Copy link
Contributor

Based on https://gitter.im/lampepfl/dotty?at=5e510c533ca8a67fb80f4c82 I am closing this issue, as Xsource:3.0 doesn't provide adequate indication for Scala 3.0 compatibility. Happy to continue the discussion on how to achieve what you are trying to accomplish.

@ghost
Copy link
Author

ghost commented Feb 23, 2020

Based on https://gitter.im/lampepfl/dotty?at=5e510c533ca8a67fb80f4c82 I am closing this issue, as Xsource:3.0 doesn't provide adequate indication for Scala 3.0 compatibility. Happy to continue the discussion on how to achieve what you are trying to accomplish.

Sounds reasonable, thanks for looking into this!

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

1 participant