Skip to content

Commit 225a009

Browse files
committed
Revert "Check that we pickle a definition before its references"
More precisely, put it under a Config flag which is off by default. This reverts commit ae1b00d.
1 parent 2317859 commit 225a009

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import Comments.{Comment, CommentsContext}
1515
import NameKinds._
1616
import StdNames.nme
1717
import transform.SymUtils._
18+
import config.Config
1819
import collection.mutable
1920
import dotty.tools.tasty.TastyFormat.ASTsSection
2021

@@ -85,6 +86,11 @@ class TreePickler(pickler: TastyPickler) {
8586
case Some(label) =>
8687
if (label != NoAddr) writeRef(label) else pickleForwardSymRef(sym)
8788
case None =>
89+
// See pos/t1957.scala for an example where this can happen.
90+
// I believe it's a bug in typer: the type of an implicit argument refers
91+
// to a closure parameter outside the closure itself. TODO: track this down, so that we
92+
// can eliminate this case.
93+
report.log(i"pickling reference to as yet undefined $sym in ${sym.owner}", sym.srcPos)
8894
pickleForwardSymRef(sym)
8995
}
9096

@@ -197,7 +203,7 @@ class TreePickler(pickler: TastyPickler) {
197203
}
198204
else if (tpe.prefix == NoPrefix) {
199205
writeByte(if (tpe.isType) TYPEREFdirect else TERMREFdirect)
200-
if !symRefs.contains(sym) && !sym.isPatternBound && !sym.hasAnnotation(defn.QuotedRuntimePatterns_patternTypeAnnot) then
206+
if Config.checkLevels && !symRefs.contains(sym) && !sym.isPatternBound && !sym.hasAnnotation(defn.QuotedRuntimePatterns_patternTypeAnnot) then
201207
report.error(i"pickling reference to as yet undefined $tpe with symbol ${sym}", sym.srcPos)
202208
pickleSymRef(sym)
203209
}

0 commit comments

Comments
 (0)