diff options
author | Martin Odersky <odersky@gmail.com> | 2017-04-10 16:20:55 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2017-04-10 16:20:55 +0200 |
commit | ab06e2d3f2749a6fd594971bee1ae0fa533fa0bd (patch) | |
tree | cbbb51a5a5bfba63e8ffa9a10fe47df542e1557a /compiler/src/dotty/tools/dotc/core/Types.scala | |
parent | bb0faff0d45f873fff9054fd8baec92eabb78c3d (diff) | |
download | dotty-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.scala | 5 |
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 } |