File tree 4 files changed +12
-8
lines changed
compiler/src/dotty/tools/dotc 4 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -441,10 +441,17 @@ object SymDenotations {
441
441
final def markAbsent (): Unit =
442
442
myInfo = NoType
443
443
444
+ /** Is symbol known to not exist, or potentially not completed yet? */
445
+ final def unforcedIsAbsent (implicit ctx : Context ): Boolean =
446
+ myInfo == NoType ||
447
+ (this is (ModuleVal , butNot = Package )) && moduleClass.unforcedIsAbsent
448
+
444
449
/** Is symbol known to not exist? */
445
- final def isAbsent (implicit ctx : Context ): Boolean =
450
+ final def isAbsent (implicit ctx : Context ): Boolean = {
451
+ ensureCompleted()
446
452
myInfo == NoType ||
447
453
(this is (ModuleVal , butNot = Package )) && moduleClass.isAbsent
454
+ }
448
455
449
456
/** Is this symbol the root class or its companion object? */
450
457
final def isRoot : Boolean =
@@ -563,7 +570,7 @@ object SymDenotations {
563
570
final def isCoDefinedWith (that : Symbol )(implicit ctx : Context ) =
564
571
(this .effectiveOwner == that.effectiveOwner) &&
565
572
( ! (this .effectiveOwner is PackageClass )
566
- || this .isAbsent || that.isAbsent
573
+ || this .unforcedIsAbsent || that.unforcedIsAbsent
567
574
|| { // check if they are defined in the same file(or a jar)
568
575
val thisFile = this .symbol.associatedFile
569
576
val thatFile = that.symbol.associatedFile
Original file line number Diff line number Diff line change @@ -185,7 +185,7 @@ trait Symbols { this: Context =>
185
185
val companionMethodFlags = Flags .Synthetic | Flags .Private | Flags .Method
186
186
187
187
def synthesizeCompanionMethod (name : Name , target : SymDenotation , owner : SymDenotation )(implicit ctx : Context ) =
188
- if (owner.exists && target.exists && ! owner.isAbsent && ! target.isAbsent ) {
188
+ if (owner.exists && target.exists && ! owner.unforcedIsAbsent && ! target.unforcedIsAbsent ) {
189
189
val existing = owner.unforcedDecls.lookup(name)
190
190
191
191
existing.orElse{
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ class Pickler extends Phase {
33
33
/** Drop any elements of this list that are linked module classes of other elements in the list */
34
34
private def dropCompanionModuleClasses (clss : List [ClassSymbol ])(implicit ctx : Context ): List [ClassSymbol ] = {
35
35
val companionModuleClasses =
36
- clss.filterNot(_ is Module ).map(_.linkedClass).filterNot(_.isAbsent )
36
+ clss.filterNot(_ is Module ).map(_.linkedClass).filterNot(_.unforcedIsAbsent )
37
37
clss.filterNot(companionModuleClasses.contains)
38
38
}
39
39
Original file line number Diff line number Diff line change @@ -145,10 +145,7 @@ trait TypeAssigner {
145
145
final def reallyExists (denot : Denotation )(implicit ctx : Context ): Boolean = try
146
146
denot match {
147
147
case denot : SymDenotation =>
148
- denot.exists && {
149
- denot.ensureCompleted()
150
- ! denot.isAbsent
151
- }
148
+ denot.exists && ! denot.isAbsent
152
149
case denot : SingleDenotation =>
153
150
val sym = denot.symbol
154
151
(sym eq NoSymbol ) || reallyExists(sym.denot)
You can’t perform that action at this time.
0 commit comments