Skip to content

Commit 2b0a1ed

Browse files
committed
Trial 2: remove Constraint.isUnifying
1 parent c790a94 commit 2b0a1ed

File tree

5 files changed

+4
-14
lines changed

5 files changed

+4
-14
lines changed

compiler/src/dotty/tools/dotc/core/Constraint.scala

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,6 @@ abstract class Constraint extends Showable {
101101
*/
102102
def unify(p1: TypeParamRef, p2: TypeParamRef)(using Context): This
103103

104-
/** Is it currently unifying p1 and p2? */
105-
def isUnifying(p1: TypeParamRef, p2: TypeParamRef)(using Context): Boolean
106-
107104
/** A new constraint which is derived from this constraint by removing
108105
* the type parameter `param` from the domain and replacing all top-level occurrences
109106
* of the parameter elsewhere in the constraint by type `tp`, or a conservative

compiler/src/dotty/tools/dotc/core/OrderingConstraint.scala

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -393,16 +393,9 @@ class OrderingConstraint(private val boundsMap: ParamBounds,
393393
order(this, param1, param2).checkNonCyclic()
394394

395395
def unify(p1: TypeParamRef, p2: TypeParamRef)(using Context): This =
396-
unifyingPair = (p2, p1)
397396
val p1Bounds = (nonParamBounds(p1) & nonParamBounds(p2)).substParam(p2, p1)
398-
unifyingPair = (NoType, NoType)
399397
updateEntry(p1, p1Bounds).replace(p2, p1)
400398

401-
private var unifyingPair: (Type, Type) = (NoType, NoType)
402-
403-
def isUnifying(p1: TypeParamRef, p2: TypeParamRef)(using Context): Boolean =
404-
unifyingPair._1 == p1 && unifyingPair._2 == p2
405-
406399
// ---------- Replacements and Removals -------------------------------------
407400

408401
/** A new constraint which is derived from this constraint by removing

compiler/src/dotty/tools/dotc/core/TypeComparer.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,8 +392,7 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
392392
assumedTrue(tp1) ||
393393
tp2.match {
394394
case tp2: TypeParamRef =>
395-
constraint.isUnifying(tp1, tp2) ||
396-
inFrozenConstraint(constraint.isLess(tp1, tp2))
395+
constraint.isLess(tp1, tp2)
397396
case _ =>
398397
false
399398
} ||

compiler/src/dotty/tools/dotc/core/TypeOps.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -678,11 +678,12 @@ object TypeOps:
678678
tp // break cycles
679679

680680
case tp: TypeRef if !tp.symbol.isClass =>
681-
def lo = LazyRef(apply(tp.underlying.loBound))
682-
def hi = LazyRef(apply(tp.underlying.hiBound))
683681
val lookup = boundTypeParams.lookup(tp)
684682
if lookup != null then lookup
685683
else
684+
val lo = LazyRef(apply(tp.underlying.loBound))
685+
val hi = LazyRef(apply(tp.underlying.hiBound))
686+
686687
val tv = newTypeVar(TypeBounds(lo, hi))
687688
boundTypeParams(tp) = tv
688689
// Force lazy ref eagerly using current context
File renamed without changes.

0 commit comments

Comments
 (0)