Aladdin - Scala Bugtracking
[#682] project: compiler priority: low category: bug
submitter assigned to status date submitted
Sean Martin fixed 2006-07-31 14:38:35.0
subject implicit def error message + hard to track down crash
code
package test;
import scala.collection.mutable._;
abstract class test {
  type S <: Si;
  trait Si;
  implicit def coerce(s : Si) = s.asInstanceOf[S]x;
  def foo (s : S) : Unit;
}
what happened
Error: recursive method coerce needs result type

Also, in a more complicated context (haven't been able to narrow this down), the above error will cause a crash:\


java.lang.NullPointerException
	at scala.tools.nsc.typechecker.Typers$Typer.searchImplicit$0(Typers.scala:1939)
	at scala.tools.nsc.typechecker.Typers$Typer.inferImplicit(Typers.scala:1959)
	at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$inferView(Typers.scala:66\
)
	at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:485)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1766)
	at scala.tools.nsc.typechecker.Typers$Typer.typedArg(Typers.scala:1028)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$51.apply(Typers.scala:1060)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$51.apply(Typers.scala:1059)
	at scala.List$.map2(List.scala:265)
	at scala.tools.nsc.typechecker.Typers$Typer.typedApply(Typers.scala:1059)
	at scala.tools.nsc.typechecker.Typers$Typer.tryTypedApply$0(Typers.scala:1220)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:1640)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1764)
	at scala.tools.nsc.typechecker.Typers$Typer.typedBlock(Typers.scala:897)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:1471)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1764)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1791)
	at scala.tools.nsc.typechecker.Typers$Typer.computeType(Typers.scala:1822)
	at scala.tools.nsc.typechecker.Namers$Namer.methodSig(Namers.scala:419)
	at scala.tools.nsc.typechecker.Namers$Namer.scala$tools$nsc$typechecker$Namers$Namer$$typeSig(Namers.scala:488)\

	at scala.tools.nsc.typechecker.Namers$Namer$$anon$0.complete(Namers.scala:310)
	at scala.tools.nsc.symtab.Symbols$Symbol.info(Symbols.scala:346)
	at scala.tools.nsc.symtab.Symbols$Symbol.initialize(Symbols.scala:423)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:1429)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1764)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1791)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$46.apply(Typers.scala:1004)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$46.apply(Typers.scala:994)
	at scala.List$.loop$0(List.scala:232)
	at scala.List$.mapConserve(List.scala:249)
	at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:994)
	at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:709)
	at scala.tools.nsc.typechecker.Typers$Typer.typedClassDef(Typers.scala:636)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:1438)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1764)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1791)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$46.apply(Typers.scala:1004)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$46.apply(Typers.scala:994)
	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.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:994)
	at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:709)
	at scala.tools.nsc.typechecker.Typers$Typer.typedClassDef(Typers.scala:636)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:1438)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1764)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1791)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$46.apply(Typers.scala:1004)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$46.apply(Typers.scala:994)
	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.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:994)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:1434)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1764)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1791)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$46.apply(Typers.scala:1004)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$46.apply(Typers.scala:994)
	at scala.List$.loop$0(List.scala:232)
	at scala.List$.mapConserve(List.scala:249)
	at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:994)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:1434)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1764)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1791)
	at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$1.apply(Analyzer.scala:38)
	at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:216)
	at scala.tools.nsc.Global$GlobalPhase$$anonfun$1.apply(Global.scala:205)
	at scala.tools.nsc.Global$GlobalPhase$$anonfun$1.apply(Global.scala:205)
	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:205)
	at scala.tools.nsc.Global$Run.compileSources(Global.scala:467)
	at scala.tools.nsc.Global$Run.compile(Global.scala:531)
However, I haven't been able to reproduce the crash in a small example yet.
what expected Better error message that is not misleading. No crashing.
[back to overview]
Changes of this bug report
Martin  edited on  2006-08-22 17:52:50.0
Fixed. this was a duplicate of bug 712.