diff options
author | Martin Odersky <odersky@gmail.com> | 2014-02-03 16:59:26 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-02-03 17:00:10 +0100 |
commit | 01fc1813929bfea3235bb0739131f675f57c7309 (patch) | |
tree | 4e4043e019551387b363f47971911706867330c5 /src/dotty/tools/dotc/core/Types.scala | |
parent | 4fab474454be9d2ac615ca39517a9f6c262bf187 (diff) | |
download | dotty-01fc1813929bfea3235bb0739131f675f57c7309.tar.gz dotty-01fc1813929bfea3235bb0739131f675f57c7309.tar.bz2 dotty-01fc1813929bfea3235bb0739131f675f57c7309.zip |
Fix problems with TypeVar instantiation
1) Simplify skipped one level over arguments of AndType/OrType.
2) variances needs to follow instantiated typevars
Diffstat (limited to 'src/dotty/tools/dotc/core/Types.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index 71e38fb8c..2a6a5017f 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -828,7 +828,7 @@ object Types { def variances(include: TypeVar => Boolean)(implicit ctx: Context): VarianceMap = track("variances") { val accu = new TypeAccumulator[VarianceMap] { def apply(vmap: VarianceMap, t: Type): VarianceMap = t match { - case t: TypeVar if include(t) => + case t: TypeVar if !t.isInstantiated && include(t) => val v = vmap(t) if (v == null) vmap.updated(t, variance) else if (v == variance) vmap @@ -852,9 +852,9 @@ object Types { class Simplify extends TypeMap { def apply(tp: Type): Type = tp match { case AndType(l, r) => - mapOver(l) & mapOver(r) + this(l) & this(r) case OrType(l, r) => - mapOver(l) | mapOver(r) + this(l) | this(r) case tp: PolyParam => ctx.typerState.constraint.typeVarOfParam(tp) orElse tp case _ => |