summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-05-08 00:04:21 -0700
committerPaul Phillips <paulp@improving.org>2012-05-08 00:06:38 -0700
commit8e88e5b214ab365a268ab6bd6e53c4aa657ec5d0 (patch)
treee8518a929d16f6d161cb242af7ae71aca496a5e5
parente982596149800f14a8a122f1f1a3540b95af7411 (diff)
downloadscala-8e88e5b214ab365a268ab6bd6e53c4aa657ec5d0.tar.gz
scala-8e88e5b214ab365a268ab6bd6e53c4aa657ec5d0.tar.bz2
scala-8e88e5b214ab365a268ab6bd6e53c4aa657ec5d0.zip
Fix for aliasing bug in reifier.
Closes SI-5769.
-rw-r--r--src/compiler/scala/reflect/reify/package.scala19
-rw-r--r--test/files/pos/t5769.scala8
2 files changed, 18 insertions, 9 deletions
diff --git a/src/compiler/scala/reflect/reify/package.scala b/src/compiler/scala/reflect/reify/package.scala
index f3040ad79c..a096e2e93b 100644
--- a/src/compiler/scala/reflect/reify/package.scala
+++ b/src/compiler/scala/reflect/reify/package.scala
@@ -43,15 +43,16 @@ package object reify {
case (_, success) if !success.isEmpty =>
gen.mkMethodCall(arrayElementClassMethod, List(success))
case _ =>
- if (tpe.typeSymbol == ArrayClass) {
- val componentTpe = tpe.typeArguments(0)
- val componentErasure = reifyErasure(global)(typer0, componentTpe, concrete)
- gen.mkMethodCall(arrayClassMethod, List(componentErasure))
- } else {
- if (tpe.isSpliceable && concrete) throw new ReificationError(enclosingMacroPosition, "tpe %s is an unresolved spliceable type".format(tpe))
- var erasure = tpe.erasure
- if (tpe.typeSymbol.isDerivedValueClass && global.phase.id < global.currentRun.erasurePhase.id) erasure = tpe
- gen.mkNullaryCall(Predef_classOf, List(erasure))
+ tpe.normalize match {
+ case TypeRef(_, ArrayClass, componentTpe :: Nil) =>
+ val componentErasure = reifyErasure(global)(typer0, componentTpe, concrete)
+ gen.mkMethodCall(arrayClassMethod, List(componentErasure))
+ case _ =>
+ if (tpe.isSpliceable && concrete)
+ throw new ReificationError(enclosingMacroPosition, "tpe %s is an unresolved spliceable type".format(tpe))
+ var erasure = tpe.erasure
+ if (tpe.typeSymbol.isDerivedValueClass && global.phase.id < global.currentRun.erasurePhase.id) erasure = tpe
+ gen.mkNullaryCall(Predef_classOf, List(erasure))
}
}
}
diff --git a/test/files/pos/t5769.scala b/test/files/pos/t5769.scala
new file mode 100644
index 0000000000..723d37bfee
--- /dev/null
+++ b/test/files/pos/t5769.scala
@@ -0,0 +1,8 @@
+// a.scala
+
+class A {
+ type AI = Array[Int]
+
+ def f1 = arrayTag[Array[Int]]
+ def f2 = arrayTag[AI]
+} \ No newline at end of file