Pattern matching against type-member with Aux-pattern
问题 Consider: sealed trait A case object B extends A case object C extends A case object D extends A sealed trait Test { type AA <: A val aa: AA } object Test { type Aux[AAA <: A] = Test { type AA = AAA } } def compilesOk(t: Test) = t.aa match { case _: B.type => println("B") case _: C.type => println("C") case _: D.type => println("D") } def compileError(t: Test) = t.aa match { case B => println("B") case C => println("C") case D => println("D") } The compileError function fails to compile with