I'm unclear on whether the following behavior is intentional. I suspect not.
Implicit members with public access are inherited by derived classes.
However, implicit members with *protected* access are not. Eh?
Below is a short script that illustrates the issue; or view the pastie at
http://pastie.textmate.org/private/hvbx0rwsery92y2b6knlxg// This compiles fine:
trait WithImplicit {
implicit val t = "foo"
def showme(implicit t: String) = Console.println(t)
}
object WithInheritedImplicit extends WithImplicit {
showme
}
WithInheritedImplicit
// The following does not; the only change is the
// addition of the "protected" modifier.
trait WithImplicit {
protected implicit val t = "foo"
def showme(implicit t: String) = Console.println(t)
}
object WithInheritedImplicit extends WithImplicit {
showme
}
WithInheritedImplicit