Compile:
// A.scala
object A {
private def foo: Int = 1
def bar: Int = 29
def xyz: Int = 101
}
// B.scala
class B {
private def foo: Int = 1
def baz(): Unit = println(foo, A.xyz)
}
Modify A.scala to become:
object A {
private def foo: String = "1"
def bar: String = "29"
def xyz: Int = 101
}
Compile again and notice that B.scala is recompiled. It's not expected because bar is not used by B.scala and foo is private.