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

Fatal Warning discarded non-unit value #1816

Open
rbscgh opened this issue Feb 7, 2025 · 1 comment
Open

Fatal Warning discarded non-unit value #1816

rbscgh opened this issue Feb 7, 2025 · 1 comment

Comments

@rbscgh
Copy link

rbscgh commented Feb 7, 2025

Hey folks my projects run with fatal warnings with Wvalue-discard and parseFrom uses builders which produce warning/errors under scala 3 like

[error] 226 |          _unknownFields__.parseField(tag, _input__)
[error]     |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error]     |discarded non-Unit value of type scala.collection.mutable.ReusableBuilder[
[error]     |  Long & (com.google.protobuf.ByteString & Int), Vector[Long] | (
[error]     |  Vector[com.google.protobuf.ByteString] | Vector[Int])]

on lines like

        case tag =>
          if (_unknownFields__ == null) {
            _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
          }
          _unknownFields__.parseField(tag, _input__)

i can silence the error like
scalacOptions ++= Seq("-Wconf:id=175:i,any:v")

but id rather not - anyone else faced this before ?

most likely adding something like

_unknownFields__.parseField(tag, _input__)
() // explicit unit

to the end of these generated builder calls would be the correct fix

@rbscgh rbscgh changed the title Fatal Warning non-discarded value Fatal Warning discarded non-unit value Feb 10, 2025
@rbscgh
Copy link
Author

rbscgh commented Feb 10, 2025

for example here

would need to be updated for all XValue types.. wdyt @thesamet ?

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