Skip to content

Commit a98d42a

Browse files
committed
Set defTree properly
In the following test: - tests/pos/i3130b.scala If we add `transparent`, then everything is OK. The reason is that we set `Symbol.defTree` systematically in PostTyper. Now the inlining happens after PostTyper, thus `defTree` is not properly set for inlined definitions. To compensate, we ensure that `defTree` is set in the ReTyper. The IninerTyper extends ReTyper, thus it fixes the problem. Doing the fix directly in InlinerTyper, however, does not pass the CI. The reason is that `-Ycheck:all` will run `TreeChecker` which will make tree bindings get lost.
1 parent 632a424 commit a98d42a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,9 @@ class ReTyper extends Typer with ReChecking {
115115
}
116116

117117
override def typedUnadapted(tree: untpd.Tree, pt: Type, locked: TypeVars)(using Context): Tree =
118-
try super.typedUnadapted(tree, pt, locked)
118+
try super.typedUnadapted(tree, pt, locked) match
119+
case member: MemberDef => member.setDefTree
120+
case tree => tree
119121
catch {
120122
case NonFatal(ex) =>
121123
if ctx.phase != Phases.typerPhase && ctx.phase != Phases.inliningPhase then

0 commit comments

Comments
 (0)