Given this issue and SI-7046 , this is not all that I expected.
scalac test.scala && scala Testin Scala 2.11.6, the following displays empty Set():
trait Foo
case class Bar() extends Foo
case class Baz() extends Foo
object Test {
def main(args: Array[String]) {
import scala.reflect.runtime.universe._
println( typeOf[Foo].typeSymbol.asClass.knownDirectSubclasses )
}
}
However, if I change trait Footo sealed trait Foo, it prints Set(class Bar, class Baz)as expected.
What's going on here?
source
share