Aladdin - Scala Bugtracking
[#642] project: compiler priority: low category: bug
submitter assigned to status date submitted
Lex Martin won't fix 2006-06-26 14:13:07.0
subject source files with differently named classes
code
what happened
   [scalac] Compiling 49 source files to /home/lex/eclipse/workspace/scala-analysis/build/classes
   [scalac] /home/lex/eclipse/workspace/scala-analysis/src/scala/analysis/ddp/goals/responders/RespondersGoalSet\
.scala:18 error: source file /home/lex/eclipse/workspace/scala-analysis/src/scala/analysis/codebase/InstructionR\
ef.scala does not define class InstructionRef
   [scalac]   type Question = InstructionRef
   [scalac]                   ^
what expected

The statement is correct, but why is this an error? Do Scala source files really need to be named with the exact name as their contents?

Also strangely, the way I compile matters. Using scalac from the command-line it does not matter, but the ant scalac task generates the above message, and Eclipse cannot seem to open the project.

I plan to eventually rename all the files, just to make it easier on future human readers, but it seems like this should not be a compiler error.

[back to overview]
Changes of this bug report
Martin  edited on  2006-06-26 16:31:36.0
The compiler only complains if file A needs class B, B.class is not available yet B.scala is. In that case it requires that B.scala defines a class B. Bottom line: You can name your files anyway you like, but if class names and file names don't match, you need to compile all files manually; late source loading will not work.