From 1bb16c4ec5a5c677d2b606e652733cd7a3867a2b Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Thu, 10 Jul 2014 14:55:20 +0200 Subject: Small cleanups and additions. --- src/dotty/tools/dotc/ast/TreeInfo.scala | 2 +- src/dotty/tools/dotc/core/Substituters.scala | 6 +++++- src/dotty/tools/dotc/core/Types.scala | 6 +++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/dotty/tools/dotc/ast/TreeInfo.scala b/src/dotty/tools/dotc/ast/TreeInfo.scala index 78fb2d80b..1354f7375 100644 --- a/src/dotty/tools/dotc/ast/TreeInfo.scala +++ b/src/dotty/tools/dotc/ast/TreeInfo.scala @@ -354,7 +354,7 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] => private def refPurity(tree: tpd.Tree)(implicit ctx: Context): PurityLevel = if (!tree.tpe.widen.isParameterless) Pure else if (!tree.symbol.is(Stable)) Impure - else if (tree.symbol.is(Lazy)) Idempotent + else if (tree.symbol.is(Lazy)) Idempotent // TODO add Module flag, sinxce Module vals or not Lazy from the start. else Pure def isPureRef(tree: tpd.Tree)(implicit ctx: Context) = diff --git a/src/dotty/tools/dotc/core/Substituters.scala b/src/dotty/tools/dotc/core/Substituters.scala index 1b96de47e..3d14317cb 100644 --- a/src/dotty/tools/dotc/core/Substituters.scala +++ b/src/dotty/tools/dotc/core/Substituters.scala @@ -205,7 +205,11 @@ trait Substituters { this: Context => final class SubstMap(from: List[Symbol], to: List[Type]) extends DeepTypeMap { def apply(tp: Type): Type = subst(tp, from, to, this) } - +/* not needed yet + final class SubstDealiasMap(from: List[Symbol], to: List[Type]) extends SubstMap(from, to) { + override def apply(tp: Type): Type = subst(tp.dealias, from, to, this) + } +*/ final class SubstSymMap(from: List[Symbol], to: List[Symbol]) extends DeepTypeMap { def apply(tp: Type): Type = substSym(tp, from, to, this) } diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index dcb1ae491..89bef109b 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -813,11 +813,15 @@ object Types { if (from1.isEmpty) ctx.subst1(this, from.head, to.head, null) else { val from2 = from1.tail - if (from2.isEmpty) ctx.subst2(this, from.head, to.head, from.tail.head, to.tail.head, null) + if (from2.isEmpty) ctx.subst2(this, from.head, to.head, from1.head, to.tail.head, null) else ctx.subst(this, from, to, null) } } +/* Not needed yet: + final def substDealias(from: List[Symbol], to: List[Type])(implicit ctx: Context): Type = + new ctx.SubstDealiasMap(from, to).apply(this) +*/ /** Substitute all types of the form `PolyParam(from, N)` by * `PolyParam(to, N)`. */ -- cgit v1.2.3