aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/pickling
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-08-08 16:12:01 +0200
committerMartin Odersky <odersky@gmail.com>2014-08-08 18:32:33 +0200
commit058729ceac3354a2cc34490b528e76afb09ee0ce (patch)
tree2b98e78b607c7f0438ebd2eac8b68f5a72b46a04 /src/dotty/tools/dotc/core/pickling
parentf87153bc5d74f66e2fcf22dc7282da31813430da (diff)
downloaddotty-058729ceac3354a2cc34490b528e76afb09ee0ce.tar.gz
dotty-058729ceac3354a2cc34490b528e76afb09ee0ce.tar.bz2
dotty-058729ceac3354a2cc34490b528e76afb09ee0ce.zip
LazyRefs break cycles for unpickled types
Insert LazyRefs to break cycles for F-bounded types that are unpickled or read from Java signatures.
Diffstat (limited to 'src/dotty/tools/dotc/core/pickling')
-rw-r--r--src/dotty/tools/dotc/core/pickling/ClassfileParser.scala7
-rw-r--r--src/dotty/tools/dotc/core/pickling/UnPickler.scala7
2 files changed, 12 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/core/pickling/ClassfileParser.scala b/src/dotty/tools/dotc/core/pickling/ClassfileParser.scala
index 59658c9c1..193c872f1 100644
--- a/src/dotty/tools/dotc/core/pickling/ClassfileParser.scala
+++ b/src/dotty/tools/dotc/core/pickling/ClassfileParser.scala
@@ -11,6 +11,7 @@ import java.lang.Integer.toHexString
import scala.collection.{ mutable, immutable }
import scala.collection.mutable.{ ListBuffer, ArrayBuffer }
import scala.annotation.switch
+import typer.Checking.checkNonCyclic
import io.AbstractFile
class ClassfileParser(
@@ -337,7 +338,11 @@ class ClassfileParser(
val savedIndex = index
try {
index = start
- denot.info = sig2typeBounds(tparams, skiptvs = false)
+ denot.info =
+ checkNonCyclic( // we need the checkNonCyclic call to insert LazyRefs for F-bounded cycles
+ denot.symbol,
+ sig2typeBounds(tparams, skiptvs = false),
+ reportErrors = false)
} finally {
index = savedIndex
}
diff --git a/src/dotty/tools/dotc/core/pickling/UnPickler.scala b/src/dotty/tools/dotc/core/pickling/UnPickler.scala
index de3f626da..2e21358e4 100644
--- a/src/dotty/tools/dotc/core/pickling/UnPickler.scala
+++ b/src/dotty/tools/dotc/core/pickling/UnPickler.scala
@@ -15,6 +15,7 @@ import printing.Texts._
import printing.Printer
import io.AbstractFile
import util.common._
+import typer.Checking.checkNonCyclic
import PickleBuffer._
import scala.reflect.internal.pickling.PickleFormat._
import Decorators._
@@ -516,7 +517,11 @@ class UnPickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClassRoot:
denot setFlag Scala2x
case denot =>
val tp1 = depoly(tp, denot)
- denot.info = if (tag == ALIASsym) TypeAlias(tp1) else tp1
+ denot.info =
+ if (tag == ALIASsym) TypeAlias(tp1)
+ else if (denot.isType) checkNonCyclic(denot.symbol, tp1, reportErrors = false)
+ // we need the checkNonCyclic call to insert LazyRefs for F-bounded cycles
+ else tp1
if (denot.isConstructor) addConstructorTypeParams(denot)
if (atEnd) {
assert(!(denot is SuperAccessor), denot)