aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/core/Types.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2017-04-10 16:20:55 +0200
committerMartin Odersky <odersky@gmail.com>2017-04-10 16:20:55 +0200
commitab06e2d3f2749a6fd594971bee1ae0fa533fa0bd (patch)
treecbbb51a5a5bfba63e8ffa9a10fe47df542e1557a /compiler/src/dotty/tools/dotc/core/Types.scala
parentbb0faff0d45f873fff9054fd8baec92eabb78c3d (diff)
downloaddotty-ab06e2d3f2749a6fd594971bee1ae0fa533fa0bd.tar.gz
dotty-ab06e2d3f2749a6fd594971bee1ae0fa533fa0bd.tar.bz2
dotty-ab06e2d3f2749a6fd594971bee1ae0fa533fa0bd.zip
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.
Diffstat (limited to 'compiler/src/dotty/tools/dotc/core/Types.scala')
-rw-r--r--compiler/src/dotty/tools/dotc/core/Types.scala5
1 files changed, 3 insertions, 2 deletions
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
}