Skip to content

Commit c6808fe

Browse files
committed
Fix safe-init error in TreePickler
When bootstrapping the compiler with the `-Ysafe-init` flag, we would get the following error: ``` [error] -- Error: /*************/dotty/compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala:24:20 [error] 24 | pickler.newSection(ASTsSection, buf) [error] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [error] |Call method TreePickler.this.pickler.newSection("ASTs", [error] | dotty.tools.dotc.core.tasty.TreePickler.this.buf [error] |) on a value with an unknown initialization. Calling trace: [error] | -> val treePkl: TreePickler = new TreePickler(this) [ TastyPickler.scala:85 ] [error] | -> class TreePickler(pickler: TastyPickler) { [ TreePickler.scala:22 ] ``` This supresses the warning for this case. Review by @liufengyun
1 parent 20842cf commit c6808fe

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,5 +82,5 @@ class TastyPickler(val rootCls: ClassSymbol) {
8282
all.bytes
8383
}
8484

85-
val treePkl: TreePickler = new TreePickler(this)
85+
val treePkl: TreePickler = new TreePickler(this: @unchecked)
8686
}

0 commit comments

Comments
 (0)