summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2014-04-14 10:45:17 +0200
committerJason Zaugg <jzaugg@gmail.com>2014-04-14 14:04:42 +0200
commit540535f71e2b4141db9294b8c2b053319a216084 (patch)
tree1a85417cb053aca7662981f65474fd54a4affd66
parent470a51285b686b0f0e0149d1741f76b03ecab310 (diff)
downloadscala-540535f71e2b4141db9294b8c2b053319a216084.tar.gz
scala-540535f71e2b4141db9294b8c2b053319a216084.tar.bz2
scala-540535f71e2b4141db9294b8c2b053319a216084.zip
SI-8497 Fix regression in pickling of AnnotatedTypes
Fixes an inconsistency introduced in these two spots: https://github.com/scala/scala/pull/3033/files#diff-6ce1a17ebee31068f41c36a8a2b3bc9aR79 https://github.com/scala/scala/pull/3033/files#diff-c455cb229f5227b1bcaa1544478fe3acR452 The bug shows up when pickling then unpickling an AnnotatedType that has only non-static annotations.
-rw-r--r--src/reflect/scala/reflect/internal/pickling/Translations.scala31
-rw-r--r--test/files/pos/t8497/A_1.scala13
-rw-r--r--test/files/pos/t8497/B_2.scala1
3 files changed, 30 insertions, 15 deletions
diff --git a/src/reflect/scala/reflect/internal/pickling/Translations.scala b/src/reflect/scala/reflect/internal/pickling/Translations.scala
index e56cf796cb..d924cb3a0c 100644
--- a/src/reflect/scala/reflect/internal/pickling/Translations.scala
+++ b/src/reflect/scala/reflect/internal/pickling/Translations.scala
@@ -62,21 +62,22 @@ trait Translations {
}
def picklerTag(tpe: Type): Int = tpe match {
- case NoType => NOtpe
- case NoPrefix => NOPREFIXtpe
- case _: ThisType => THIStpe
- case _: SingleType => SINGLEtpe
- case _: SuperType => SUPERtpe
- case _: ConstantType => CONSTANTtpe
- case _: TypeBounds => TYPEBOUNDStpe
- case _: TypeRef => TYPEREFtpe
- case _: RefinedType => REFINEDtpe
- case _: ClassInfoType => CLASSINFOtpe
- case _: MethodType => METHODtpe
- case _: PolyType => POLYtpe
- case _: NullaryMethodType => POLYtpe // bad juju, distinct ints are not at a premium!
- case _: ExistentialType => EXISTENTIALtpe
- case _: AnnotatedType => ANNOTATEDtpe
+ case NoType => NOtpe
+ case NoPrefix => NOPREFIXtpe
+ case _: ThisType => THIStpe
+ case _: SingleType => SINGLEtpe
+ case _: SuperType => SUPERtpe
+ case _: ConstantType => CONSTANTtpe
+ case _: TypeBounds => TYPEBOUNDStpe
+ case _: TypeRef => TYPEREFtpe
+ case _: RefinedType => REFINEDtpe
+ case _: ClassInfoType => CLASSINFOtpe
+ case _: MethodType => METHODtpe
+ case _: PolyType => POLYtpe
+ case _: NullaryMethodType => POLYtpe // bad juju, distinct ints are not at a premium!
+ case _: ExistentialType => EXISTENTIALtpe
+ case StaticallyAnnotatedType(_, _) => ANNOTATEDtpe
+ case _: AnnotatedType => picklerTag(tpe.underlying)
}
def picklerSubTag(tree: Tree): Int = tree match {
diff --git a/test/files/pos/t8497/A_1.scala b/test/files/pos/t8497/A_1.scala
new file mode 100644
index 0000000000..6a76b0ee99
--- /dev/null
+++ b/test/files/pos/t8497/A_1.scala
@@ -0,0 +1,13 @@
+package p {
+ object Crash {
+ def e(s: (String @java.lang.Deprecated)): Unit = ()
+ def f(s: (String @nonStatic)): Unit = ()
+ }
+ object Ok {
+ def g(s: (String @nonStatic @static)): Unit = ()
+ def h(s: (String @static)): Unit = ()
+ }
+}
+
+class nonStatic extends scala.annotation.Annotation
+class static extends scala.annotation.StaticAnnotation
diff --git a/test/files/pos/t8497/B_2.scala b/test/files/pos/t8497/B_2.scala
new file mode 100644
index 0000000000..efe2edf2c3
--- /dev/null
+++ b/test/files/pos/t8497/B_2.scala
@@ -0,0 +1 @@
+package p { object Test { Crash } }