File tree Expand file tree Collapse file tree 4 files changed +12
-8
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 4 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -441,10 +441,17 @@ object SymDenotations {
441441 final def markAbsent (): Unit =
442442 myInfo = NoType
443443
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+
444449 /** Is symbol known to not exist? */
445- final def isAbsent (implicit ctx : Context ): Boolean =
450+ final def isAbsent (implicit ctx : Context ): Boolean = {
451+ ensureCompleted()
446452 myInfo == NoType ||
447453 (this is (ModuleVal , butNot = Package )) && moduleClass.isAbsent
454+ }
448455
449456 /** Is this symbol the root class or its companion object? */
450457 final def isRoot : Boolean =
@@ -563,7 +570,7 @@ object SymDenotations {
563570 final def isCoDefinedWith (that : Symbol )(implicit ctx : Context ) =
564571 (this .effectiveOwner == that.effectiveOwner) &&
565572 ( ! (this .effectiveOwner is PackageClass )
566- || this .isAbsent || that.isAbsent
573+ || this .unforcedIsAbsent || that.unforcedIsAbsent
567574 || { // check if they are defined in the same file(or a jar)
568575 val thisFile = this .symbol.associatedFile
569576 val thatFile = that.symbol.associatedFile
Original file line number Diff line number Diff line change @@ -185,7 +185,7 @@ trait Symbols { this: Context =>
185185 val companionMethodFlags = Flags .Synthetic | Flags .Private | Flags .Method
186186
187187 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 ) {
189189 val existing = owner.unforcedDecls.lookup(name)
190190
191191 existing.orElse{
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ class Pickler extends Phase {
3333 /** Drop any elements of this list that are linked module classes of other elements in the list */
3434 private def dropCompanionModuleClasses (clss : List [ClassSymbol ])(implicit ctx : Context ): List [ClassSymbol ] = {
3535 val companionModuleClasses =
36- clss.filterNot(_ is Module ).map(_.linkedClass).filterNot(_.isAbsent )
36+ clss.filterNot(_ is Module ).map(_.linkedClass).filterNot(_.unforcedIsAbsent )
3737 clss.filterNot(companionModuleClasses.contains)
3838 }
3939
Original file line number Diff line number Diff line change @@ -145,10 +145,7 @@ trait TypeAssigner {
145145 final def reallyExists (denot : Denotation )(implicit ctx : Context ): Boolean = try
146146 denot match {
147147 case denot : SymDenotation =>
148- denot.exists && {
149- denot.ensureCompleted()
150- ! denot.isAbsent
151- }
148+ denot.exists && ! denot.isAbsent
152149 case denot : SingleDenotation =>
153150 val sym = denot.symbol
154151 (sym eq NoSymbol ) || reallyExists(sym.denot)
You can’t perform that action at this time.
0 commit comments