У меня есть следующий исходный код:
abstract class Foo{
}
object Foo{
def foo(f : String) = println(f)
}
object Tester extends App{
class Bar extends Foo
val b = new Bar()
Bar.foo("bar")
}
Когда я пытаюсь запустить его с помощью sbt, я получаю сообщение об ошибке:
Foo.scala:9:5: not found: value Bar
[error] Bar.foo("bar") // this line won't compile...
[error] ^
[error] one error found
[error] (Compile / compileIncremental) Compilation failed
[error] Total time: 0 s, completed Mar 12, 2020 10:29:49 AM
Почему я не могу сослаться даже на Bar хотя я объявил это как класс в приложении.