考虑以下代码(不可编译):
trait Entity {
type T <: Reality
def liveIn: Option[Class[_ <: Unit#T]]
}
abstract class World extends Entity {
def liveIn = None
}
class Universe extends World { type T = Real.type }
class ParallelUniverse extends World { type T = Unreal.type }
abstract class Humanoid {
def liveIn = Some(classOf[World#T])
}
class Human extends Humanoid { type T = Real.type }
class Alien extends Humanoid { type T = Unreal.type }
sealed trait Reality
case object Real extends Reality
case object Unreal extends Reality
是否可以在 Some(classOf[???]) 处推断或以某种方式隐式放置具体的类实例?