Aladdin - Scala Bugtracking
[#588] project: compiler priority: medium category: bug
submitter assigned to status date submitted
Sean Martin fixed 2006-05-07 19:00:35.0
subject [contrib #144] looks like an erasure problem.
code
trait Test {
  type TypeA <: TraitA;
  type TypeB <: TypeA with TraitB;
  
  def f(node : TypeA) : Unit;
  def f(brac : TypeB) : Unit;
  
  trait TraitA;
  trait TraitB;
  
}
what happened
scala.tools.nsc.symtab.Types$TypeError: method f is defined twice
	at scala.tools.nsc.typechecker.Contexts$Context.error(Contexts.scala:194)
	at scala.tools.nsc.typechecker.Typers$Typer.reportTypeError(Typers.scala:140)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1635)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1653)
	at scala.tools.nsc.transform.Erasure$ErasureTransformer$$anonfun$23.apply(Erasure.scala:616)
	at scala.tools.nsc.transform.Erasure$ErasureTransformer$$anonfun$23.apply(Erasure.scala:613)
	at scala.tools.nsc.symtab.SymbolTable.atPhase(SymbolTable.scala:41)
	at scala.tools.nsc.transform.Erasure$ErasureTransformer.transform(Erasure.scala:613)
	at scala.tools.nsc.ast.Trees$Transformer.transformUnit(Trees.scala:1039)
	at scala.tools.nsc.transform.Transform$Phase.apply(Transform.scala:22)
	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 ch.epfl.lamp.sdt.build.ScalaCompilerManager$ScalaCompiler.compile(ScalaCompilerManager.java:186)
	at ch.epfl.lamp.sdt.build.ScalaProjectBuilder.build(ScalaProjectBuilder.java:76)
	at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:603)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:167)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:201)
	at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:230)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:233)
	at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:252)
	at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:285)
	at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:145)
	at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:208)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)
what expected
[back to overview]
Changes of this bug report
Sean  edited on  2006-05-07 19:01:23.0
Sean  edited on  2006-05-07 19:11:08.0
Found simple bug. Better classification.
Sean  edited on  2006-05-07 21:21:38.0
Hmm, seems like there isn't much checking to ensure overloading is performed correctly with respect to erasure, e.g., I just ran into the same crash with: def visit(f : (Node) => Unit) : Unit = {...} def visit(f : (Node) => Boolean) : Unit = {...}
Martin  edited on  2006-05-08 10:29:05.0