Skip to content

Commit 5fe845e

Browse files
committed
Tighten isStable test.
A type like C#x is not stable even if x is an immutable value, because the prefix C is not a singleton. This is now taken into account.
1 parent 56150a2 commit 5fe845e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/dotty/tools/dotc/core/Types.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ object Types {
9292

9393
/** Does this type denote a stable reference (i.e. singleton type)? */
9494
final def isStable(implicit ctx: Context): Boolean = this match {
95-
case tp: TermRef => tp.termSymbol.isStable
95+
case tp: TermRef => tp.termSymbol.isStable && tp.prefix.isStable
9696
case _: SingletonType => true
9797
case NoPrefix => true
9898
case _ => false

0 commit comments

Comments
 (0)