Consider this:
object TypeProblem {
trait A {
type T
val set = Set[T]()
}
trait B {
def b()
}
trait FooBad { this: A =>
type T <: B
def x {
set.foreach(_.b())
}
}
trait FooOk { this: A =>
type MyT <: B
type T = MyT
def x {
set.foreach(_.b())
}
}
}
The compiler complains that value b is not a member of FooBad.this.T So why does FooOk work where I define a new type MyT and assigning T to MyT?
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)