Skip to content

Fix safe-init error in TreePickler #14796

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions compiler/src/dotty/tools/dotc/core/tasty/TastyPickler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,4 @@ class TastyPickler(val rootCls: ClassSymbol) {
assert(all.length == totalSize && all.bytes.length == totalSize, s"totalSize = $totalSize, all.length = ${all.length}, all.bytes.length = ${all.bytes.length}")
all.bytes
}

val treePkl: TreePickler = new TreePickler(this)
}
4 changes: 2 additions & 2 deletions compiler/src/dotty/tools/dotc/quoted/PickledQuotes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import dotty.tools.dotc.core.Decorators._
import dotty.tools.dotc.core.Mode
import dotty.tools.dotc.core.Symbols._
import dotty.tools.dotc.core.Types._
import dotty.tools.dotc.core.tasty.{ PositionPickler, TastyPickler, TastyPrinter }
import dotty.tools.dotc.core.tasty.{ PositionPickler, TastyPickler, TastyPrinter, TreePickler }
import dotty.tools.dotc.core.tasty.DottyUnpickler
import dotty.tools.dotc.core.tasty.TreeUnpickler.UnpickleMode
import dotty.tools.dotc.report
Expand Down Expand Up @@ -154,7 +154,7 @@ object PickledQuotes {
private def pickle(tree: Tree)(using Context): Array[Byte] = {
quotePickling.println(i"**** pickling quote of\n$tree")
val pickler = new TastyPickler(defn.RootClass)
val treePkl = pickler.treePkl
val treePkl = new TreePickler(pickler)
treePkl.pickle(tree :: Nil)
treePkl.compactify()
if tree.span.exists then
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/transform/Pickler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class Pickler extends Phase {
if ctx.settings.YtestPickler.value then
beforePickling(cls) = tree.show
picklers(cls) = pickler
val treePkl = pickler.treePkl
val treePkl = new TreePickler(pickler)
treePkl.pickle(tree :: Nil)
val positionWarnings = new mutable.ListBuffer[String]()
val pickledF = inContext(ctx.fresh) {
Expand Down