Skip to content

Commit ed9267e

Browse files
authored
Merge pull request #14796 from lampepfl/tasty-pickler-safe-init-error
Fix safe-init error in TreePickler
2 parents 441afc5 + bab2edc commit ed9267e

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,4 @@ class TastyPickler(val rootCls: ClassSymbol) {
8181
assert(all.length == totalSize && all.bytes.length == totalSize, s"totalSize = $totalSize, all.length = ${all.length}, all.bytes.length = ${all.bytes.length}")
8282
all.bytes
8383
}
84-
85-
val treePkl: TreePickler = new TreePickler(this)
8684
}

compiler/src/dotty/tools/dotc/quoted/PickledQuotes.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import dotty.tools.dotc.core.Decorators._
88
import dotty.tools.dotc.core.Mode
99
import dotty.tools.dotc.core.Symbols._
1010
import dotty.tools.dotc.core.Types._
11-
import dotty.tools.dotc.core.tasty.{ PositionPickler, TastyPickler, TastyPrinter }
11+
import dotty.tools.dotc.core.tasty.{ PositionPickler, TastyPickler, TastyPrinter, TreePickler }
1212
import dotty.tools.dotc.core.tasty.DottyUnpickler
1313
import dotty.tools.dotc.core.tasty.TreeUnpickler.UnpickleMode
1414
import dotty.tools.dotc.report
@@ -154,7 +154,7 @@ object PickledQuotes {
154154
private def pickle(tree: Tree)(using Context): Array[Byte] = {
155155
quotePickling.println(i"**** pickling quote of\n$tree")
156156
val pickler = new TastyPickler(defn.RootClass)
157-
val treePkl = pickler.treePkl
157+
val treePkl = new TreePickler(pickler)
158158
treePkl.pickle(tree :: Nil)
159159
treePkl.compactify()
160160
if tree.span.exists then

compiler/src/dotty/tools/dotc/transform/Pickler.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class Pickler extends Phase {
6868
if ctx.settings.YtestPickler.value then
6969
beforePickling(cls) = tree.show
7070
picklers(cls) = pickler
71-
val treePkl = pickler.treePkl
71+
val treePkl = new TreePickler(pickler)
7272
treePkl.pickle(tree :: Nil)
7373
val positionWarnings = new mutable.ListBuffer[String]()
7474
val pickledF = inContext(ctx.fresh) {

0 commit comments

Comments
 (0)