Skip to content

Commit 5cc99d4

Browse files
committed
Fixes to TreeChecker
1) One phase too many was checked for postconditions. 2) Class members did not have their owners checked because index was not called on them.
1 parent b129332 commit 5cc99d4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/dotty/tools/dotc/transform/TreeChecker.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class TreeChecker {
3939
println(s"checking ${ctx.compilationUnit} after phase ${ctx.phase.prev}")
4040
val checkingCtx = ctx.fresh
4141
.setTyperState(ctx.typerState.withReporter(new ThrowingReporter(ctx.typerState.reporter)))
42-
val checker = new Checker(phasesToRun.takeWhile(_ ne ctx.phase) :+ ctx.phase)
42+
val checker = new Checker(phasesToRun.takeWhile(_ ne ctx.phase))
4343
checker.typedExpr(ctx.compilationUnit.tpdTree)(checkingCtx)
4444
}
4545

@@ -107,9 +107,9 @@ class TreeChecker {
107107
* is that we should be able to pull out an expression as an initializer
108108
* of a helper value without having to do a change owner traversal of the expression.
109109
*/
110-
override def index(trees: List[untpd.Tree])(implicit ctx: Context): Context = {
110+
override def typedStats(trees: List[untpd.Tree], exprOwner: Symbol)(implicit ctx: Context): List[Tree] = {
111111
for (tree <- trees if tree.isDef) checkOwner(tree)
112-
super.index(trees)
112+
super.typedStats(trees, exprOwner)
113113
}
114114

115115
override def adapt(tree: Tree, pt: Type, original: untpd.Tree = untpd.EmptyTree)(implicit ctx: Context) = {

0 commit comments

Comments
 (0)