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

runtime/compile time reflection doesn't see all knownDirectSubclasses

    Details

      Description

      Unlike, say, annotations or flags, knownDirectSubclasses doesn't get auto-populated and requires a symbol to be pre-initialized to work correctly.

      import scala.reflect.runtime.universe._
      import scala.reflect.runtime.{currentMirror => cm}
       
      sealed class C
      class D extends C
      class E extends C
       
      object Test extends App {
        val c = cm.staticClass("C")
        println(c.knownDirectSubclasses)
        c.typeSignature
        println(c.knownDirectSubclasses)
      }
      

      19:43 ~/Projects/Kepler_7046/sandbox (ticket/7046)$ scalac Test.scala && scala Test
      Set()
      Set(class D, class E)
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                milessabin Miles Sabin
                Reporter:
                burmako Eugene Burmako
              • Votes:
                8 Vote for this issue
                Watchers:
                23 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: