Skip to content

Commit

Permalink
Merge pull request #14796 from lampepfl/tasty-pickler-safe-init-error
Browse files Browse the repository at this point in the history
Fix safe-init error in TreePickler
  • Loading branch information
olhotak committed Mar 28, 2022
2 parents 441afc5 + bab2edc commit ed9267e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
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

0 comments on commit ed9267e

Please sign in to comment.