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