Skip to content

Fix safe-init error in MegaPhase #14464

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
Feb 13, 2022

Conversation

Xavientois
Copy link
Contributor

@Xavientois Xavientois commented Feb 13, 2022

When bootstrapping the compiler with the -Ysafe-init flag, we would
get the following error:

[error] -- Error: /****/dotty/compiler/src/dotty/tools/dotc/transform/MegaPhase.scala:458:7
[error] 458 |  for ((phase, idx) <- miniPhases.zipWithIndex) {
[error]     |       ^
[error]     |Cannot prove that the value is fully initialized. Only initialized values may be used as arguments.
[error]     |
[error]     |The unsafe promotion may cause the following problem:
[error]     |Cannot prove that the value is fully initialized. May only assign fully initialized value.
[error] 459 |    phase.superPhase = this
[error] 460 |    phase.idxInGroup = idx
[error] 461 |  }

This fixes the initialization order to address this error.

Review by @liufengyun

When bootstrapping the compiler with the `-Ysafe-init` flag, we would
get the following error:
```
[error] -- Error: /Users/rrampersad/Documents/school/URA/dotty/compiler/src/dotty/tools/dotc/transform/MegaPhase.scala:458:7
[error] 458 |  for ((phase, idx) <- miniPhases.zipWithIndex) {
[error]     |       ^
[error]     |Cannot prove that the value is fully initialized. Only initialized values may be used as arguments.
[error]     |
[error]     |The unsafe promotion may cause the following problem:
[error]     |Cannot prove that the value is fully initialized. May only assign fully initialized value.
[error] 459 |    phase.superPhase = this
[error] 460 |    phase.idxInGroup = idx
[error] 461 |  }
```

This fixes the initialization order to address this error.
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

@dwijnand dwijnand merged commit fd97aee into scala:main Feb 13, 2022
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