|
[#1135] |
project: compiler |
priority: low |
category: bug |
|
submitter |
assigned to |
status |
date submitted |
|
Sean |
Martin |
open |
2007-05-23 12:47:12.0 |
subject |
separate compilation broken |
code |
// test/Foo.scala
package test
object Foo { def f = 10 }
//test/Bar.scala
package test
object Bar { def g = f :: Nil }
// after first compile, change test/Foo.scala to
package test
object Foo { def f = g }
|
what happened |
sean-mcdirmid:~/workspace/test13/src mcdirmid$ ../../scala/build/quick/bin/scalac test/Foo.scala test/Bar.scala \
sean-mcdirmid:~/workspace/test13/src mcdirmid$ ../../scala/build/quick/bin/scalac -d ../bin test/Foo.scala test/\
Bar.scala
sean-mcdirmid:~/workspace/test13/src mcdirmid$ ../../scala/build/quick/bin/scalac -d ../bin test/Foo.scala
sean-mcdirmid:~/workspace/test13/src mcdirmid$ ../../scala/build/quick/bin/scalac -d ../bin test/Bar.scala
sean-mcdirmid:~/workspace/test13/src mcdirmid$ ../../scala/build/quick/bin/scalac -d ../bin test/Foo.scala test/\
Bar.scala
test/Bar.scala:3: error: recursive method f needs result type
object Bar { def g = Foo.f :: Nil }
^
one error found
sean-mcdirmid:~/workspace/test13/src mcdirmid$
|
what expected |
After the first compile, change Foo.scala so that Foo.f = g, then recompile Foo.scala, then recompile Bar.scala. Expecting some kind of type error but none given, looking in the IDE, the type of g keeps growing to List[int] then List[List[int]] then List[List[List[int]]] and so on. Would expect some kind of type error. Error is only detected when Foo.scala and Bar.scala are compiled together, but the IDE isn't smart enough to know this, so in general it is impossible to know when files should always be compiled together. |
[back to overview] |