scala / bug

Scala 2 bug reports only. Please, no questions — proper bug reports only.
https://scala-lang.org
232 stars 21 forks source link

Assertion error on compilation #742

Closed scabug closed 13 years ago

scabug commented 16 years ago

The following program throws an Assertion Error on compilation (both with 2.7.0-final and with 2.7.1.RC1).

object Crash {
    class Zero
    class Succ[T]

    type mul[m[n[s[_], z], z], n[s[_], z], s[_], z] = m[n, z]
    type _1[s[_], z] = s[z]
    type p = mul[_1, _1, Succ, Zero] 
}
scabug commented 16 years ago

Imported From: https://issues.scala-lang.org/browse/SI-742?orig=1 Reporter: Michael (michid)

scabug commented 16 years ago

@odersky said: It looks like a higher-kinded type problem. Reassigning to Adriaan.

scabug commented 15 years ago

@odersky said: Milestone next_bugfix deleted

scabug commented 15 years ago

@paulp said: 16 months later, extempore determines this is essentially a duplicate of #653. Similar code and same assertion failing, anyway.

scabug commented 14 years ago

michid4 said: Reopening since on RC-3 this seems to break again:

java.util.NoSuchElementException: head of empty list at scala.collection.immutable.Nil$$.head(List.scala:387) at scala.collection.immutable.Nil$$.head(List.scala:384) at scala.tools.nsc.symtab.Types$$SubstMap.subst(Types.scala:3224) at scala.tools.nsc.symtab.Types$$SubstMap.subst(Types.scala:3225) at scala.tools.nsc.symtab.Types$$SubstMap.apply(Types.scala:3260) at scala.tools.nsc.symtab.Types$$SubstMap.apply(Types.scala:3211) at scala.tools.nsc.symtab.Types$$TypeMap$$$$anonfun$$mapOverArgs$$1.apply(Types.scala:2916) at scala.tools.nsc.symtab.Types$$TypeMap$$$$anonfun$$mapOverArgs$$1.apply(Types.scala:2912) at scala.tools.nsc.symtab.Types$$class.map2Conserve(Types.scala:4604) at scala.tools.nsc.symtab.SymbolTable.map2Conserve(SymbolTable.scala:13) at scala.tools.nsc.symtab.Types$$TypeMap.mapOverArgs(Types.scala:2912) at scala.tools.nsc.symtab.Types$$TypeMap.mapOver(Types.scala:2822) at scala.tools.nsc.symtab.Types$$SubstMap.apply(Types.scala:3245) at scala.tools.nsc.symtab.Types$$Type.subst(Types.scala:535) at scala.tools.nsc.symtab.Types$$Type.instantiateTypeParams(Types.scala:396) at scala.tools.nsc.symtab.Types$$TypeRef.instantiateTypeParams(Types.scala:1709) at scala.tools.nsc.symtab.Types$$TypeRef.transform(Types.scala:1618) at scala.tools.nsc.symtab.Types$$TypeRef.normalize0(Types.scala:1729) at scala.tools.nsc.symtab.Types$$TypeRef.normalize(Types.scala:1761) at scala.tools.nsc.symtab.Types$$TypeRef.normalize0(Types.scala:1731) at scala.tools.nsc.symtab.Types$$TypeRef.normalize(Types.scala:1761) at scala.tools.nsc.symtab.Types$$TypeRef.normalize0(Types.scala:1731) at scala.tools.nsc.symtab.Types$$TypeRef.normalize(Types.scala:1761) at scala.tools.nsc.typechecker.Typers$$Typer.gd9$$1(Typers.scala:781) at scala.tools.nsc.typechecker.Typers$$Typer.adapt(Typers.scala:767) at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:4051) at scala.tools.nsc.typechecker.Typers$$Typer.typedType(Typers.scala:4140) at scala.tools.nsc.typechecker.Typers$$Typer.typedType(Typers.scala:4143) at scala.tools.nsc.typechecker.Namers$$Namer.typeDefSig(Namers.scala:1059) at scala.tools.nsc.typechecker.Namers$$Namer.typeSig(Namers.scala:1182) at scala.tools.nsc.typechecker.Namers$$Namer$$$$anonfun$$typeCompleter$$1.apply(Namers.scala:517) at scala.tools.nsc.typechecker.Namers$$Namer$$$$anonfun$$typeCompleter$$1.apply(Namers.scala:515) at scala.tools.nsc.typechecker.Namers$$$$anon$$1.complete(Namers.scala:1338) at scala.tools.nsc.typechecker.Namers$$$$anon$$1.complete(Namers.scala:1336) at scala.tools.nsc.symtab.Symbols$$Symbol.info(Symbols.scala:743) at scala.tools.nsc.symtab.Symbols$$Symbol.initialize(Symbols.scala:855) at scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:3688) at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:4046) at scala.tools.nsc.typechecker.Typers$$Typer.typedStat$$1(Typers.scala:2035) at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$20.apply(Typers.scala:2103) at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$20.apply(Typers.scala:2103) at scala.collection.immutable.List.loop$$1(List.scala:115) at scala.collection.immutable.List.mapConserve(List.scala:132) at scala.collection.immutable.List.loop$$1(List.scala:119) at scala.collection.immutable.List.mapConserve(List.scala:132) at scala.collection.immutable.List.loop$$1(List.scala:119) at scala.collection.immutable.List.mapConserve(List.scala:132) at scala.collection.immutable.List.loop$$1(List.scala:119) at scala.collection.immutable.List.mapConserve(List.scala:132) at scala.collection.immutable.List.loop$$1(List.scala:119) at scala.collection.immutable.List.mapConserve(List.scala:132) at scala.tools.nsc.typechecker.Typers$$Typer.typedStats(Typers.scala:2103) at scala.tools.nsc.typechecker.Typers$$Typer.typedTemplate(Typers.scala:1503) at scala.tools.nsc.typechecker.Typers$$Typer.typedModuleDef(Typers.scala:1308) at scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:3704) at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:4046) at scala.tools.nsc.typechecker.Typers$$Typer.typedStat$$1(Typers.scala:2035) at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$20.apply(Typers.scala:2103) at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$20.apply(Typers.scala:2103) at scala.collection.immutable.List.loop$$1(List.scala:115) at scala.collection.immutable.List.mapConserve(List.scala:132) at scala.tools.nsc.typechecker.Typers$$Typer.typedStats(Typers.scala:2103) at scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:3697) at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:4046) at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:4094) at scala.tools.nsc.typechecker.Analyzer$$typerFactory$$$$anon$$3.apply(Analyzer.scala:85) at scala.tools.nsc.Global$$GlobalPhase$$$$anonfun$$applyPhase$$1.apply(Global.scala:276) at scala.tools.nsc.Global$$GlobalPhase$$$$anonfun$$applyPhase$$1.apply(Global.scala:276) at scala.tools.nsc.reporters.Reporter.withSource(Reporter.scala:48) at scala.tools.nsc.Global$$GlobalPhase.applyPhase(Global.scala:276) at scala.tools.nsc.typechecker.Analyzer$$typerFactory$$$$anon$$3$$$$anonfun$$run$$1.apply(Analyzer.scala:80) at scala.tools.nsc.typechecker.Analyzer$$typerFactory$$$$anon$$3$$$$anonfun$$run$$1.apply(Analyzer.scala:80) at scala.collection.Iterator$$class.foreach(Iterator.scala:631) at scala.collection.mutable.ListBuffer$$$$anon$$1.foreach(ListBuffer.scala:304) at scala.tools.nsc.typechecker.Analyzer$$typerFactory$$$$anon$$3.run(Analyzer.scala:80) at scala.tools.nsc.Global$$Run.compileSources(Global.scala:733) at scala.tools.nsc.Global$$Run.compileFiles(Global.scala:803) at scala.tools.nsc.interactive.RefinedBuildManager.update0$$1(RefinedBuildManager.scala:123) at scala.tools.nsc.interactive.RefinedBuildManager.update(RefinedBuildManager.scala:182) at scala.tools.nsc.interactive.RefinedBuildManager.update(RefinedBuildManager.scala:92) at scala.tools.eclipse.EclipseBuildManager.build(EclipseBuildManager.scala:119) at scala.tools.eclipse.ScalaProject.build(ScalaProject.scala:421) at scala.tools.eclipse.ScalaBuilder.build(ScalaBuilder.scala:87) at org.eclipse.core.internal.events.BuildManager$$2.run(BuildManager.java:627) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:170) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:201) at org.eclipse.core.internal.events.BuildManager$$1.run(BuildManager.java:253) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:256) at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:309) at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:341) at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:140) at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:238) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

scabug commented 14 years ago

@adriaanm said: (In r22518) closes #742. be more resilient to evil, ill-kinded type applications, so we don't crash (subst assumes from.length == to.length), and get to actually telling off the user for writing those nasty, nasty types

review by extempore