Same filename as another file causes duplicate object definition with clean builds
Migrated from http://lampsvn.epfl.ch/trac/scala/ticket/2931
Reporter ijuma
Steps to reproduce:
(1) Create two files:
src/test/BarFile.scala
(3) Notice error in problems view "Bar is already defined as object Bar". Also, no classfiles are compiled.
(4) Edit and save test/BarFile.scala
(5) Notice that classfiles are generated and the problems view shows no errors
Of course, in my environment the second BarFile was not in the same project (it was in a jar). Strangely, renaming test/BarFile.scala to test/Bar.scala fixes the problem.
Reporter ijuma
Steps to reproduce:
(1) Create two files:
src/test/BarFile.scala
package test
import test2.BarFile
object Bar {
def main(args: Array[String]) {
}
}
src/test2/BarFile.scalapackage test2
class BarFile {
}
(2) Do clean build(3) Notice error in problems view "Bar is already defined as object Bar". Also, no classfiles are compiled.
(4) Edit and save test/BarFile.scala
(5) Notice that classfiles are generated and the problems view shows no errors
Of course, in my environment the second BarFile was not in the same project (it was in a jar). Strangely, renaming test/BarFile.scala to test/Bar.scala fixes the problem.
Leave a comment
on 2010-01-20 09:53 *
By
Interesting! Do you see this with fsc as well?
on 2010-01-20 10:14 *
By tracImporter
Trac author: spiros
CC Change: sptz45@…
CC Change: sptz45@…
on 2010-01-20 10:54 *
By tracImporter
Trac author: ijuma
CC Change: mlists@…
fsc seems to work OK:
CC Change: mlists@…
fsc seems to work OK:
[ijuma@mac]% /opt/scala-2.8.0.Beta1-RC8/bin/fsc test/BarFile.scala test2/BarFile.scala
[ijuma@mac]%
on 2010-01-25 16:22 *
By tracImporter
Trac author: ijuma
Thanks! I am hoping that this will solve all the duplicate object/class definitions I'm seeing during clean builds (the workarounds for other cases were not as easy as the one I described in the creation comment). If not, I'll be back (on separate tickets). ;)
Thanks! I am hoping that this will solve all the duplicate object/class definitions I'm seeing during clean builds (the workarounds for other cases were not as easy as the one I described in the creation comment). If not, I'll be back (on separate tickets). ;)
on 2010-01-26 08:02 *
By tracImporter
Trac author: ijuma
I can confirm that clean builds now work for all the projects I have converted to 2.8 without introducing any errors. Excellent stuff!
I can confirm that clean builds now work for all the projects I have converted to 2.8 without introducing any errors. Excellent stuff!
on 2010-01-26 09:06 *
By
Thanks for the update.
on 2010-01-26 09:06 *
By tracImporter
Closed As: fixed