Skip to content

Implicit and hiding warnings interact #9850

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

Closed
scabug opened this issue Jul 8, 2016 · 2 comments
Closed

Implicit and hiding warnings interact #9850

scabug opened this issue Jul 8, 2016 · 2 comments

Comments

@scabug
Copy link

scabug commented Jul 8, 2016

From a test. You don't see the warning that the import is not respected because of the implicit error; unless you uncomment the other import and implicitly.

If errors suppress warnings, then it would be nice if there were a way to always display warnings, for example, under -Xfatal-warnings.

case class K(s: java.lang.String)
class C { implicit val k: K = K("OK?"); override def toString = "C(" + k.toString + ")" }

object Test extends App {
  // uncomment to show the warning
  //import concurrent.ExecutionContext.Implicits._
  //def x = implicitly[concurrent.ExecutionContext]
  val c = new C
  import c.k
  def g = implicitly[K]
  val k = 42
}
@scabug
Copy link
Author

scabug commented Jul 8, 2016

Imported From: https://issues.scala-lang.org/browse/SI-9850?orig=1
Reporter: @som-snytt
Affected Versions: 2.12.0-M5

@scabug scabug added this to the Backlog milestone Apr 7, 2017
@som-snytt
Copy link

The warning in question was

warning: imported `k` is permanently hidden by definition of value k in object

which is dubious and pertains to earlier bugs in implicit search.

The -Wunused import is always warned.

Scala 3 doesn't have lexical hiding of implicits.

@som-snytt som-snytt closed this as not planned Won't fix, can't repro, duplicate, stale Apr 26, 2025
@SethTisue SethTisue removed this from the Backlog milestone May 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants