Skip to content

Commit e7e643c

Browse files
committed
Avoid double avoidance when typing blocks
For a Block, TypeAssigner does an avoid just for term symbols whereas Typer does one for all local symbols. Since Typer called TypeAssigner, we got a double avoidance pass. This is eliminated by assigning types directly in Typer without passing through TypeAssigner.
1 parent 827dc26 commit e7e643c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler/src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
623623
else pt.notApplied
624624
val expr1 = typedExpr(tree.expr, ept)(exprCtx)
625625
ensureNoLocalRefs(
626-
assignType(cpy.Block(tree)(stats1, expr1), stats1, expr1), pt, localSyms(stats1))
626+
cpy.Block(tree)(stats1, expr1).withType(expr1.tpe), pt, localSyms(stats1))
627627
}
628628

629629
def escapingRefs(block: Tree, localSyms: => List[Symbol])(implicit ctx: Context): collection.Set[NamedType] = {

0 commit comments

Comments
 (0)