Uploaded image for project: 'Scala Programming Language'
  1. Scala Programming Language
  2. SI-5809

Spurious warning for implicit classes declared in package objects

    Details

      Description

      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.
      

        Attachments

          Activity

          Hide
          rytz Lukas Rytz added a comment -

          for the moment, just drop the warning for implicit classes and hope for the best

          Show
          rytz Lukas Rytz added a comment - for the moment, just drop the warning for implicit classes and hope for the best
          Hide
          extempore Paul Phillips added a comment -

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

          Show
          extempore Paul Phillips added a comment - I moved the warning behind -Xlint a while before this ticket was opened. I don't think there's anything left to do here.
          Hide
          apm A. P. Marki added a comment -

          "-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 SI-5760.

          Show
          apm A. P. Marki added a comment - "-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 SI-5760 .
          Hide
          rytz Lukas Rytz added a comment - - edited

          @paul ok, but the -Xlint warning is still wrong for implicit classes, they cannot be top-level.

          Show
          rytz Lukas Rytz added a comment - - edited @paul ok, but the -Xlint warning is still wrong for implicit classes, they cannot be top-level.
          Hide
          extempore Paul Phillips added a comment -

          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.

          Show
          extempore Paul Phillips added a comment - 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.
          Hide
          rytz Lukas Rytz added a comment -

          who could say no to a volunteer! thanks.

          Show
          rytz Lukas Rytz added a comment - who could say no to a volunteer! thanks.
          Hide
          extempore Paul Phillips added a comment -

          Fixed back in 006e12a119 .

          Show
          extempore Paul Phillips added a comment - Fixed back in 006e12a119 .

            People

            • Assignee:
              extempore Paul Phillips
              Reporter:
              burmako Eugene Burmako
            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: