aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/dotty/tools/dotc/core')
-rw-r--r--src/dotty/tools/dotc/core/TypeComparer.scala13
-rw-r--r--src/dotty/tools/dotc/core/Types.scala6
2 files changed, 11 insertions, 8 deletions
diff --git a/src/dotty/tools/dotc/core/TypeComparer.scala b/src/dotty/tools/dotc/core/TypeComparer.scala
index 15a3d746d..9e6982847 100644
--- a/src/dotty/tools/dotc/core/TypeComparer.scala
+++ b/src/dotty/tools/dotc/core/TypeComparer.scala
@@ -631,11 +631,14 @@ class TypeComparer(initctx: Context) extends DotClass {
def comparePolyParam = {
tp1 == tp2 ||
isSubTypeWhenFrozen(bounds(tp1).hi, tp2) || {
- if (!frozenConstraint &&
- (tp2 isRef defn.NothingClass) &&
- ctx.typerState.isGlobalCommittable)
- ctx.log(s"!!! instantiating to Nothing: $tp1")
- if (isConstrained(tp1)) addConstraint(tp1, tp2, fromBelow = false)
+ if (isConstrained(tp1))
+ addConstraint(tp1, tp2, fromBelow = false) && {
+ if ((!frozenConstraint) &&
+ (tp2 isRef defn.NothingClass) &&
+ ctx.typerState.isGlobalCommittable)
+ ctx.log(s"!!! instantiated to Nothing: $tp1, constraint = ${constraint.show}")
+ true
+ }
else (ctx.mode is Mode.TypevarsMissContext) || thirdTry(tp1, tp2)
}
}
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 _ =>