Getting the fields of case classes defined in an object enclosed in another object
I have two case classes defined as follows

    object Outer {
       case class OuterCase(outerParam: Int)
       object Inner {
          case class InnerCase(innerParam: Int)
       }
    }

and I would like to get the field names of their instances like this:

    import scala.tools.nsc.interpreter.ProductCompletion

    object EncapsulatedCase extends App {
       val outer = Outer.OuterCase(1)
       println("outer: " + new ProductCompletion(outer).caseNames)
       
       val inner = Outer.Inner.InnerCase(2)
       println("inner: " + new ProductCompletion(inner).caseNames)
    }

This works as expected for the object `outer`, but not for `inner`. Here is the output:

    outer: List(outerParam)
    inner: List()

The only difference I see is that class `InnerCase` is defined in an object itself defined in another object, whereas `OuterCase` is enclosed in only one object.

Why would that be a problem? Why can I get the parameter names of the `outer` but not the `inner` case object?

I observed this behavior with Scala 2.9.2.

Thank you!

Getting the fields of case classes defined in an object enclosed in another object
===

I have two case classes defined as follows

    object Outer {
       case class OuterCase(outerParam: Int)
       object Inner {
          case class InnerCase(innerParam: Int)
       }
    }

and I would like to get the field names of their instances like this:

    import scala.tools.nsc.interpreter.ProductCompletion

    object EncapsulatedCase extends App {
       val outer = Outer.OuterCase(1)
       println("outer: " + new ProductCompletion(outer).caseNames)
       
       val inner = Outer.Inner.InnerCase(2)
       println("inner: " + new ProductCompletion(inner).caseNames)
    }

This works as expected for the object `outer`, but not for `inner`. Here is the output:

    outer: List(outerParam)
    inner: List()

The only difference I see is that class `InnerCase` is defined in an object itself defined in another object, whereas `OuterCase` is enclosed in only one object.

Why would that be a problem? Why can I get the parameter names of the `outer` but not the `inner` case object?

I observed this behavior with Scala 2.9.2.

Thank you!
