@@ -86,7 +86,7 @@ object Symbols {
8686 ctx.settings.YcheckInit .value // initialization check
8787
8888 /** The last denotation of this symbol */
89- private var lastDenot : SymDenotation | Null = _
89+ private var lastDenot : SymDenotation = _
9090 private var checkedPeriod : Period = Nowhere
9191
9292 private [core] def invalidateDenotCache (): Unit = { checkedPeriod = Nowhere }
@@ -101,9 +101,8 @@ object Symbols {
101101 /** The current denotation of this symbol */
102102 final def denot (using Context ): SymDenotation = {
103103 util.Stats .record(" Symbol.denot" )
104- val lastd = lastDenot.nn
105- if (checkedPeriod == ctx.period) lastd
106- else computeDenot(lastd)
104+ if (checkedPeriod == ctx.period) lastDenot
105+ else computeDenot(lastDenot)
107106 }
108107
109108 private def computeDenot (lastd : SymDenotation )(using Context ): SymDenotation = {
@@ -123,14 +122,14 @@ object Symbols {
123122
124123 /** The original denotation of this symbol, without forcing anything */
125124 final def originDenotation : SymDenotation =
126- lastDenot.nn. initial
125+ lastDenot.initial
127126
128127 /** The last known denotation of this symbol, without going through `current` */
129128 final def lastKnownDenotation : SymDenotation =
130- lastDenot.nn
129+ lastDenot
131130
132131 private [core] def defRunId : RunId =
133- if ( lastDenot == null ) NoRunId else lastDenot.nn .validFor.runId
132+ lastDenot.validFor.runId
134133
135134 private inline def associatedFileMatches (inline filter : AbstractFile => Boolean )(using Context ): Boolean =
136135 try
@@ -153,18 +152,17 @@ object Symbols {
153152
154153 /** Is symbol valid in current run? */
155154 final def isValidInCurrentRun (using Context ): Boolean =
156- val d = lastDenot.nn
157- (d.validFor.runId == ctx.runId || stillValid(d)) &&
158- (d.symbol eq this )
155+ (lastDenot.validFor.runId == ctx.runId || stillValid(lastDenot)) &&
156+ (lastDenot.symbol eq this )
159157 // the last condition is needed because under ctx.staleOK overwritten
160158 // members keep denotations pointing to the new symbol, so the validity
161159 // periods check out OK. But once a package member is overridden it is not longer
162160 // valid. If the option would be removed, the check would be no longer needed.
163161
164162 final def isTerm (using Context ): Boolean =
165- (if (defRunId == ctx.runId) lastDenot.nn else denot).isTerm
163+ (if (defRunId == ctx.runId) lastDenot else denot).isTerm
166164 final def isType (using Context ): Boolean =
167- (if (defRunId == ctx.runId) lastDenot.nn else denot).isType
165+ (if (defRunId == ctx.runId) lastDenot else denot).isType
168166 final def asTerm (using Context ): TermSymbol = {
169167 assert(isTerm, s " asTerm called on not-a-Term $this" );
170168 asInstanceOf [TermSymbol ]
@@ -181,10 +179,8 @@ object Symbols {
181179 * conservatively returns `false` if symbol does not yet have a denotation, or denotation
182180 * is a class that is not yet read.
183181 */
184- final def isPrivate (using Context ): Boolean = {
185- val d = lastDenot
186- d != null && d.flagsUNSAFE.is(Private )
187- }
182+ final def isPrivate (using Context ): Boolean =
183+ lastDenot.flagsUNSAFE.is(Private )
188184
189185 /** Is the symbol a pattern bound symbol?
190186 */
@@ -193,14 +189,14 @@ object Symbols {
193189
194190 /** The symbol's signature if it is completed or a method, NotAMethod otherwise. */
195191 final def signature (using Context ): Signature =
196- if ( lastDenot != null && (lastDenot .uncheckedNN.isCompleted || lastDenot.uncheckedNN.is(Method )))
192+ if lastDenot.uncheckedNN.isCompleted || lastDenot.uncheckedNN.is(Method ) then
197193 denot.signature
198194 else
199195 Signature .NotAMethod
200196
201197 /** Special cased here, because it may be used on naked symbols in substituters */
202198 final def isStatic (using Context ): Boolean =
203- lastDenot != null && lastDenot.uncheckedNN .initial.isStatic
199+ lastDenot.initial.isStatic
204200
205201 /** This symbol entered into owner's scope (owner must be a class). */
206202 final def entered (using Context ): this .type = {
@@ -268,7 +264,7 @@ object Symbols {
268264 * Overridden in ClassSymbol
269265 */
270266 def associatedFile (using Context ): AbstractFile | Null =
271- if ( lastDenot == null ) null else lastDenot.uncheckedNN .topLevelClass.associatedFile
267+ lastDenot.topLevelClass.associatedFile
272268
273269 /** The class file from which this class was generated, null if not applicable. */
274270 final def binaryFile (using Context ): AbstractFile | Null = {
@@ -356,8 +352,7 @@ object Symbols {
356352 protected def prefixString : String = " Symbol"
357353
358354 override def toString : String =
359- if (lastDenot == null ) s " Naked $prefixString# $id"
360- else lastDenot.nn.toString // + "#" + id // !!! DEBUG
355+ lastDenot.toString // + "#" + id // !!! DEBUG
361356
362357 def toText (printer : Printer ): Text = printer.toText(this )
363358
0 commit comments