aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Types.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-06-29 19:44:55 +0200
committerMartin Odersky <odersky@gmail.com>2016-07-11 13:35:01 +0200
commit68e73e854e04f7bea20a8c95637729bf6889e17d (patch)
treed05d50de6280e43199e65e1f2dcd97a2fb8f05ad /src/dotty/tools/dotc/core/Types.scala
parent8e84fb013abeb613af4a3414b836f02140e2e866 (diff)
downloaddotty-68e73e854e04f7bea20a8c95637729bf6889e17d.tar.gz
dotty-68e73e854e04f7bea20a8c95637729bf6889e17d.tar.bz2
dotty-68e73e854e04f7bea20a8c95637729bf6889e17d.zip
Restrict betaReduce to hk applications
Also, handle LazyRefs conservatively in isReferredTo Without the change we risk losing RecTypes because it looks like nobody refers to them. This was observed for pos/i974.scala.
Diffstat (limited to 'src/dotty/tools/dotc/core/Types.scala')
-rw-r--r--src/dotty/tools/dotc/core/Types.scala4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala
index ab5c795e3..7a050c412 100644
--- a/src/dotty/tools/dotc/core/Types.scala
+++ b/src/dotty/tools/dotc/core/Types.scala
@@ -2135,7 +2135,7 @@ object Types {
}
def betaReduce(implicit ctx: Context): Type = refinedInfo match {
- case TypeAlias(alias) =>
+ case TypeAlias(alias) if refinedName.isHkArgName =>
def instantiate(rt: RecType) = new TypeMap {
def apply(t: Type) = t match {
case TypeRef(RecThis(`rt`), `refinedName`) => alias
@@ -2265,6 +2265,8 @@ object Types {
tp match {
case tp: TypeRef => apply(x, tp.prefix)
case tp: RecThis => RecType.this eq tp.binder
+ case tp: LazyRef => true // Assume a reference to be safe.
+ // TODO: Check that all accumulators handle LazyRefs correctly
case _ => foldOver(x, tp)
}
}