Aladdin - Scala Bugtracking
[#1014] project: compiler priority: low category: feature
submitter assigned to status date submitted
Iulian Martin fixed 2007-03-23 11:00:42.0
subject [contrib #388] apply implcit def to return types (relax overriding rules)
code
import scala.xml.{NodeSeq, Elem}

class EO extends Application with Moo{
  def cat = <cat>dog</cat>

  implicit def nodeSeqToFlog(in: Elem): Flog = new Flog(in)
}

trait Moo {
  def cat: Flog
}

class Flog(val in: NodeSeq)
what happened
Compiler error that Elem is not a Flog
what expected Apply nodeSeqToFlog to convert the Elem to a Flog without having to explicitly say def cat: Flog = <cat>dog</cat> The OP actually wants to have more relaxed rules for overriding, so that a method with an unrelated return type can still override, and let the compiler apply an implicit def to convert between the actual return type and the inherited one.
[back to overview]
Changes of this bug report
Iulian  edited on  2007-03-23 11:05:25.0
Stephane  edited on  2007-03-26 11:08:19.0
Fixed by Martin in rev 10504 (2007-03-23)