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

Conversation

Xavientois
Copy link
Contributor

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

@Xavientois Xavientois requested a review from liufengyun March 27, 2022 21:52
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
@Xavientois Xavientois force-pushed the tasty-pickler-safe-init-error branch from c6808fe to bab2edc Compare March 28, 2022 14:01
@Xavientois Xavientois requested a review from liufengyun March 28, 2022 14:02
Copy link
Contributor

@liufengyun liufengyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@olhotak olhotak merged commit ed9267e into main Mar 28, 2022
@olhotak olhotak deleted the tasty-pickler-safe-init-error branch March 28, 2022 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants