summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/transform/Erasure.scala
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@gmail.com>2016-03-30 16:50:36 +0200
committerLukas Rytz <lukas.rytz@gmail.com>2016-03-30 20:43:24 +0200
commite4529ca2e0091ec137c791419ae08c8da8e0aecf (patch)
tree61ccdd7cbfdb7f85566bec2419f92f4aa91c3dbd /src/compiler/scala/tools/nsc/transform/Erasure.scala
parent952da60a5be15ef972b521bdaf5e650f7e0a5245 (diff)
downloadscala-e4529ca2e0091ec137c791419ae08c8da8e0aecf.tar.gz
scala-e4529ca2e0091ec137c791419ae08c8da8e0aecf.tar.bz2
scala-e4529ca2e0091ec137c791419ae08c8da8e0aecf.zip
SI-9702 Fix backend crash with classOf[T] annotation argument
This commit fixes various issues with classOf literals and Java annotations. - Ensure that a Type within a ConstantType (i.e., a classOf literal) is erased, so `classOf[List[Int]]` becomes `classOf[List]`. - Ensure that no non-erased types are passed to `typeToBType` in the backend. This happens for Java annotations: the annotation type and `classOf` annotation arguments are not erased, the annotationInfos of a symbol are not touched in the compiler pipeline. - If T is an alias to a value class, ensure that `classOf[T]` erases to the value class by calling `dealiasWiden` in erasure.
Diffstat (limited to 'src/compiler/scala/tools/nsc/transform/Erasure.scala')
-rw-r--r--src/compiler/scala/tools/nsc/transform/Erasure.scala2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/Erasure.scala b/src/compiler/scala/tools/nsc/transform/Erasure.scala
index 41f22e5669..ba15b01446 100644
--- a/src/compiler/scala/tools/nsc/transform/Erasure.scala
+++ b/src/compiler/scala/tools/nsc/transform/Erasure.scala
@@ -1112,7 +1112,7 @@ abstract class Erasure extends AddInterfaces
case Literal(ct) if ct.tag == ClazzTag
&& ct.typeValue.typeSymbol != definitions.UnitClass =>
- val erased = ct.typeValue match {
+ val erased = ct.typeValue.dealiasWiden match {
case tr @ TypeRef(_, clazz, _) if clazz.isDerivedValueClass => scalaErasure.eraseNormalClassRef(tr)
case tpe => specialScalaErasure(tpe)
}