File tree Expand file tree Collapse file tree 2 files changed +14
-14
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 2 files changed +14
-14
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,19 @@ trait ConstraintHandling {
50
50
*/
51
51
protected var comparedTypeLambdas : Set [TypeLambda ] = Set .empty
52
52
53
+ /** Gives for each instantiated type var that does not yet have its `inst` field
54
+ * set, the instance value stored in the constraint. Storing instances in constraints
55
+ * is done only in a temporary way for contexts that may be retracted
56
+ * without also retracting the type var as a whole.
57
+ */
58
+ def instType (tvar : TypeVar ): Type = constraint.entry(tvar.origin) match {
59
+ case _ : TypeBounds => NoType
60
+ case tp : TypeParamRef =>
61
+ var tvar1 = constraint.typeVarOfParam(tp)
62
+ if (tvar1.exists) tvar1 else tp
63
+ case tp => tp
64
+ }
65
+
53
66
protected def addOneBound (param : TypeParamRef , bound : Type , isUpper : Boolean ): Boolean =
54
67
! constraint.contains(param) || {
55
68
def occursIn (bound : Type ): Boolean = {
Original file line number Diff line number Diff line change @@ -79,19 +79,6 @@ class TyperState(previous: TyperState /* | Null */) {
79
79
def ownedVars : TypeVars = myOwnedVars
80
80
def ownedVars_= (vs : TypeVars ): Unit = myOwnedVars = vs
81
81
82
- /** Gives for each instantiated type var that does not yet have its `inst` field
83
- * set, the instance value stored in the constraint. Storing instances in constraints
84
- * is done only in a temporary way for contexts that may be retracted
85
- * without also retracting the type var as a whole.
86
- */
87
- def instType (tvar : TypeVar )(implicit ctx : Context ): Type = constraint.entry(tvar.origin) match {
88
- case _ : TypeBounds => NoType
89
- case tp : TypeParamRef =>
90
- var tvar1 = constraint.typeVarOfParam(tp)
91
- if (tvar1.exists) tvar1 else tp
92
- case tp => tp
93
- }
94
-
95
82
/** The closest ancestor of this typer state (including possibly this typer state itself)
96
83
* which is not yet committed, or which does not have a parent.
97
84
*/
@@ -173,7 +160,7 @@ class TyperState(previous: TyperState /* | Null */) {
173
160
val toCollect = new mutable.ListBuffer [TypeLambda ]
174
161
constraint foreachTypeVar { tvar =>
175
162
if (! tvar.inst.exists) {
176
- val inst = instType(tvar)
163
+ val inst = ctx.typeComparer. instType(tvar)
177
164
if (inst.exists && (tvar.owningState.get eq this )) {
178
165
tvar.inst = inst
179
166
val lam = tvar.origin.binder
You can’t perform that action at this time.
0 commit comments