Aladdin - Scala Bugtracking
[#591] project: compiler priority: low category: bug
submitter assigned to status date submitted
Sean Martin fixed 2006-05-09 16:29:55.0
subject head of empty list when overloading assignment with private var of same name
code
abstract class BaseList {
  type Node <: BaseNode;
  
  
  abstract class BaseNode {
    protected def self : Node;
    private[BaseList] def self00 = self;
    def dirty : Unit = {}
    def replaceWith(node : Node) = {}
  }
  
  implicit def baseNode2Node(bnode : BaseNode): Node = bnode.self00;

 
}


trait BaseFlow extends BaseList {
  type Node <: BFNode;
  type Flow <: FlowBase;
  type Output <: OutputBase;
  type  Input <:  InputBase;
  
  abstract class FlowBase {
    
  }
  trait OutputBase extends FlowBase {
    
  }
  trait  InputBase extends FlowBase {
    
  }
  
  trait BFNode extends BaseNode {
    private var  input : Input  = null;
    private var output : Output = null;
    
    def input_=(in : Input) = {}
    
  }
}
what happened
bash-3.00$ ~/runtime-workspace/scala/dists/latest/bin/scalac -sourcepath . test/Test.scala 
Exception in thread "main" java.lang.Error: head of empty list
        at scala.Predef$.error(Predef.scala:159)
        at scala.Nil$.head(List.scala:1084)
        at scala.Nil$.head(List.scala:1082)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$19.apply(Typers.scala:663)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$19.apply(Typers.scala:660)
        at scala.tools.nsc.ast.Trees$class.DefDef(Trees.scala:252)
        at scala.tools.nsc.Global.DefDef(Global.scala:31)
        at scala.tools.nsc.typechecker.Typers$Typer.setterDef$0(Typers.scala:660)
        at scala.tools.nsc.typechecker.Typers$Typer.addGetterSetter(Typers.scala:665)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$22.apply(Typers.scala:687)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$22.apply(Typers.scala:687)
        at scala.List.flatMap(List.scala:921)
        at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:687)
        at scala.tools.nsc.typechecker.Typers$Typer.typedClassDef(Typers.scala:625)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:1298)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1627)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1653)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$45.apply(Typers.scala:973)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$45.apply(Typers.scala:963)
        at scala.List$.loop$0(List.scala:232)
        at scala.List$.mapConserve(List.scala:249)
        at scala.List$.loop$0(List.scala:236)
        at scala.List$.mapConserve(List.scala:249)
        at scala.List$.loop$0(List.scala:236)
        at scala.List$.mapConserve(List.scala:249)
        at scala.List$.loop$0(List.scala:236)
        at scala.List$.mapConserve(List.scala:249)
        at scala.List$.loop$0(List.scala:236)
        at scala.List$.mapConserve(List.scala:249)
        at scala.List$.loop$0(List.scala:236)
        at scala.List$.mapConserve(List.scala:249)
        at scala.List$.loop$0(List.scala:236)
        at scala.List$.mapConserve(List.scala:249)
        at scala.List$.loop$0(List.scala:236)
        at scala.List$.mapConserve(List.scala:249)
        at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:963)
        at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:687)
        at scala.tools.nsc.typechecker.Typers$Typer.typedClassDef(Typers.scala:625)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:1298)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1627)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1653)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$45.apply(Typers.scala:973)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$45.apply(Typers.scala:963)
        at scala.List$.loop$0(List.scala:232)
        at scala.List$.mapConserve(List.scala:249)
        at scala.List$.loop$0(List.scala:236)
        at scala.List$.mapConserve(List.scala:249)
        at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:963)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:1294)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1627)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1653)
        at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$1.apply(Analyzer.scala:38)
        at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:210)
        at scala.tools.nsc.Global$GlobalPhase$$anonfun$1.apply(Global.scala:199)
        at scala.tools.nsc.Global$GlobalPhase$$anonfun$1.apply(Global.scala:199)
        at scala.Iterator$class.foreach(Iterator.scala:304)
        at scala.collection.mutable.ListBuffer$$anon$0.foreach(ListBuffer.scala:216)
        at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:199)
        at scala.tools.nsc.Global$Run.compileSources(Global.scala:436)
        at scala.tools.nsc.Global$Run.compile(Global.scala:494)
        at scala.tools.nsc.Main$.process(Main.scala:60)
        at scala.tools.nsc.Main$.main(Main.scala:82)
        at scala.tools.nsc.Main.main(Main.scala)
what expected I think there might be an error in my code, that I shouldn't be defining input_=, but I'm not sure. Anyways, it shouldn't crash :)
[back to overview]
Changes of this bug report
Martin  edited on  2006-05-16 13:44:30.0
It is indeed a double definitions of input_=