diff --git a/compiler/src/dotty/tools/dotc/core/TypeComparer.scala b/compiler/src/dotty/tools/dotc/core/TypeComparer.scala index 57741a762b52..18ef51de3eaf 100644 --- a/compiler/src/dotty/tools/dotc/core/TypeComparer.scala +++ b/compiler/src/dotty/tools/dotc/core/TypeComparer.scala @@ -494,7 +494,7 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling def hardenTypeVars(tp2: Type): Unit = tp2.dealiasKeepRefiningAnnots match case tvar: TypeVar if constraint.contains(tvar.origin) => - state.rigidVars += tvar + state.hardVars += tvar case tp2: TypeParamRef if constraint.contains(tp2) => hardenTypeVars(constraint.typeVarOfParam(tp2)) case tp2: AndOrType => diff --git a/compiler/src/dotty/tools/dotc/core/TyperState.scala b/compiler/src/dotty/tools/dotc/core/TyperState.scala index 01d5771b8f9b..a00836bf78c5 100644 --- a/compiler/src/dotty/tools/dotc/core/TyperState.scala +++ b/compiler/src/dotty/tools/dotc/core/TyperState.scala @@ -29,7 +29,7 @@ object TyperState { def snapshot()(using Context): Snapshot = var previouslyInstantiated: TypeVars = SimpleIdentitySet.empty for tv <- ts.ownedVars do if tv.inst.exists then previouslyInstantiated += tv - (ts.constraint, ts.ownedVars, previouslyInstantiated, ts.rigidVars) + (ts.constraint, ts.ownedVars, previouslyInstantiated, ts.hardVars) def resetTo(state: Snapshot)(using Context): Unit = val (c, tvs, previouslyInstantiated, rvars) = state @@ -38,7 +38,7 @@ object TyperState { tv.resetInst(ts) ts.ownedVars = tvs ts.constraint = c - ts.rigidVars = rvars + ts.hardVars = rvars } class TyperState() { @@ -94,9 +94,9 @@ class TyperState() { * its lower bound, top-level soft unions in the instance type are converted * to hard unions instead of being widened in `widenOr`. */ - private var myRigidVars: TypeVars = _ - def rigidVars: TypeVars = myRigidVars - def rigidVars_=(tvs: TypeVars): Unit = myRigidVars = tvs + private var myHardVars: TypeVars = _ + def hardVars: TypeVars = myHardVars + def hardVars_=(tvs: TypeVars): Unit = myHardVars = tvs /** Initializes all fields except reporter, isCommittable, which need to be * set separately. @@ -108,7 +108,7 @@ class TyperState() { this.myConstraint = constraint this.previousConstraint = constraint this.myOwnedVars = SimpleIdentitySet.empty - this.myRigidVars = SimpleIdentitySet.empty + this.myHardVars = SimpleIdentitySet.empty this.isCommitted = false this @@ -119,7 +119,7 @@ class TyperState() { val ts = TyperState().init(this, this.constraint) .setReporter(reporter) .setCommittable(committable) - ts.rigidVars = this.rigidVars + ts.hardVars = this.hardVars ts /** The uninstantiated variables */ @@ -173,7 +173,7 @@ class TyperState() { constr.println(i"committing $this to $targetState, fromConstr = $constraint, toConstr = ${targetState.constraint}") if targetState.constraint eq previousConstraint then targetState.constraint = constraint - targetState.rigidVars = rigidVars + targetState.hardVars = hardVars if !ownedVars.isEmpty then ownedVars.foreach(targetState.includeVar) else targetState.mergeConstraintWith(this) @@ -226,7 +226,7 @@ class TyperState() { val otherLos = other.lower(p) val otherHis = other.upper(p) val otherEntry = other.entry(p) - if that.rigidVars.contains(tv) then this.myRigidVars += tv + if that.hardVars.contains(tv) then this.myHardVars += tv ( (otherLos eq constraint.lower(p)) || otherLos.forall(_ <:< p)) && ( (otherHis eq constraint.upper(p)) || otherHis.forall(p <:< _)) && ((otherEntry eq constraint.entry(p)) || otherEntry.match diff --git a/compiler/src/dotty/tools/dotc/core/Types.scala b/compiler/src/dotty/tools/dotc/core/Types.scala index 8191d29903c3..4dbfee72b366 100644 --- a/compiler/src/dotty/tools/dotc/core/Types.scala +++ b/compiler/src/dotty/tools/dotc/core/Types.scala @@ -4576,7 +4576,7 @@ object Types { instantiateWith(tp) def widenUnions(using Context) = - !ctx.typerState.rigidVars.contains(this) + !ctx.typerState.hardVars.contains(this) /** For uninstantiated type variables: the entry in the constraint (either bounds or * provisional instance value)