| [#231] | project: compiler | priority: high | category: bug | |
|---|---|---|---|---|
| submitter | assigned to | status | date submitted | |
| Michel | Martin | fixed | 2003-11-19 15:02:59.0 | |
| subject | Type of separately compiled nested modules not correct | |||
| code |
// file O1.scala
package toto;
object O1 {
object O2 {
def f(x: Int): Int = x+1;
}
}
// file bug.scala
import toto._;
object Main with Executable {
System.out.println(toto.O1.O2.f(5));
}
|
|||
| what happened | If compiled together, these two files produce correct code. If |
|||
| what expected | Same behaviour with and without separate compilation. I'm actually pretty sure I know the source of the bug. RefCheck.scala currently contains the following line in function transformModule:
sym.updateInfo(Type.PolyType(Symbol.EMPTY_ARRAY, sym.type()));This correctly changes the type of the value representing a nested module when its tree is transformed. However, such changes should be done in transformInfo, otherwise they are not applied when the file is compiled separately, and that's precisely the problem here. |
|||
| [back to overview] | ||||
| Martin edited on 2003-11-20 14:21:42.0 |