Aladdin - Scala Bugtracking
[#608] project: compiler priority: low category: bug
submitter assigned to status date submitted
Nikolay Martin fixed 2006-05-18 18:24:19.0
subject [contrib #147] crash (Error) due to type error
code
// This code makes version 2.1.4 of scalac crash
// It's a simplified version of an attempt at making my encoding of lightweight PolyP
// extensible using a virtual class encoding -- the code isn't really meaningful anymore, but
// it's the simplest piece of code I've been able to construct that still exhibits the crash.
// There's a type error (due to the piece of code I commented out), but I'd prefer a nice 
// "types do not match" error over a long stack trace ;-)
trait CrashDueToTypeError {
	def id[a](x :a) :a = x

	trait Bifunctor {
		type a; //	 content 
		type s <: Bifunctor

		// uncomment        this-vvvvvvvvvvvvvvvvvvvvvvvvvvvv, and it compiles 
		def bimap[c](f :a=>c) :s{/*type s=Bifunctor.this.s;*/type a=c; }
	}

	def hylo[hs <: Bifunctor,ha,hb,hc]
	    (f :hb=>hs{type s=hs; type a=ha}, 
	     g :hs{type s=hs; type a=ha}=>hc)(x :hb) 
	     :hc 
	     = g(f(x).bimap(id))
}
what happened

Exception in thread "main" java.lang.Error
        at scala.tools.nsc.symtab.Symbols$NoSymbol$.owner(Symbols.scala:1070)
        at scala.tools.nsc.symtab.Types$$anonfun$26.apply(Types.scala:1502)
        at scala.tools.nsc.symtab.Types$$anonfun$26.apply(Types.scala:1500)
        at scala.List.forall(List.scala:823)
        at scala.tools.nsc.symtab.Types$class.isSubScope$0(Types.scala:1499)
        at scala.tools.nsc.symtab.Types$class.isSameType(Types.scala:1504)
        at scala.tools.nsc.symtab.SymbolTable.isSameType(SymbolTable.scala:10)
        at scala.tools.nsc.symtab.Types$Type.$eq$colon$eq(Types.scala:251)
        at scala.tools.nsc.symtab.Types$$anonfun$36.apply(Types.scala:1693)
        at scala.tools.nsc.symtab.Types$$anonfun$36.apply(Types.scala:1692)
        at scala.List$.forall2(List.scala:306)
        at scala.tools.nsc.symtab.Types$class.matchingParams(Types.scala:1692)
        at scala.tools.nsc.symtab.Types$class.isSubType0(Types.scala:1596)
        at scala.tools.nsc.symtab.SymbolTable.isSubType0(SymbolTable.scala:10)
        at scala.tools.nsc.symtab.Types$class.isSubType(Types.scala:1544)
        at scala.tools.nsc.symtab.SymbolTable.isSubType(SymbolTable.scala:10)
        at scala.tools.nsc.symtab.Types$Type.$less$colon$less(Types.scala:243)
        at scala.tools.nsc.symtab.Types$class.scala$tools$nsc$symtab$Types$$specializesSym(Types.scala:1662)
        at scala.tools.nsc.symtab.Types$$anonfun$35.apply(Types.scala:1654)
        at scala.tools.nsc.symtab.Types$$anonfun$35.apply(Types.scala:1654)
        at scala.List.exists(List.scala:839)
        at scala.tools.nsc.symtab.Types$class.specializesSym(Types.scala:1653)
        at scala.tools.nsc.symtab.SymbolTable.specializesSym(SymbolTable.scala:10)
        at scala.tools.nsc.symtab.Types$Type.specializes(Types.scala:257)
        at scala.tools.nsc.symtab.Types$$anonfun$31.apply(Types.scala:1613)
        at scala.tools.nsc.symtab.Types$$anonfun$31.apply(Types.scala:1613)
        at scala.List.forall(List.scala:823)
        at scala.tools.nsc.symtab.Types$class.isSubType0(Types.scala:1613)
        at scala.tools.nsc.symtab.SymbolTable.isSubType0(SymbolTable.scala:10)
        at scala.tools.nsc.symtab.Types$class.isSubType(Types.scala:1544)
        at scala.tools.nsc.symtab.SymbolTable.isSubType(SymbolTable.scala:10)
        at scala.tools.nsc.symtab.Types$Type.$less$colon$less(Types.scala:243)
        at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$inferView(Typers.s\
cala:61)
        at scala.tools.nsc.typechecker.Typers$Typer.inferView(Typers.scala:76)
        at scala.tools.nsc.typechecker.Typers$Typer.adaptToMember(Typers.scala:492)
        at scala.tools.nsc.typechecker.Typers$Typer.tryTypedApply$0(Typers.scala:1124)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:1509)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1625)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1655)
        at scala.tools.nsc.typechecker.Typers$Typer.transformedOrTyped(Typers.scala:1689)
        at scala.tools.nsc.typechecker.Typers$Typer.typedDefDef(Typers.scala:813)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:1304)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1625)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1651)
        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.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:1295)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1625)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1651)
        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.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:963)        
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:1291)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1625)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1651)
        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:285)
        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:429)
        at scala.tools.nsc.Global$Run.compile(Global.scala:487)
        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 message complaing about the type error (types do not match)
[back to overview]
Changes of this bug report
Nikolay  edited on  2006-05-18 18:25:00.0
Martin  edited on  2006-05-22 12:21:19.0