File tree 1 file changed +9
-2
lines changed
compiler/src/dotty/tools/dotc/core 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -2324,6 +2324,14 @@ object Types {
2324
2324
case _ => if (denotationIsCurrent) lastDenotation.nn.symbol else NoSymbol
2325
2325
}
2326
2326
2327
+ /** Like `currentSymbol`, but force the denotation if the symbol isn't valid.
2328
+ * Compared to `stableInRunSymbol`, this doesn't force the denotation for non-symbolic named types,
2329
+ * because currentSymbol returns NoSymbol, which is `Permanent`, so always "isValidInCurrentRun".
2330
+ * Forcing the denotation breaks tests/run/enrich-gentraversable.scala. */
2331
+ private def currentValidSymbol (using Context ): Symbol =
2332
+ val sym = currentSymbol
2333
+ if sym.isValidInCurrentRun then sym else denot.symbol
2334
+
2327
2335
/** Retrieves currently valid symbol without necessarily updating denotation.
2328
2336
* Assumes that symbols do not change between periods in the same run.
2329
2337
* Used to get the class underlying a ThisType.
@@ -2677,8 +2685,7 @@ object Types {
2677
2685
else {
2678
2686
if (isType) {
2679
2687
val res =
2680
- val sym = stableInRunSymbol
2681
- if (sym.isAllOf(ClassTypeParam )) argForParam(prefix)
2688
+ if (currentValidSymbol.isAllOf(ClassTypeParam )) argForParam(prefix)
2682
2689
else prefix.lookupRefined(name)
2683
2690
if (res.exists) return res
2684
2691
if (Config .splitProjections)
You can’t perform that action at this time.
0 commit comments