Aladdin - Scala Bugtracking
[#786] project: compiler priority: low category: bug
submitter assigned to status date submitted
Sean Martin not repro 2006-10-23 16:36:16.0
subject pointless asInstanceOf = erasure NPE
code
package test;
object Test {
  def traverseWith(input : Any) : Unit = input match {
  case input : String => (input.asInstanceOf[String]);
  }
}
what happened
sean-mcdirmids-computer:~/workspace/test22/src mcdirmid$ ../../scala/build/quick/bin/scalac -sourcepath . -\
d ../bin/ test/Test.scala
Exception in thread "main" java.lang.NullPointerException
	at scala.tools.nsc.transform.Erasure$ErasureTransformer$$anon$2.transform(Erasure.scala:632)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$30.apply(Trees.scala:1118)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$30.apply(Trees.scala:1116)
	at scala.List$.loop$0(List.scala:238)
	at scala.List$.mapConserve(List.scala:255)
	at scala.tools.nsc.ast.Trees$Transformer.transformStats(Trees.scala:1116)
	at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:1040)
	at scala.tools.nsc.transform.Erasure$ErasureTransformer$$anon$2.transform(Erasure.scala:669)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$24.apply(Trees.scala:1102)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$24.apply(Trees.scala:1102)
	at scala.List$.loop$0(List.scala:238)
	at scala.List$.mapConserve(List.scala:255)
	at scala.tools.nsc.ast.Trees$Transformer.transformTrees(Trees.scala:1102)
	at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:1076)
	at scala.tools.nsc.transform.Erasure$ErasureTransformer$$anon$2.transform(Erasure.scala:669)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$30.apply(Trees.scala:1118)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$30.apply(Trees.scala:1116)
	at scala.List$.loop$0(List.scala:238)
	at scala.List$.mapConserve(List.scala:255)
	at scala.tools.nsc.ast.Trees$Transformer.transformStats(Trees.scala:1116)
	at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:1040)
	at scala.tools.nsc.transform.Erasure$ErasureTransformer$$anon$2.transform(Erasure.scala:669)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$24.apply(Trees.scala:1102)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$24.apply(Trees.scala:1102)
	at scala.List$.loop$0(List.scala:238)
	at scala.List$.mapConserve(List.scala:255)
	at scala.tools.nsc.ast.Trees$Transformer.transformTrees(Trees.scala:1102)
	at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:1076)
	at scala.tools.nsc.transform.Erasure$ErasureTransformer$$anon$2.transform(Erasure.scala:669)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$30.apply(Trees.scala:1118)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$30.apply(Trees.scala:1116)
	at scala.List$.loop$0(List.scala:238)
	at scala.List$.mapConserve(List.scala:255)
	at scala.tools.nsc.ast.Trees$Transformer.transformStats(Trees.scala:1116)
	at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:1040)
	at scala.tools.nsc.transform.Erasure$ErasureTransformer$$anon$2.transform(Erasure.scala:669)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$20.apply(Trees.scala:1019)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$20.apply(Trees.scala:1018)
	at scala.tools.nsc.ast.Trees$Transformer.atOwner(Trees.scala:1124)
	at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:1017)
	at scala.tools.nsc.transform.Erasure$ErasureTransformer$$anon$2.transform(Erasure.scala:665)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$30.apply(Trees.scala:1118)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$30.apply(Trees.scala:1116)
	at scala.List$.loop$0(List.scala:238)
	at scala.List$.mapConserve(List.scala:255)
	at scala.tools.nsc.ast.Trees$Transformer.transformStats(Trees.scala:1116)
	at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:1038)
	at scala.tools.nsc.transform.Erasure$ErasureTransformer$$anon$2.transform(Erasure.scala:669)
	at scala.tools.nsc.ast.Trees$Transformer.transformTemplate(Trees.scala:1104)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$17.apply(Trees.scala:1006)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$17.apply(Trees.scala:1005)
	at scala.tools.nsc.ast.Trees$Transformer.atOwner(Trees.scala:1124)
	at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:1004)
	at scala.tools.nsc.transform.Erasure$ErasureTransformer$$anon$2.transform(Erasure.scala:669)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$30.apply(Trees.scala:1118)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$30.apply(Trees.scala:1116)
	at scala.List$.loop$0(List.scala:238)
	at scala.List$.mapConserve(List.scala:255)
	at scala.tools.nsc.ast.Trees$Transformer.transformStats(Trees.scala:1116)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$16.apply(Trees.scala:1001)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$16.apply(Trees.scala:1001)
	at scala.tools.nsc.ast.Trees$Transformer.atOwner(Trees.scala:1124)
	at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:1000)
	at scala.tools.nsc.transform.Erasure$ErasureTransformer$$anon$2.transform(Erasure.scala:669)
	at scala.tools.nsc.transform.Erasure$ErasureTransformer.transform(Erasure.scala:678)
	at scala.tools.nsc.ast.Trees$Transformer.transformUnit(Trees.scala:1119)
	at scala.tools.nsc.transform.Transform$Phase.apply(Transform.scala:30)
	at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:218)
	at scala.tools.nsc.Global$GlobalPhase$$anonfun$1.apply(Global.scala:207)
	at scala.tools.nsc.Global$GlobalPhase$$anonfun$1.apply(Global.scala:207)
	at scala.Iterator$class.foreach(Iterator.scala:316)
	at scala.collection.mutable.ListBuffer$$anon$0.foreach(ListBuffer.scala:220)
	at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:207)
	at scala.tools.nsc.Global$Run.compileSources(Global.scala:472)
	at scala.tools.nsc.Global$Run.compile(Global.scala:541)
	at scala.tools.nsc.Main$.process(Main.scala:76)
	at scala.tools.nsc.Main$.main(Main.scala:98)
	at scala.tools.nsc.Main.main(Main.scala)
sean-mcdirmids-computer:~/workspace/test22/src mcdirmid$
what expected
[back to overview]
Changes of this bug report
Martin  edited on  2006-10-26 14:36:04.0