For me, the reason is that both myproject/src
and myproject/src/main/scala
are marked as Source. So IntelliJ failed to build myproject/src/main/scala
due to above errors. Unmark Source from myproject/src
(in IntelliJ, File->Project structure, select myproject Module, select src folder in Sources Tab, remove it from Source in the “Add Content Root” pane) solved the problem.