summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@epfl.ch>2010-12-03 18:47:01 +0000
committerLukas Rytz <lukas.rytz@epfl.ch>2010-12-03 18:47:01 +0000
commit627adab5dbddcef8bd57d2b40eaa6a6e40c06cab (patch)
tree2eb20e317f78612a2c2c8a47dc0e8f7420ddfd2d
parent3a783937bf97a9180e303da90cea8077f75d3e9b (diff)
downloadscala-627adab5dbddcef8bd57d2b40eaa6a6e40c06cab.tar.gz
scala-627adab5dbddcef8bd57d2b40eaa6a6e40c06cab.tar.bz2
scala-627adab5dbddcef8bd57d2b40eaa6a6e40c06cab.zip
close #3951. review by dubochet.
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Symbols.scala2
-rwxr-xr-xsrc/library/scala/reflect/generic/UnPickler.scala13
-rw-r--r--test/files/pos/t3951/Coll_1.scala36
-rw-r--r--test/files/pos/t3951/Test_2.scala4
4 files changed, 52 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/Symbols.scala b/src/compiler/scala/tools/nsc/symtab/Symbols.scala
index e84ae10cee..e15328c6a1 100644
--- a/src/compiler/scala/tools/nsc/symtab/Symbols.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Symbols.scala
@@ -63,7 +63,7 @@ trait Symbols extends reflect.generic.Symbols { self: SymbolTable =>
private var rawannots: List[AnnotationInfoBase] = Nil
/* Used in namer to check whether annotations were already assigned or not */
- def rawAnnotations:List[AnnotationInfoBase] = rawannots
+ def rawAnnotations: List[AnnotationInfoBase] = rawannots
/** After the typer phase (before, look at the definition's Modifiers), contains
* the annotations attached to member a definition (class, method, type, field).
diff --git a/src/library/scala/reflect/generic/UnPickler.scala b/src/library/scala/reflect/generic/UnPickler.scala
index ed103a3a43..d04b882f0d 100755
--- a/src/library/scala/reflect/generic/UnPickler.scala
+++ b/src/library/scala/reflect/generic/UnPickler.scala
@@ -65,14 +65,23 @@ abstract class UnPickler {
//println("unpickled " + classRoot + ":" + classRoot.rawInfo + ", " + moduleRoot + ":" + moduleRoot.rawInfo);//debug
def run() {
+ // read children last, fix for #3951
+ val queue = new collection.mutable.ListBuffer[() => Unit]()
+ def delay(i: Int, action: => Unit) {
+ queue += (() => at(i, {() => action; null}))
+ }
+
for (i <- 0 until index.length) {
if (isSymbolEntry(i))
at(i, readSymbol)
else if (isSymbolAnnotationEntry(i))
- at(i, {() => readSymbolAnnotation(); null})
+ delay(i, readSymbolAnnotation())
else if (isChildrenEntry(i))
- at(i, {() => readChildren(); null})
+ delay(i, readChildren())
}
+
+ for (action <- queue)
+ action()
}
private def checkVersion() {
diff --git a/test/files/pos/t3951/Coll_1.scala b/test/files/pos/t3951/Coll_1.scala
new file mode 100644
index 0000000000..c2cc39a1a9
--- /dev/null
+++ b/test/files/pos/t3951/Coll_1.scala
@@ -0,0 +1,36 @@
+trait Document {
+ sealed trait FieldBase
+ trait StaticFieldBase extends FieldBase with StaticDocument
+ trait DynamicFieldBase extends FieldBase with DynamicDocument
+}
+
+sealed trait StaticDocument extends Document {
+ abstract class AbstractField extends FieldBase
+}
+
+sealed trait DynamicDocument extends Document {
+ abstract class AbstractField extends FieldBase
+}
+
+class Coll extends StaticDocument
+
+// similiar issue with annotations
+class ann[T] extends StaticAnnotation
+
+trait StatDoc extends Doc {
+ @ann[StatFB]
+ def foo: Int
+}
+
+trait Doc {
+ @ann[DynDoc#ForceDynDoc]
+ def bar: Int
+ trait StatFB
+ trait DynFB
+}
+
+trait DynDoc extends Doc {
+ @ann[DynFB]
+ def baz: Int
+ trait ForceDynDoc
+}
diff --git a/test/files/pos/t3951/Test_2.scala b/test/files/pos/t3951/Test_2.scala
new file mode 100644
index 0000000000..2519543008
--- /dev/null
+++ b/test/files/pos/t3951/Test_2.scala
@@ -0,0 +1,4 @@
+object Test {
+ new Coll
+ trait T extends StatDoc
+}