clamp down on warnings in library project#8998
clamp down on warnings in library project#8998SethTisue wants to merge 4 commits intoscala:2.13.xfrom
Conversation
565b57a to
94412e0
Compare
| Compile / scalacOptions ++= Seq[String]("-sourcepath", (Compile / scalaSource).value.toString), | ||
| Compile / scalacOptions += "-Xlint:-deprecation,-inaccessible,-nonlocal-return,-valpattern,-doc-detached,_", | ||
| Compile / scalacOptions ++= Seq("-sourcepath", (Compile / scalaSource).value.toString), | ||
| Compile / scalacOptions ++= Seq("-feature", "-Xlint", "-Werror"), |
There was a problem hiding this comment.
Some multi-arg warnings remain. Adolescent quarantine meme: https://www.youtube.com/watch?v=SbjAltHJRHY
Not sure about the no-warn suppresses nothing. We need @nowarn @nowarn(cat=...) to keep nowarn from warning.
There was a problem hiding this comment.
weird, I didn't get the warnings/errors locally. I'll figure it out.
|
last commit is red in CI with errors I'm not seeing locally. I'll look into it UPDATE: oh, I think it's because locally the compiler is 2.13.2, whereas on CI we build & use a newer compiler ( |
|
some of the warnings are about |
and from here the plot thickens, as follows going warning-free both bootstrapped and non-bootstrapped is a bit tricky, in two different situations, both of which I hit in this PR:
maybe a more elegant solution exists for either or both of these. the workaround I found for the first problem isn't too bad, but the workaround for the second is a bit more gruesome perhaps this is an argument for only enabling |
| /** Adds a new key/value pair to this map and returns the map. */ | ||
| @annotation.nowarn | ||
| // TODO: after next re-STARR, fix the nowarn (here and in LongMap) to be more specific: | ||
| // @annotation.nowarn("cat=lint-multiarg-infix") // scala/bug#12012 |
There was a problem hiding this comment.
@nowarn("cat=dog": @nowarn)! Otherwise, I think we just live with the build noise.
Also this one doesn't show up in the PR that deprecates them. The lint is hidden by the deprecation? Even if the deprecation is only summarized?
| // have the blanket @nowarn, but then also intentionally put something warnable in. So that's | ||
| // what this is doing here. After next re-STARR, we can remove this, and then also change the | ||
| // @nowarn above to be more specific: @annotation.nowarn("cat=lint-unit-specialization") | ||
| 0 |
There was a problem hiding this comment.
That's pretty baroque. Sorry, I see this is a draft beer. Is it easier and more blankety to suppress all "suppresses nothing" warnings in build.sbt, then remove that after restarr? Does anyone else miss season one of american idol? Ryan Starr is the same age as Kelly Clarkson.
| * process exits with a non-zero value, the LazyList will provide all lines up | ||
| * to termination but will not throw an exception. | ||
| */ | ||
| @annotation.nowarn("cat=lint-multiarg-infix") // should the warning trigger just because the method name ends in punctuation?! currently it does |
There was a problem hiding this comment.
I was thinking that crazyLines_: is a suspicious name but actually multiargs is of course only for left-assoc:
log crazyLines_: builder
Maybe nothing about id_op suggests infix.
There was a problem hiding this comment.
BTW the other hope was that a warning would hasten its exit to a module.
|
This is really near the top of my queue again — looking forward to finishing it off. |
|
@SethTisue are you okay with me stealing this? |
absolutely I was just discussing this with Dale recently. we were thinking:
wdyt? |
I've done this at work. It's fairly easy to have a
another options might be to configure warnings for |
There's
IMO: let's not bite off more than we can chew, let's start with just fatal warnings for non-bootstrapped and try the even stricter "and for bootstrapped" variant after a few months. |
|
I don't understand what's the problem with bootstrap. Can someone elaborate? |
|
As you're making changes to warnings it can be annoying for individual commits to fail to bootstrap the compiler because of a slightly wrong warning, which IMO could prove more friction than value. As an example the changes to REPL.scala in |
|
Hum, I would typically squash such commits, in the same way that I would squash a commit that fixes a bug introduced in the same PR. |
|
And maybe that's a fine compromise/workaround (I see it as arguable IMO, as it's useful to keep some diffs separate). I'm just saying let's take the half step first, as I've found it exhausting to work with very strict warnings-as-errors (e.g. fatal unused imports in the REPL...). |
I have no idea how to only enable fatal warnings for non-bootstrapped builds, so doing so is actually significantly harder for me |
Sorry,
Yeah, I understand, and if it's better to land a version of this PR even without that - I don't want it to block the progress. I'm still learning myself (part of the reason I built the I think the presence of |
after my work on cleaning up warnings, I think I actually disagree with this. it's a real pain for errors to suddenly appear much later than they were introduced, simply because they don't fail without bootstrapping |
how do you suggest we handle the difficulties I described in May? |
I don't personally think having |
|
okay, we have a plan, then! (and also, we can adjust further, later, based on experience) |
|
@som-snytt is there a category for I can use instead of that message? |
|
A nullifying category would be handy. I've only joked about the idiom to nowarn nowarn. (I'm afraid of notifying someone; I wonder if it's too late to register github user |
That experience mirrors our users: new compiler (for us: new starr), new warnings. The other side of the coin is the pain for errors to appear while you're making changes in the compiler, like an unused warning or a partial pattern match: should compilation fail (disallowing a test run) because of those, in the non-bootstrapped build? I'm happy to test out your's and Seth's plan, however. 🎲 |
|
Oh, btw, @NthPortal, I'm hoping my exhaustivity checking PR is merged soon, with the idea that with your PRs we'll opt-out of the warnings to avoid them being fatal - so as to not burden you with dealing with them all. If you want to deal with them, go ahead, otherwise I'll eventually rotate back and do it. |
|
it does appear there is |
|
I forgot that I don't think I ever read it all the way to the end; it's sitting on my night table underneath a couple of novels. |
|
superseded by #9235 |
and use -Wconf to prevent them from coming back