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

Suppress Compiler Warnings (kernel) #4187

Closed
wants to merge 5 commits into from

Conversation

satorg
Copy link
Contributor

@satorg satorg commented Apr 16, 2022

This is an ongoing effort for suppressing compiler warnings that keep plaguing the project.

Suppresses the warnings in kernel* modules for all Scala versions.

johnynek
johnynek previously approved these changes Apr 16, 2022
Copy link
Contributor

@johnynek johnynek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the cleanup!

@satorg
Copy link
Contributor Author

satorg commented Apr 17, 2022

Seems there can be some issues with @nowarn("cat=unused-params") while upgrading to Scala 3.1.x versions (see discussion in http4s/http4s#6300 (review))

Perhaps, it may make sense to make use of val _ = someUnusedParam pattern in this PR as well...

@armanbilge
Copy link
Member

The other option is we continue to keep fatal warnings disabled on Scala 3 😕

@satorg
Copy link
Contributor Author

satorg commented Apr 17, 2022

I don't think it's going to help... Scala 3.0 silently ignores unused parameters along with any kind of @nowarn annotation. Whereas Scala 3.1 will be failing on @nowarn("cat=unused-params") anyway regardless of the fatal warnings option.

@satorg
Copy link
Contributor Author

satorg commented Apr 18, 2022

Added more thoughts on how to overcome the compatibility issue: http4s/http4s#6300 (comment)

I'm considering to take that approach, but sincerely open to discussion :)

@armanbilge armanbilge linked an issue May 7, 2022 that may be closed by this pull request
@satorg satorg force-pushed the suppress-warnings branch 2 times, most recently from aefb660 to dd60816 Compare May 14, 2022 01:17
@satorg satorg force-pushed the suppress-warnings branch 2 times, most recently from cf285b6 to 9838018 Compare May 27, 2022 08:25
@satorg satorg force-pushed the suppress-warnings branch 2 times, most recently from 852eca7 to 4d0f9a7 Compare June 2, 2022 02:30
@satorg satorg force-pushed the suppress-warnings branch 2 times, most recently from 9adfe9f to 04d1541 Compare June 12, 2022 08:20
@satorg
Copy link
Contributor Author

satorg commented Jun 17, 2022

Hi @armanbilge. I realized that warnings for Scala 2.12 for unused .. well, everything .. were suppressed entirely in sbt-typelevel:

      val warnings212 = Seq("-Xlint:-unused,_")

So.. I wonder – was it made intentionally and can we assume now that the warnings regarding unused stuff will never show up for Scala 2.12?

@armanbilge
Copy link
Member

Oh, interesting 😅 sbt-typelevel inherited those settings from sbt-spiewak which derived them from sbt-tpolecat. So probably intentional. In any case, it's what all the builds are using now, and many were using before too, so it probably works just fine.

@satorg
Copy link
Contributor Author

satorg commented Jun 17, 2022

That's fine... Just curious though – is it just because 2.12 is sunsetting and no one likes messing around with it? Or is it something more special...

@armanbilge
Copy link
Member

Here's the original commit. djspiewak/sbt-spiewak@95a45d0

@satorg
Copy link
Contributor Author

satorg commented Jun 17, 2022

Oh that's interesting... It was introduced even before Scala 2.13.0 was released. Seems like Daniel just didn't like that sort of warnings at all 😄

@satorg satorg force-pushed the suppress-warnings branch 2 times, most recently from d2d6a03 to 92ee266 Compare July 21, 2022 01:12
@satorg satorg force-pushed the suppress-warnings branch 3 times, most recently from 0747425 to 1783112 Compare August 29, 2022 17:44
@satorg satorg force-pushed the suppress-warnings branch 3 times, most recently from 6389bd4 to 66188ad Compare September 10, 2022 23:05
@armanbilge
Copy link
Member

@satorg I'm sorry, I haven't forgotten about this PR.

The truth is I've been hesitating, because I'm weighing what I think are fairly straightforward changes here with the fact it requires putting Cats on an sbt-typelevel milestone. There are some non-trivial changes coming to sbt-typelevel and I'd rather not have to worry about accidentally breaking the Cats build (the fact that Cats Effect is stuck on the milestone is stress enough!).

In theory we could backport your scalac warning fixes to sbt-tl 0.4.x. However if you're eager to work on that what I'd actually love help with is integrating with the scalac-options library for 0.5.x.

@satorg
Copy link
Contributor Author

satorg commented Sep 12, 2022

@armanbilge yeah, no worries. I also feel a bit hesitant about pushing this work out. Because before continuing it would be better to stabilize the build system itself.

However if you're eager to work on that what I'd actually love help with is integrating with the scalac-options library for 0.5.x.

Ah ok, I think I can help with that. Thanks.

@satorg satorg marked this pull request as draft September 16, 2022 05:20
@satorg
Copy link
Contributor Author

satorg commented Sep 16, 2022

Converted to "Draft" to put on hold until work on scalac compiler options is stabilized.

@som-snytt
Copy link

I arrived via good first issues [sic]. I know about options on Scala 2 and somewhat on Scala 3, and I generally endorse using -Xlint, also it's not "fatal warnings" but -Werror which I pronounce "worry". I'm interested in learning how cats can be supported by the options cross-compilation, but maybe you're already working out a solution.

@armanbilge
Copy link
Member

@satorg @som-snytt if there are folks motivated to work on this, I'm thinking we should just update Cats to the sbt-typelevel milestone to unblock this work.

In #4187 (comment) I was worried about too many changes happening in sbt-typelevel, but besides the Laika upgrade the other objectives have been dormant, and I don't think that they are going to land in 0.5 after all. That's okay 🙁

@satorg
Copy link
Contributor Author

satorg commented Mar 22, 2023

@armanbilge @som-snytt if I remember correctly, there are quite a few warnings that are handled differently in different Scala versions (i.e. 2.12, 2.13, 3). And that is what we tried to address with scalac-compat. I think, it could come handy for Cats too. Are we fine with bringing it in there?

@armanbilge
Copy link
Member

Yes, scalac-compat has been wonderful! We are using it in Cats Effect now as well.

@satorg
Copy link
Contributor Author

satorg commented Jun 8, 2024

scala/scala3#20536 (for reference)

@satorg
Copy link
Contributor Author

satorg commented Jun 9, 2024

Superseded by #4614.

@satorg satorg closed this Jun 9, 2024
@satorg satorg deleted the suppress-warnings branch June 9, 2024 19:15
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

Successfully merging this pull request may close these issues.

Clean out warnings from Dotty
5 participants