Open
Description
Currently, scalac reports a single error when the same class is compiled twice. Consider the following input:
// foo.scala
object Main
object Main
Running scalac reports
$ scalac foo.scala
foo.scala:2: error: Main is already defined as object Main
object Main
^
one error found
I expected scalac to report two errors
foo.scala:2: error: Main is already defined as object Main
object Main
^
+ foo.scala:1: error: Main is already defined as object Main
+ object Main
+ ^
- one error found
+ two errors found
This situation where the same class is defined twice can happen frequently in IDEs like Metals where users copy-paste a source file, example scalameta/metals#1027.