@@ -117,9 +117,12 @@ object Types {
117
117
case t : TypeRef =>
118
118
! t.currentSymbol.isStatic && {
119
119
(t : Type ).mightBeProvisional = false // break cycles
120
- t.symbol.is(Provisional )
120
+ // We can use flagsUNSAFE here because in the worth case, we
121
+ // will overapproximate isProvisional by returning true if the
122
+ // denotation has not been completed yet.
123
+ t.symbol.flagsUNSAFE.is(Provisional )
121
124
|| test(t.prefix, theAcc)
122
- || t.info .match
125
+ || t.denot.infoOrCompleter .match
123
126
case info : AliasingBounds => test(info.alias, theAcc)
124
127
case TypeBounds (lo, hi) => test(lo, theAcc) || test(hi, theAcc)
125
128
case _ => false
@@ -4212,7 +4215,17 @@ object Types {
4212
4215
def isUnreducibleWild (using Context ): Boolean =
4213
4216
tycon.isLambdaSub && hasWildcardArg && ! isMatchAlias
4214
4217
4215
- def tryCompiletimeConstantFold (using Context ): Type = tycon match {
4218
+ var myTryCompiletimeConstantFold : Type | Null = null
4219
+ var myTryCompiletimeConstantFoldPeriod : Period = Nowhere
4220
+
4221
+ def tryCompiletimeConstantFold (using Context ): Type =
4222
+ if myTryCompiletimeConstantFoldPeriod != ctx.period then
4223
+ myTryCompiletimeConstantFold = tryCompiletimeConstantFoldImpl
4224
+ if ! isProvisional then
4225
+ myTryCompiletimeConstantFoldPeriod = ctx.period
4226
+ myTryCompiletimeConstantFold.nn
4227
+
4228
+ private def tryCompiletimeConstantFoldImpl (using Context ): Type = tycon match {
4216
4229
case tycon : TypeRef if defn.isCompiletimeAppliedType(tycon.symbol) =>
4217
4230
extension (tp : Type ) def fixForEvaluation : Type =
4218
4231
tp.normalized.dealias match {
0 commit comments