Aladdin - Scala Bugtracking
[#1066] project: documentation priority: low category: bug
submitter assigned to status date submitted
Nikolay Martin fixed 2007-04-24 10:16:34.0
subject [contrib #444] illegal code in two Language Spec examples
code
Section 5.1 talks about "with ScalaObject" being added implicitly. This may be confusing as mentioning  "with ScalaObject" explicitly, as in the example code below, leads to compile errors:-


Example 5.1.3  (without the "..." )
abstract class AbsIterator extends AnyRef with ScalaObject {  }

The code is rejected by the compiler:-

:30: error: trait ScalaObject is inherited twice
abstract class AbsIterator extends AnyRef with ScalaObject {  }
                                               ^
:30: error: trait ScalaObject is inherited twice
abstract class AbsIterator extends AnyRef with ScalaObject {  }
                           ^
two errors found



"
Example 5.1.6 Consider the class definitions
class A { def f: Int = 1 ; def g: Int = 2 ; def h: Int = 3 }
abstract class B { def f: Int = 4 ; def g: Int }
abstract class C extends A with B { def h: Int }
"

"trait B" is needed instead of "abstract class B"

The current code is rejected by the compiler:-

error: class B needs to be a trait be mixed in
abstract class C extends A with B { def h: Int }
                                ^
one error found
what happened
what expected
[back to overview]
Changes of this bug report
Nikolay  edited on  2007-04-24 10:31:52.0
contribution #444
Martin  edited on  2007-04-29 16:57:10.0