twitter/scala_school — Issue #19: Overloading methods example raises exception using scala 2.9.1
Author: fourk
Created: 2012-02-11 23:20:28+00:00
State: open

Using scala 2.9.1 and sbt 0.11.2, the example with the title 'Overloading methods' on basics section does not work as documented.

scala> class ScientificCalculator(brand: String) extends Calculator(brand) {
| def log(m: Double, base: Double) = math.log(m) / math.log(base)
| }
defined class ScientificCalculator

scala> class EvenMoreScientificCalculator(brand: String) extends ScientificCalculator(brand) {
| def log(m: Int) = log(m, math.exp(1))
| }
:10: error: overloaded method log needs result type
def log(m: Int) = log(m, math.exp(1))