File tree Expand file tree Collapse file tree 3 files changed +17
-6
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 3 files changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -453,6 +453,12 @@ object SymDenotations {
453
453
(this is (ModuleVal , butNot = Package )) && moduleClass.isAbsent
454
454
}
455
455
456
+ final def isValidInCurrentRun (implicit ctx : Context ): Boolean =
457
+ validFor.runId == ctx.runId || ctx.stillValid(this )
458
+
459
+ final def isReferencedSymbolically (implicit ctx : Context ) =
460
+ (this is NonMember ) || isTerm && ctx.phase.symbolicRefs
461
+
456
462
/** Is this symbol the root class or its companion object? */
457
463
final def isRoot : Boolean =
458
464
(name.toTermName == nme.ROOT || name == nme.ROOTPKG ) && (owner eq NoSymbol )
Original file line number Diff line number Diff line change @@ -425,7 +425,7 @@ object Symbols {
425
425
}
426
426
427
427
final def isValidInCurrentRun (implicit ctx : Context ): Boolean =
428
- lastDenot.validFor.runId == ctx.runId || ctx.stillValid(lastDenot)
428
+ lastDenot.isValidInCurrentRun
429
429
430
430
/** Subclass tests and casts */
431
431
final def isTerm (implicit ctx : Context ): Boolean =
@@ -440,10 +440,8 @@ object Symbols {
440
440
final def asType (implicit ctx : Context ): TypeSymbol = { assert(isType, s " isType called on not-a-Type $this" ); asInstanceOf [TypeSymbol ] }
441
441
final def asClass : ClassSymbol = asInstanceOf [ClassSymbol ]
442
442
443
- final def isReferencedSymbolically (implicit ctx : Context ) = {
444
- val sym = lastDenot
445
- sym != null && ((sym is NonMember ) || sym.isTerm && ctx.phase.symbolicRefs)
446
- }
443
+ final def isReferencedSymbolically (implicit ctx : Context ) =
444
+ lastDenot != null && lastDenot.isReferencedSymbolically
447
445
448
446
/** Special cased here, because it may be used on naked symbols in substituters */
449
447
final def isStatic (implicit ctx : Context ): Boolean =
Original file line number Diff line number Diff line change @@ -1562,6 +1562,12 @@ object Types {
1562
1562
}
1563
1563
}
1564
1564
1565
+ private def keepSymbol (d : SymDenotation )(implicit ctx : Context ) =
1566
+ d.is(Private ) ||
1567
+ d.isConstructor ||
1568
+ d.isReferencedSymbolically ||
1569
+ d.exists && (d.owner.isTerm || prefix.isTightPrefix(d.owner))
1570
+
1565
1571
/** A second fallback to recompute the denotation if necessary */
1566
1572
private def computeDenot (implicit ctx : Context ): Denotation = {
1567
1573
val savedEphemeral = ctx.typerState.ephemeral
@@ -1572,7 +1578,8 @@ object Types {
1572
1578
val sym = lastSymbol
1573
1579
if (sym != null && sym.isValidInCurrentRun) denotOfSym(sym) else loadDenot
1574
1580
case d : SymDenotation =>
1575
- if (this .isInstanceOf [WithFixedSym ]) d.current
1581
+ if (d.isValidInCurrentRun)
1582
+ if (keepSymbol(d)) d.current
1576
1583
else if (d.validFor.runId == ctx.runId || ctx.stillValid(d))
1577
1584
if (d.exists && prefix.isTightPrefix(d.owner) || d.isConstructor) d.current
1578
1585
else recomputeMember(d) // symbol could have been overridden, recompute membership
You can’t perform that action at this time.
0 commit comments