-
Notifications
You must be signed in to change notification settings - Fork 1.1k
False positive warning: unused import with certain combination of generics #22971
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
Comments
This is due to caching the resolution of From the superclass context of A couple of notes to self or reminders: The trees don't distinguish whether the ident is due to implicit search or import. The comment at Scala 2 certainly transforms to a select:
or
This doesn't matter for Scala 2 Removing the |
Is there any plan to fix this and #22971 for 3.7.0 release? Both issues have PRs waiting for review. If this is not fixed, how can I make my project compile other than not using I did not find a way how to disable import warnings selectively, as I was not able to make Wconf match properly on the multiline message. |
@OndrejSpanel I think lint fixes will not be "backported" to the branch during RC at this point. Because it is "just a lint", the immediate issue is that Your other question about matching multiline messages will require some testing, but supposedly the Wconf expression is "just a regex". (Edit: the regex need match only a subsequence of the text, i.e., If you post your |
It seems the best expedient is I tried It doesn't like single backslash. Not sure what emits the message.
Here is a test of the regex.
which is
(I don't bother to escape all the dots.) It's probably worth exercising these different approaches to know what works or should work. I didn't try a "regular" build file. |
I am trying how to suppress: This works:
This does not:
When trying to match msg, this suppresses (but all unused imports):
This did not work:
It seems the message is actually only "unused import", not multiline as I assumed. As it does not contain the symbol name, it is impossible to match against it - at least this is how I understand it. I have tried finding some documentation. what I have found is Scala 2.13 one, but nothing for Scala 3, and the options seem to have changed, e.g. It seems the most accurate documentation is available by running |
Yes, the help text is vitally important and belongs somewhere accessible. Thanks for the trials. I got as far as noticing that the msg text doesn't include the error id, but what you say makes sense, the printed output just has the msg itself embedded. That explains it! I always start by blaming regex, especially after midnight. Oh, I see scala-cli allows
which is more convenient than I expected. |
Compiler version
3.7.0-RC1
3.7.0-RC2
Minimized code
Compile with
-Wunused:imports
:Output
Expectation
The code does not compile without the import, the warning should not be printed.
Note
The warning goes away when you remove the line
class Thing extends Entity[Class]
.The text was updated successfully, but these errors were encountered: