aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/core/TypeOps.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2017-04-11 23:36:16 +0200
committerMartin Odersky <odersky@gmail.com>2017-04-11 23:36:16 +0200
commitaaff621f552e6824db4f7c1d73d9e8941e088d96 (patch)
tree9aa465f82f188fd553bded6082f7f992e0aa01c1 /compiler/src/dotty/tools/dotc/core/TypeOps.scala
parent053cd236ee12f877cfd71affb9a62a417f917d3d (diff)
downloaddotty-aaff621f552e6824db4f7c1d73d9e8941e088d96.tar.gz
dotty-aaff621f552e6824db4f7c1d73d9e8941e088d96.tar.bz2
dotty-aaff621f552e6824db4f7c1d73d9e8941e088d96.zip
Alternative fix
The original fix made run/hmap-covariant fail because a type variable representing a dependent result parameter was instantiated. Trying something else now.
Diffstat (limited to 'compiler/src/dotty/tools/dotc/core/TypeOps.scala')
-rw-r--r--compiler/src/dotty/tools/dotc/core/TypeOps.scala9
1 files changed, 5 insertions, 4 deletions
diff --git a/compiler/src/dotty/tools/dotc/core/TypeOps.scala b/compiler/src/dotty/tools/dotc/core/TypeOps.scala
index 0de823e97..4a1c3d044 100644
--- a/compiler/src/dotty/tools/dotc/core/TypeOps.scala
+++ b/compiler/src/dotty/tools/dotc/core/TypeOps.scala
@@ -159,7 +159,11 @@ trait TypeOps { this: Context => // TODO: Make standalone object.
case tp1 => tp1
}
case tp: TypeParamRef =>
- typerState.constraint.typeVarOfParam(tp) orElse tp
+ if (tp.paramName.is(DepParamName)) {
+ val bounds = ctx.typeComparer.bounds(tp)
+ if (bounds.lo.isRef(defn.NothingClass)) bounds.hi else bounds.lo
+ }
+ else typerState.constraint.typeVarOfParam(tp) orElse tp
case _: ThisType | _: BoundType | NoPrefix =>
tp
case tp: RefinedType =>
@@ -170,9 +174,6 @@ trait TypeOps { this: Context => // TODO: Make standalone object.
simplify(l, theMap) & simplify(r, theMap)
case OrType(l, r) =>
simplify(l, theMap) | simplify(r, theMap)
- case tp: TypeVar if tp.origin.paramName.is(DepParamName) =>
- val effectiveVariance = if (theMap == null) 1 else theMap.variance
- tp.instanceOpt orElse tp.instantiate(fromBelow = effectiveVariance != -1)
case _ =>
(if (theMap != null) theMap else new SimplifyMap).mapOver(tp)
}