Skip to content

Commit 45ffdf0

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 0cd8e50 commit 45ffdf0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
624624
else pt.notApplied
625625
val expr1 = typedExpr(tree.expr, ept)(exprCtx)
626626
ensureNoLocalRefs(
627-
assignType(cpy.Block(tree)(stats1, expr1), stats1, expr1), pt, localSyms(stats1))
627+
cpy.Block(tree)(stats1, expr1).withType(expr1.tpe), pt, localSyms(stats1))
628628
}
629629

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

0 commit comments

Comments
 (0)