A.scala
// class Q
object A { val x = 3 }
B.scala
compile
- Uncomment line in
A.scala.
compile. Both sources are recompiled because Q introduces a change to the hash for <init> (in the compilation unit A.scala).
The underlying reason is that name hashing is tracking hashes for names at source file (compilation unit) level. The hash for <init> includes hashes for both A.<init> and Q.<init>. Therefore name hashing works well only when a member that is modified doesn't introduce any nested members. Therefore, it works for changes to val and def but not to class and object.