|
[#210] |
project: compiler |
priority: medium |
category: bug |
|
submitter |
assigned to |
status |
date submitted |
|
Vincent |
Martin |
fixed |
2003-10-24 11:13:54.0 |
subject |
expression problem |
code |
trait Lang1 {
trait Exp;
trait Visitor { def f(left: Exp): unit; }
class Eval1: Visitor extends Visitor {
def f(left: Exp) = ();
}
}
trait Lang2 extends Lang1 {
class Eval2: Visitor extends Eval1;
}
object Main with Executable {
val lang2 = new Lang2 {};
val eval = new lang2.Eval2;
}
|
what happened |
At compile time:
bug11.scala:10: class Lang2.Eval2 needs to be abstract, since method f in trait Lang1.Visitor is not defined
class Eval2: Visitor extends Eval1;
^
|
what expected |
The class Eval2 does not need to be abstract because the method f is defined in its superclass Eval1, so no error is expected during compilation. What is also strange is that if we add the modifier abstract to the class, it is possible to create an instance without defining any field:
val eval = new lang2.Eval2 {}; |
[back to overview] |