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

REPL + -Ywarn-unused-import (or, since 2.12.2 -Xlint) = spurious "Unused import" warnings #7722

Open
scabug opened this issue Aug 6, 2013 · 8 comments
Assignees
Labels
Milestone

Comments

@scabug
Copy link

scabug commented Aug 6, 2013

Welcome to Scala version 2.11.0-M4 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0-ea).

scala> import java.util.ArrayList
<console>:7: warning: Unused import
       import java.util.ArrayList
                        ^

oh you silly REPL!

@scabug
Copy link
Author

scabug commented Aug 6, 2013

Imported From: https://issues.scala-lang.org/browse/SI-7722?orig=1
Reporter: @SethTisue
Affected Versions: 2.11.0-M4

@scabug
Copy link
Author

scabug commented Aug 6, 2013

@paulp said:
Yeah, the repl isn't real usable with -Xlint, unfortunately.

@scabug
Copy link
Author

scabug commented Aug 6, 2013

@SethTisue said:
I wouldn't normally intentionally fire up a REPL with -Xlint, fearing exactly this sort of thing, but I have -Xlint in my scalacOptions in my sbt project, and so that ends up applying to the REPL too when I run console.

@scabug
Copy link
Author

scabug commented Aug 6, 2013

@paulp said:
Yes, I have the same problem. I floundered around with "scalacOptions in console" type adjustments without managing to subtract it for the console individually. I imagine it's possible though.

@scabug
Copy link
Author

scabug commented Aug 6, 2013

@SethTisue said (edited on Aug 7, 2013 3:52:47 AM UTC):
after only a brief moment of thought, and without any Googling at all, and certainly not any consulting of any of Jason Zaugg's answers on Stack Overflow, I dashed this off and it worked on the first try:
set scalacOptions in (Compile, console) ~= (_.filterNot(_ == "-Xlint"))

signed, A. Liar

@scabug scabug added the repl label Apr 7, 2017
@scabug scabug added this to the Backlog milestone Apr 7, 2017
@SethTisue SethTisue changed the title 2.11 + -Ywarn-unused-import + REPL = spurious "Unused import" warnings REPL + -Ywarn-unused-import (or, since 2.12.2) -Xlint = spurious "Unused import" warnings Apr 19, 2017
@SethTisue
Copy link
Member

the severity here has increased now that since 2.12.2 -Ywarn-unused-import is part of -Xlint

@SethTisue SethTisue changed the title REPL + -Ywarn-unused-import (or, since 2.12.2) -Xlint = spurious "Unused import" warnings REPL + -Ywarn-unused-import (or, since 2.12.2 -Xlint) = spurious "Unused import" warnings Apr 19, 2017
@SethTisue
Copy link
Member

SethTisue commented Apr 19, 2017

LOL

% scala -Xlint
...
scala> :power
<console>:12: warning: Unused import
       import $r._
                                      ^
<console>:15: warning: Unused import
       import scala.tools.nsc._, scala.collection.JavaConverters._, intp.global.{ error => _, _ }, definitions.{ getClass => _, _ }, power.rutil._, replImplicits._, treedsl.CODE._
                              ^
<console>:15: warning: Unused import
       import scala.tools.nsc._, scala.collection.JavaConverters._, intp.global.{ error => _, _ }, definitions.{ getClass => _, _ }, power.rutil._, replImplicits._, treedsl.CODE._
                                                                 ^
<console>:15: warning: Unused import
       import scala.tools.nsc._, scala.collection.JavaConverters._, intp.global.{ error => _, _ }, definitions.{ getClass => _, _ }, power.rutil._, replImplicits._, treedsl.CODE._
                                                                                                                                ^
<console>:15: warning: Unused import
       import scala.tools.nsc._, scala.collection.JavaConverters._, intp.global.{ error => _, _ }, definitions.{ getClass => _, _ }, power.rutil._, replImplicits._, treedsl.CODE._
                                                                                                                                                 ^
<console>:15: warning: Unused import
       import scala.tools.nsc._, scala.collection.JavaConverters._, intp.global.{ error => _, _ }, definitions.{ getClass => _, _ }, power.rutil._, replImplicits._, treedsl.CODE._
                                                                                                                                                                  ^
<console>:15: warning: Unused import
       import scala.tools.nsc._, scala.collection.JavaConverters._, intp.global.{ error => _, _ }, definitions.{ getClass => _, _ }, power.rutil._, replImplicits._, treedsl.CODE._
                                                                                                                                                                                  ^```

@gmalouf
Copy link

gmalouf commented Nov 9, 2017

This also causes a large number of errors on play 2.6.7 (at least) - so I would be thrilled to see it fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants