-
Notifications
You must be signed in to change notification settings - Fork 21
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
surprising unused warnings due to for comprehension desugaring #10287
Comments
@lrytz did a nice grid at scala/scala#5402 (comment) It looks like there is a "fix me" in the test for this issue at scala/scala@bd28007 https://github.com/scala/scala/blob/2.12.x/test/files/neg/warn-unused-privates.scala#L188 |
In that example you linked, I think |
For the way it works now, mid-stream assignments introduce unused cruft. But the recent approach to suppressing warnings when a refutable pattern check is emitted might be applied in more places. There is no mechanism to track sym usage, let alone associate syms across a desugaring. Currently, it excludes all bindings in for exprs, without which:
Also, the comment on the test seems to be wrong, because |
This is not tagged as a regression, though arguably it should be (or at least in part) through #11175 which shows it regressed between 2.12.6 and 2.12.7 |
(Did the warning even exist before 2.12.7?) |
@martijnhoekstra @SethTisue I see this same bug in Scala 2.11.12, so it's not new in 2.12.7, unless it was fixed in an earlier Scala 2.12 version, and then re-introduced. |
Any update on this? Is it realistic to hope for this getting resolved in 2.12.* ? 🙏 |
@Habitats the |
@som-snytt does |
@kpodsiad it's awaiting a volunteer. nobody can forecast whether a volunteer will appear or not. |
So basically this isn't important enough to be prioritized? |
@Habitats after There is a chance something will be invented for Scala 3 that could be backported. The current implementation could be moved to a plugin and developed independently, if a volunteer volunteered. |
My problem with this is that I would love to crash the compiler for unused variables, but this totally bugs out in for-comprehensions, which means that we cannot use this potentially very nice flag as part of our CI check. Am I going at this the wrong way? 🤔 |
@Habitats see my previous comment, and please use one of the forums for user questions. |
or
|
" |
in 2.12.1 (and 2.11):
I get a warning that neither
a
norb
are used, although they are clearly used. No warning is issued fory
, which is indeed unused.In 2.12.2, no warnings are issued for
a
orb
(yay) ory
(boo). I acknowledge I may be doin' it wrong!Side note, I would love to be able omit
x
altogether and usewithout calling
.filter
, which is a bit scary to me.The text was updated successfully, but these errors were encountered: