[#309] | project: compiler | priority: low | category: bug | |
---|---|---|---|---|
submitter | assigned to | status | date submitted | |
Erik | Martin | fixed | 2004-03-15 17:10:48.0 | |
subject | Strange scoping | |||
code |
object Test with Application { object o { val a = 42; } Console.println(a); { import o.a; Console.println(a); } val a = 5; } object Test2 with Application { object o { val a = 42; } Console.println(a); val a = 5; { import o.a; Console.println(a); } } |
|||
what happened | The object Test compiles fine, but Test2 gives the error: test.scala:9: reference to a is ambiguous; it is both defined in object class Test and imported subsequently by import Test.this.o.{a} Console.println(a); ^ one error found |
|||
what expected | That either both fail or none of them fail since the scope of a should contain the inner block in both cases. | |||
[back to overview] |
Martin edited on 2004-04-18 14:05:39.0 |
Now they both give errors, as they should. |