Commit 20d9b48
committed
Fix safe-init errors in ContextBase
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 @liufengyun1 parent 0b3dd14 commit 20d9b48
1 file changed
+3
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
872 | 872 | | |
873 | 873 | | |
874 | 874 | | |
875 | | - | |
876 | | - | |
877 | | - | |
878 | 875 | | |
879 | 876 | | |
880 | 877 | | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
881 | 881 | | |
882 | 882 | | |
883 | 883 | | |
| |||
0 commit comments