From ab06e2d3f2749a6fd594971bee1ae0fa533fa0bd Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Mon, 10 Apr 2017 16:20:55 +0200 Subject: Generalize definition of Type#isStable We now consider a type also as stable if it refers to an ExprType whose result type is stable. The previous commit made pos/z1720.scala break, because it skolemized unstable argument types. This commit makes the test pass again. --- compiler/src/dotty/tools/dotc/core/Types.scala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'compiler/src/dotty/tools/dotc/core/Types.scala') diff --git a/compiler/src/dotty/tools/dotc/core/Types.scala b/compiler/src/dotty/tools/dotc/core/Types.scala index e7130ee2f..4c69c9484 100644 --- a/compiler/src/dotty/tools/dotc/core/Types.scala +++ b/compiler/src/dotty/tools/dotc/core/Types.scala @@ -107,10 +107,11 @@ object Types { final def isValueTypeOrLambda: Boolean = isValueType || this.isInstanceOf[TypeLambda] /** Does this type denote a stable reference (i.e. singleton type)? */ - @tailrec final def isStable(implicit ctx: Context): Boolean = stripTypeVar match { - case tp: TermRef => tp.termSymbol.isStable && tp.prefix.isStable + final def isStable(implicit ctx: Context): Boolean = stripTypeVar match { + case tp: TermRef => tp.termSymbol.isStable && tp.prefix.isStable || tp.info.isStable case _: SingletonType | NoPrefix => true case tp: RefinedOrRecType => tp.parent.isStable + case tp: ExprType => tp.resultType.isStable case _ => false } -- cgit v1.2.3