Aladdin - Scala Bugtracking
[#870] project: compiler priority: low category: bug
submitter assigned to status date submitted
Sean Martin noise 2006-12-17 16:33:25.0
subject another null loophole
code
trait HasNodeXXX {
  def xxx : Node = null;
  type Node <: NodeImpl;
  implicit def coerce(n : NodeImpl) : Node =
    if (n == null) null else n.self;
  trait NodeImpl { def self : Node; }
}
what happened
Compiles.
what expected Should cause type errors as if coerce is not implicit:
type mismatch;
found   : scala.Null(null)
required: HasNodeXXX.this.Node	lampion/src/lampion/core	HasNodeXXX.scala	line 3	
type mismatch;
found   : scala.Null(null)
required: HasNodeXXX.this.Node	lampion/src/lampion/core	HasNodeXXX.scala	line 6
[back to overview]
Changes of this bug report
Sean  edited on  2006-12-18 14:08:52.0
Found out coerce is being called recursively to coerce null into Node.