Open
Description
When the access and the definition are compiled separately, Scala lets this one pass. When compiled together, it issues an error:
// file a.scala
package core.test
protected object Exec {
def isBool: Boolean = false
}
// file b.scala
package bar
import core.test._
class Test {
Exec.isBool // Exec should not be visible here
}
Compiling these two together gives the expected error:
visibility2.scala:6: error: not found: value Exec
Exec.isBool // Exec should not be visible here
^
one error found
Compiling one and then the other succeeds, though:
$ scalac -d /tmp/classes/ a.scala
$ scalac -d /tmp/classes/ -cp /tmp/classes/ b.scala
$
Scala version: 2.12.8