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

isPackage returns true for package classes

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: Scala 2.10.0-RC2
    • Fix Version/s: None
    • Component/s: Reflection
    • Labels:
      None

      Description

      The API docs say that isPackage should imply isTerm, which makes sense. However, in 2.10-RC2, isPackage returns true for both packages and package classes, which are not terms.

      Example repro code:

      import scala.tools.nsc
      val compiler = new nsc.Global(new nsc.Settings)
      new compiler.Run
      val sp = compiler.definitions.ScalaPackageClass
       
      println("isPackageClass: " + sp.isPackageClass)
      println("isPackage: " + sp.isPackage)
      println("isTerm: " + sp.isTerm)
      

      This prints:

      isPackageClass: true
      isPackage: true
      isTerm: false
      

      Something should give. In my opinion, the public API docs make more sense than the current behavior, so change the implementation. Have isPackage return false for package classes.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                burmako Eugene Burmako
                Reporter:
                lexspoon Lex Spoon
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated: