Skip to content

Commit 18ab4d0

Browse files
committed
Cache stability of non-lazy stable symbols
That is, set is(Stable) for symbols that satisfy isStable.
1 parent 9e56db8 commit 18ab4d0

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

compiler/src/dotty/tools/dotc/core/CheckRealizable.scala

+5-4
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,13 @@ class CheckRealizable(implicit ctx: Context) {
8989
if (!sym.isStable)
9090
patchRealizability(NotStable)
9191
// 3. If the symbol isn't "lazy" and its prefix is realizable
92-
else if (!isLateInitialized(sym))
93-
// XXX: This is a bit fishy: we only cache that the symbol is
94-
// stable if it appears under a realizable prefix.
92+
else if (!isLateInitialized(sym)) {
93+
// The symbol itself is stable, cache this information:
94+
sym.setFlag(Stable)
95+
// Realizability now depends on the prefix:
9596
// XXX: Add object DependsOnPrefix extends Realizability(""), but filter it out here.
9697
patchRealizability(realizability(tp.prefix))
97-
else if (!sym.isEffectivelyFinal)
98+
} else if (!sym.isEffectivelyFinal)
9899
patchRealizability(new NotFinal(sym))
99100
else
100101
// 4. If the symbol is effectively final, and a lazy or erased val

0 commit comments

Comments
 (0)