Skip to content

Commit 0264a0f

Browse files
committed
Don't let import symbols go stale
Otherwise we can run into problems when checking imports for e.g. scala2Mode in later runs.
1 parent 0653344 commit 0264a0f

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/dotty/tools/dotc/core/SymDenotations.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ trait SymDenotations { this: Context =>
4141
}
4242

4343
def stillValid(denot: SymDenotation): Boolean =
44-
if (denot.is(ValidForever) || denot.isRefinementClass) true
44+
if (denot.is(ValidForever) || denot.isRefinementClass || denot.isImport) true
4545
else {
4646
val initial = denot.initial
4747
val firstPhaseId = initial.validFor.firstPhaseId.max(ctx.typerPhase.id)
@@ -590,6 +590,9 @@ object SymDenotations {
590590
originalName.isSetterName &&
591591
(!isCompleted || info.firstParamTypes.nonEmpty) // to avoid being fooled by var x_= : Unit = ...
592592

593+
/** is this a symbol representing an import? */
594+
final def isImport = name == nme.IMPORT
595+
593596
/** is this the constructor of a class? */
594597
final def isClassConstructor = name == nme.CONSTRUCTOR
595598

src/dotty/tools/dotc/printing/RefinedPrinter.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
553553
(sym.allOverriddenSymbols exists (_ is TypeParam))
554554

555555
override def toText(sym: Symbol): Text = {
556-
if (sym.name == nme.IMPORT) {
556+
if (sym.isImport) {
557557
def importString(tree: untpd.Tree) = s"import ${tree.show}"
558558
sym.infoOrCompleter match {
559559
case info: Namer#Completer => return importString(info.original)

0 commit comments

Comments
 (0)