|
[#784] |
project: compiler |
priority: medium |
category: bug |
|
submitter |
assigned to |
status |
date submitted |
|
Martin |
Burak |
fixed |
2006-10-20 15:12:52.0 |
subject |
trees with null types generated by pattern matcher |
code |
class A {
def compareTo [a, b >: List[a]](y: b) = y match {
case y1: List[a1] => y1.asInstanceOf[List[a]]
}
}
|
what happened |
java.lang.AssertionError: assertion failed: temp0.asInstanceOf$erased[scala.List[a1]]().asInstanceOf[scala.List[\
a]]()
at scala.Predef$.assert(Predef.scala:92)
at scala.tools.nsc.transform.Erasure$ErasureTransformer$$anon$2.transform(Erasure.scala:632)
at scala.tools.nsc.ast.Trees$Transformer$$anonfun$20.apply(Trees.scala:1076)
at scala.tools.nsc.ast.Trees$Transformer$$anonfun$20.apply(Trees.scala:1076)
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:1076)
at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:1050)
at scala.tools.nsc.transform.Erasure$ErasureTransformer$$anon$2.transform(Erasure.scala:670)
at scala.tools.nsc.ast.Trees$Transformer$$anonfun$26.apply(Trees.scala:1092)
at scala.tools.nsc.ast.Trees$Transformer$$anonfun$26.apply(Trees.scala:1090)
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:1090)
at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:1014)
at scala.tools.nsc.transform.Erasure$ErasureTransformer$$anon$2.transform(Erasure.scala:670)
at scala.tools.nsc.ast.Trees$Transformer$$anonfun$20.apply(Trees.scala:1076)
at scala.tools.nsc.ast.Trees$Transformer$$anonfun$20.apply(Trees.scala:1076)
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:1076)
at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:1050)
at scala.tools.nsc.transform.Erasure$ErasureTransformer$$anon$2.transform(Erasure.scala:670)
at scala.tools.nsc.ast.Trees$Transformer$$anonfun$26.apply(Trees.scala:1092)
at scala.tools.nsc.ast.Trees$Transformer$$anonfun$26.apply(Trees.scala:1090)
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:1090)
at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:1014)
at scala.tools.nsc.transform.Erasure$ErasureTransformer$$anon$2.transform(Erasure.scala:670)
at scala.tools.nsc.ast.Trees$Transformer$$anonfun$16.apply(Trees.scala:993)
at scala.tools.nsc.ast.Trees$Transformer$$anonfun$16.apply(Trees.scala:992)
at scala.tools.nsc.ast.Trees$Transformer.atOwner(Trees.scala:1098)
at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:991)
at scala.tools.nsc.transform.Erasure$ErasureTransformer$$anon$2.transform(Erasure.scala:666)
at scala.tools.nsc.ast.Trees$Transformer$$anonfun$26.apply(Trees.scala:1092)
at scala.tools.nsc.ast.Trees$Transformer$$anonfun$26.apply(Trees.scala:1090)
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:1090)
at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:1012)
at scala.tools.nsc.transform.Erasure$ErasureTransformer$$anon$2.transform(Erasure.scala:670)
at scala.tools.nsc.ast.Trees$Transformer.transformTemplate(Trees.scala:1078)
at scala.tools.nsc.ast.Trees$Transformer$$anonfun$13.apply(Trees.scala:980)
at scala.tools.nsc.ast.Trees$Transformer$$anonfun$13.apply(Trees.scala:979)
at scala.tools.nsc.ast.Trees$Transformer.atOwner(Trees.scala:1098)
at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:978)
at scala.tools.nsc.transform.Erasure$ErasureTransformer$$anon$2.transform(Erasure.scala:670)
at scala.tools.nsc.ast.Trees$Transformer$$anonfun$26.apply(Trees.scala:1092)
at scala.tools.nsc.ast.Trees$Transformer$$anonfun$26.apply(Trees.scala:1090)
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:1090)
at scala.tools.nsc.ast.Trees$Transformer$$anonfun$12.apply(Trees.scala:975)
at scala.tools.nsc.ast.Trees$Transformer$$anonfun$12.apply(Trees.scala:975)
at scala.tools.nsc.ast.Trees$Transformer.atOwner(Trees.scala:1098)
at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:974)
at scala.tools.nsc.transform.Erasure$ErasureTransformer$$anon$2.transform(Erasure.scala:670)
at scala.tools.nsc.transform.Erasure$ErasureTransformer.transform(Erasure.scala:679)
at scala.tools.nsc.ast.Trees$Transformer.transformUnit(Trees.scala:1093)
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)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at scala.tools.nsc.ObjectRunner$.run(ObjectRunner.scala:74)
at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:96)
at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)
/home/odersky/scala/test/files/new>
|
what expected |
The problem is that an asInstanceOf$erased in the pettern matching code
has a `null' type. This has probably to do with the change to typed patterns.
Note that the List[a1] pattern is represented as follows:
AppliedTypeTree("List", Bind("a1", EmptyTree))
whereas before it was
AppliedTypeTree("List", Ident("a1"))
Note that the same problem causes test/files/pos/viewtest2 to fail. |
[back to overview] |