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