Skip to content

Commit 01f0ac7

Browse files
committed
Don't ask defTree for Symbol's source after erasure
After erasure all trees get the source of the enclosing compilation unit (via dropInlined). The defTrees don't change, however. Therefore they are no longer correct for determing a symbol's source.
1 parent 8fd1ef6 commit 01f0ac7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler/src/dotty/tools/dotc/core/Symbols.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ object Symbols {
624624
type DontUseSymbolOnSymbol
625625

626626
final def source(implicit ctx: Context): SourceFile =
627-
if (!defTree.isEmpty) defTree.source
627+
if (!defTree.isEmpty && !ctx.erasedTypes) defTree.source
628628
else this match {
629629
case cls: ClassSymbol => cls.sourceOfClass
630630
case _ =>

0 commit comments

Comments
 (0)