Aladdin - Scala Bugtracking
[#897] project: documentation priority: low category: bug
submitter assigned to status date submitted
Nikolay Philipp fixed 2007-01-16 16:37:29.0
subject [contrib #271] Invalid trait example
code
/* From ScalaTutorial.pdf dated November 23, 2006
   distributed with Scala compiler 2.3.0 */

abstract class Ord {
// ...
}

class Date(y: int, m: int, d: int) with Ord {
// ...
}
what happened
With above code

error: `extends' or `{' expected
class Date(y: int, m: int, d: int) with Ord {
                                   ^


After changing the above line to 
class Date(y: int, m: int, d: int) extends AnyRef with Ord

error: class Ord needs to be a trait be mixed in
class Date(y: int, m: int, d: int) extends AnyRef with Ord {
                                                       ^


After changing the definition of Ord to
trait Ord {

successful compilation
what expected That tutorial code compile successfully. I suspect the tutorial was written for an older version of the language and hasn't been updated.
[back to overview]
Changes of this bug report
Nikolay  edited on  2007-01-16 16:37:55.0
contribution #271
Stephane  edited on  2007-03-20 10:55:29.0
Closed long standing bug..