Skip to content

Conversation

@Xavientois
Copy link
Contributor

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

[error] -- Error: /Users/********/dotty/compiler/src/dotty/tools/dotc/core/Phases.scala:164:19
[error] 164 |            p.init(this, miniPhases.head.id, miniPhases.last.id)
[error]     |                   ^^^^
[error]     |Cannot prove that the value is fully initialized. Only initialized values may be used as arguments. Calling trace:
[error]     | -> usePhases(List(SomePhase)) [ Contexts.scala:876 ]
[error] -- Error: /Users/********/dotty/compiler/src/dotty/tools/dotc/core/Phases.scala:161:30
[error] 161 |            miniPhases.foreach{ phase =>
[error]     |                              ^
[error]     |Cannot prove that the value is fully initialized. Only initialized values may be used as arguments.
[error]     | Calling trace:
[error]     | -> usePhases(List(SomePhase)) [ Contexts.scala:876 ]
[error]     |
[error]     |The unsafe promotion may cause the following problem:
[error]     |Cannot prove that the value is fully initialized. Only initialized values may be used as arguments. Calling trace:
[error]     | -> usePhases(List(SomePhase)) [ Contexts.scala:876 ]
[error] 162 |              checkRequirements(phase)
[error] 163 |              phase.init(this, nextPhaseId)}
[error] -- Error: /Users/********/dotty/compiler/src/dotty/tools/dotc/core/Phases.scala:166:23
[error] 166 |            phase.init(this, nextPhaseId)
[error]     |                       ^^^^
[error]     |Cannot prove that the value is fully initialized. Only initialized values may be used as arguments. Calling trace:
[error]     | -> usePhases(List(SomePhase)) [ Contexts.scala:876 ]

This fixes the initialization order to address these errors.

Review by @liufengyun

When bootstrapping the compiler with the `-Ysafe-init` flag, we would
get the following errors:
```
[error] -- Error: /Users/********/dotty/compiler/src/dotty/tools/dotc/core/Phases.scala:164:19
[error] 164 |            p.init(this, miniPhases.head.id, miniPhases.last.id)
[error]     |                   ^^^^
[error]     |Cannot prove that the value is fully initialized. Only initialized values may be used as arguments. Calling trace:
[error]     | -> usePhases(List(SomePhase)) [ Contexts.scala:876 ]
[error] -- Error: /Users/********/dotty/compiler/src/dotty/tools/dotc/core/Phases.scala:161:30
[error] 161 |            miniPhases.foreach{ phase =>
[error]     |                              ^
[error]     |Cannot prove that the value is fully initialized. Only initialized values may be used as arguments.
[error]     | Calling trace:
[error]     | -> usePhases(List(SomePhase)) [ Contexts.scala:876 ]
[error]     |
[error]     |The unsafe promotion may cause the following problem:
[error]     |Cannot prove that the value is fully initialized. Only initialized values may be used as arguments. Calling trace:
[error]     | -> usePhases(List(SomePhase)) [ Contexts.scala:876 ]
[error] 162 |              checkRequirements(phase)
[error] 163 |              phase.init(this, nextPhaseId)}
[error] -- Error: /Users/********/dotty/compiler/src/dotty/tools/dotc/core/Phases.scala:166:23
[error] 166 |            phase.init(this, nextPhaseId)
[error]     |                       ^^^^
[error]     |Cannot prove that the value is fully initialized. Only initialized values may be used as arguments. Calling trace:
[error]     | -> usePhases(List(SomePhase)) [ Contexts.scala:876 ]
```

This fixes the initialization order to address these errors.

Review by @liufengyun
@nicolasstucki nicolasstucki merged commit 8922c88 into scala:main Feb 26, 2022
@Xavientois Xavientois deleted the fix-context-base-init-warning branch February 26, 2022 16:51
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