cake-pattern

Cake pattern with overriding abstract type don't work with Upper Type Bounds

帅比萌擦擦* 提交于 2019-11-27 05:09:29
I want to override abstract type in trait with <: and not with = (like answer here Scala Upper Bounds : value is not a member of type parameter ). I want to use cake pattern, but this doesn't work, i don't understand why ? trait A { def ping = println("ping") } trait Cake { type T } trait S { this: Cake => type T = A def t: T t.ping } OK, this example run, but in my real use case i want to override type with <: and not with = .It seems impossible to access the t function, why ? trait S { this: Cake => type T <: A def t: T t.ping } return an error value ping is not a member of S.this.T It's a