@@ -110,25 +110,28 @@ object Symbols extends SymUtils {
110
110
}
111
111
112
112
private def computeDenot (lastd : SymDenotation )(using Context ): SymDenotation = {
113
+ // Written that way do that it comes in at 32 bytes and is therefore inlineable for
114
+ // the JIT (reputedly, cutoff is at 35 bytes)
113
115
util.Stats .record(" Symbol.computeDenot" )
114
116
val now = ctx.period
115
- val prev = checkedPeriod
116
117
checkedPeriod = now
117
- if lastd.validFor.contains(now) then
118
- lastd
119
- else
120
- val newd = recomputeDenot(lastd)
121
- if newd.exists then
122
- lastDenot = newd
123
- else
124
- checkedPeriod = prev
125
- newd
118
+ if lastd.validFor.contains(now) then lastd else recomputeDenot(lastd)
126
119
}
127
120
128
121
/** Overridden in NoSymbol */
129
122
protected def recomputeDenot (lastd : SymDenotation )(using Context ): SymDenotation = {
130
123
util.Stats .record(" Symbol.recomputeDenot" )
131
- lastd.current.asSymDenotation
124
+ val newd = lastd.current.asInstanceOf [SymDenotation ]
125
+ lastDenot = newd
126
+ if ! newd.exists && lastd.initial.validFor.firstPhaseId > ctx.phaseId then
127
+ // We are trying to bring forward a symbol that is defined only at a later phase
128
+ // (typically, a nested Java class, invisible before erasure).
129
+ // In that case, keep the checked period to the previous validity, which
130
+ // means we will try another bring forward when the symbol is referenced
131
+ // at a later phase. Otherwise we'd get stuck on NoDenotation here.
132
+ // See #15562 and test i15562b in ReplCompilerTests
133
+ checkedPeriod = lastd.initial.validFor
134
+ newd
132
135
}
133
136
134
137
/** The original denotation of this symbol, without forcing anything */
@@ -798,7 +801,7 @@ object Symbols extends SymUtils {
798
801
cls : ClassSymbol ,
799
802
name : TermName = nme.WILDCARD ,
800
803
selfInfo : Type = NoType )(using Context ): TermSymbol =
801
- newSymbol(cls, name, SelfSymFlags , selfInfo orElse cls.classInfo.selfType, coord = cls.coord)
804
+ newSymbol(cls, name, SelfSymFlags , selfInfo. orElse( cls.classInfo.selfType) , coord = cls.coord)
802
805
803
806
/** Create new type parameters with given owner, names, and flags.
804
807
* @param boundsFn A function that, given type refs to the newly created
@@ -965,7 +968,7 @@ object Symbols extends SymUtils {
965
968
*/
966
969
def getPackageClassIfDefined (path : PreName )(using Context ): Symbol =
967
970
staticRef(path.toTypeName, isPackage = true , generateStubs = false )
968
- .disambiguate(_ is PackageClass ).symbol
971
+ .disambiguate(_.is( PackageClass ) ).symbol
969
972
970
973
def requiredModule (path : PreName )(using Context ): TermSymbol = {
971
974
val name = path.toTermName
0 commit comments