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

Spurious warning for implicit classes declared in package objects #5809

Closed
scabug opened this issue May 20, 2012 · 8 comments
Closed

Spurious warning for implicit classes declared in package objects #5809

scabug opened this issue May 20, 2012 · 8 comments

Comments

@scabug
Copy link

scabug commented May 20, 2012

package scala.reflect

package object api {
  implicit class PimpedExpr[T](expr: Universe # Expr[T]) {
    def runtimeEval: T = {
      println("hello, dear")
      expr.eval
    }
  }
}
Eval.scala:4: warning: it is not recommended to define classes/objects inside of package objects.
If possible, define class PimpedExpr in package api instead.
@scabug
Copy link
Author

scabug commented May 20, 2012

Imported From: https://issues.scala-lang.org/browse/SI-5809?orig=1
Reporter: @xeno-by
Affected Versions: 2.10.0-M3

@scabug
Copy link
Author

scabug commented May 22, 2012

@lrytz said:
for the moment, just drop the warning for implicit classes and hope for the best

@scabug
Copy link
Author

scabug commented May 22, 2012

@paulp said:
I moved the warning behind -Xlint a while before this ticket was opened. I don't think there's anything left to do here.

@scabug
Copy link
Author

scabug commented May 22, 2012

@som-snytt said:
"-Xlint would have told you not to do that".

I didn't want to be the first to comment. That was a couple of hours before I opened #5760.

@scabug
Copy link
Author

scabug commented May 23, 2012

@lrytz said (edited on May 23, 2012 2:47:37 PM UTC):
@paul ok, but the -Xlint warning is still wrong for implicit classes, they cannot be top-level.

@scabug
Copy link
Author

scabug commented May 23, 2012

@paulp said:
Right, that's true. I think I was subconsciously taking the position that imperfections in -Xlint output are "trees falling in a forest" but one never knows. If you assign this to me I'll fix it, or it's all yours.

@scabug
Copy link
Author

scabug commented May 23, 2012

@lrytz said:
who could say no to a volunteer! thanks.

@scabug
Copy link
Author

scabug commented Sep 21, 2012

@paulp said:
Fixed back in 006e12a119 .

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

2 participants