How can I fix this code :
trait A[A,B]{
def f(a:A):B
}
trait B[A,B]{
def g(a:A):B
}
type C = A[String,Int] with B[String,Double]
//works fine
new A[String,Int] with B[String,Double] {
def f(a:String):Int = 1
def g(a:String):Double = 2.0
}
//error
new C {
def f(a:String):Int = 1
def g(a:String):Double = 2.0
}
The exception i got is :
Error:(41, 6) class type required but A$A42.this.A[String,Int] with A$A42.this.B[String,Double] found
new C {
^
Any Idea how to solve that and what is the reason for that ?
Cas a trait instead of a type alias :trait C extends A[String,Int] with B[String,Double].trait Aandtrait B.