Skip to content

Commit 268ce37

Browse files
committed
More inclusive isStable test.
(1) Refinements of stable types are stable (2) TypeVars instantiated to stable types are stable.
1 parent 1497796 commit 268ce37

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,10 @@ object Types {
8989
final def isValueType: Boolean = this.isInstanceOf[ValueType]
9090

9191
/** Does this type denote a stable reference (i.e. singleton type)? */
92-
final def isStable(implicit ctx: Context): Boolean = this match {
92+
final def isStable(implicit ctx: Context): Boolean = stripTypeVar match {
9393
case tp: TermRef => tp.termSymbol.isStable && tp.prefix.isStable
9494
case _: SingletonType => true
95+
case tp: RefinedType => tp.parent.isStable
9596
case NoPrefix => true
9697
case _ => false
9798
}

0 commit comments

Comments
 (0)