Scala Programming Language
  1. Scala Programming Language
  2. SI-6225

Implicit value instances of inner class defined in superclass of package object don't resolve on import

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: Scala 2.10.0-M1, Scala 2.10.0-M6
    • Fix Version/s: Scala 2.10.2-RC1
    • Component/s: Compiler Backend
    • Environment:

      Description

      Compiling the following three files together results in the compile error suggesting that val foo can't be found (presumably because it doesn't think its type is the same type as the type library.x.Foo it's looking for). Defining class Foo outside of class X allows it to be found.

      This worked as desired in Scala 2.9.1.

      // lib.scala
      package library.x
      class X {
        class Foo
        implicit val foo = new Foo
      }
      
      // package.scala
      package library
      package object x extends X
      
      // app.scala
      package app
      import library.x._
      object App { implicitly[Foo] }
      
      
      error: could not find implicit value for parameter e: library.x.Foo
        implicitly[Foo]
                  ^
      one error found
      

        Activity

        Hide
        Jon Pretty added a comment -

        In my haste, I missed a newline in the code in the initial comment. Here is a single source file which demonstrates the problem.

        Show
        Jon Pretty added a comment - In my haste, I missed a newline in the code in the initial comment. Here is a single source file which demonstrates the problem.
        Show
        Jason Zaugg added a comment - https://github.com/scala/scala/pull/2098

          People

          • Assignee:
            Jason Zaugg
            Reporter:
            Jon Pretty
          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development