|
[#86] |
project: compiler |
priority: medium |
category: bug |
|
submitter |
assigned to |
status |
date submitted |
|
Philippe |
Martin |
fixed |
2003-08-12 18:07:42.0 |
subject |
can't create anonymous class with empty body |
code |
trait Foo();
object foo {
new Foo();
new Foo(){};
new Foo(){0};
}
|
what happened |
tmp/test.scala:4: trait Foo is abstract, so it cannot be instantiated
new Foo();
^
tmp/test.scala:5: trait Foo is abstract, so it cannot be instantiated
new Foo(){};
^
|
what expected |
The first error is correct, but I think that the second one is wrong. The new should be accepted. Currently it is rejected because its tree is indistinguishable from the one generated for the first new. To solve this, we could change the parser, so that for the second new, it returns a template whose body contains one Empty tree.
|
[back to overview] |