Skip to content

Commit 27f2a1a

Browse files
committed
Refactor handling of rechecked types
- Always store new types on rechecking - Store them in a hashmap which is associated with the rechecker of the current compilation unit - After rechecking is done, the map is forgotten, unless keepTypes is true. Under keepTypes, then map is kept in an attachment of the unit's root tree. Change in nomenclature: knownType --> nuType rememberType --> setNuType hasRememberedType --> hasNuType
1 parent ec26caa commit 27f2a1a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

compiler/src/dotty/tools/dotc/cc/Setup.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,13 +428,14 @@ class Setup extends PreRecheck, SymTransformer, SetupAPI:
428428
import checker.*
429429

430430
/** Transform type of tree, and remember the transformed type as the type the tree */
431-
private def transformTT(tree: TypeTree, boxed: Boolean)(using Context): Unit =
431+
private def transformTT(tree: TypeTree, sym: Symbol, boxed: Boolean)(using Context): Unit =
432432
if !tree.hasNuType then
433433
val transformed =
434434
if tree.isInferred
435435
then transformInferredType(tree.tpe)
436436
else transformExplicitType(tree.tpe, tptToCheck = tree)
437-
tree.setNuType(if boxed then box(transformed) else transformed)
437+
tree.setNuType(
438+
if boxed then box(transformed) else Fresh.fromCap(transformed, sym))
438439

439440
/** Transform the type of a val or var or the result type of a def */
440441
def transformResultType(tpt: TypeTree, sym: Symbol)(using Context): Unit =

0 commit comments

Comments
 (0)