@@ -13,64 +13,64 @@ import config.Printers.constr
13
13
/** Constraint over undetermined type parameters. Constraints are built
14
14
* over values of the following types:
15
15
*
16
- * - PolyType A constraint constrains the type parameters of a set of PolyTypes
17
- * - PolyParam The parameters of the constrained polytypes
18
- * - TypeVar Every constrained parameter might be associated with a TypeVar
19
- * that has the PolyParam as origin.
16
+ * - TypeLambda A constraint constrains the type parameters of a set of TypeLambdas
17
+ * - TypeParamRef The parameters of the constrained type lambdas
18
+ * - TypeVar Every constrained parameter might be associated with a TypeVar
19
+ * that has the TypeParamRef as origin.
20
20
*/
21
21
abstract class Constraint extends Showable {
22
22
23
23
type This <: Constraint
24
24
25
25
/** Does the constraint's domain contain the type parameters of `pt`? */
26
- def contains (pt : PolyType ): Boolean
26
+ def contains (pt : TypeLambda ): Boolean
27
27
28
28
/** Does the constraint's domain contain the type parameter `param`? */
29
- def contains (param : PolyParam ): Boolean
29
+ def contains (param : TypeParamRef ): Boolean
30
30
31
31
/** Does this constraint contain the type variable `tvar` and is it uninstantiated? */
32
32
def contains (tvar : TypeVar ): Boolean
33
33
34
34
/** The constraint entry for given type parameter `param`, or NoType if `param` is not part of
35
35
* the constraint domain. Note: Low level, implementation dependent.
36
36
*/
37
- def entry (param : PolyParam ): Type
37
+ def entry (param : TypeParamRef ): Type
38
38
39
39
/** The type variable corresponding to parameter `param`, or
40
40
* NoType, if `param` is not in constrained or is not paired with a type variable.
41
41
*/
42
- def typeVarOfParam (param : PolyParam ): Type
42
+ def typeVarOfParam (param : TypeParamRef ): Type
43
43
44
44
/** Is it known that `param1 <:< param2`? */
45
- def isLess (param1 : PolyParam , param2 : PolyParam ): Boolean
45
+ def isLess (param1 : TypeParamRef , param2 : TypeParamRef ): Boolean
46
46
47
47
/** The parameters that are known to be smaller wrt <: than `param` */
48
- def lower (param : PolyParam ): List [PolyParam ]
48
+ def lower (param : TypeParamRef ): List [TypeParamRef ]
49
49
50
50
/** The parameters that are known to be greater wrt <: than `param` */
51
- def upper (param : PolyParam ): List [PolyParam ]
51
+ def upper (param : TypeParamRef ): List [TypeParamRef ]
52
52
53
53
/** lower(param) \ lower(butNot) */
54
- def exclusiveLower (param : PolyParam , butNot : PolyParam ): List [PolyParam ]
54
+ def exclusiveLower (param : TypeParamRef , butNot : TypeParamRef ): List [TypeParamRef ]
55
55
56
56
/** upper(param) \ upper(butNot) */
57
- def exclusiveUpper (param : PolyParam , butNot : PolyParam ): List [PolyParam ]
57
+ def exclusiveUpper (param : TypeParamRef , butNot : TypeParamRef ): List [TypeParamRef ]
58
58
59
59
/** The constraint bounds for given type parameter `param`.
60
60
* Poly params that are known to be smaller or greater than `param`
61
61
* are not contained in the return bounds.
62
62
* @pre `param` is not part of the constraint domain.
63
63
*/
64
- def nonParamBounds (param : PolyParam ): TypeBounds
64
+ def nonParamBounds (param : TypeParamRef ): TypeBounds
65
65
66
66
/** The lower bound of `param` including all known-to-be-smaller parameters */
67
- def fullLowerBound (param : PolyParam )(implicit ctx : Context ): Type
67
+ def fullLowerBound (param : TypeParamRef )(implicit ctx : Context ): Type
68
68
69
69
/** The upper bound of `param` including all known-to-be-greater parameters */
70
- def fullUpperBound (param : PolyParam )(implicit ctx : Context ): Type
70
+ def fullUpperBound (param : TypeParamRef )(implicit ctx : Context ): Type
71
71
72
72
/** The bounds of `param` including all known-to-be-smaller and -greater parameters */
73
- def fullBounds (param : PolyParam )(implicit ctx : Context ): TypeBounds
73
+ def fullBounds (param : TypeParamRef )(implicit ctx : Context ): TypeBounds
74
74
75
75
/** A new constraint which is derived from this constraint by adding
76
76
* entries for all type parameters of `poly`.
@@ -79,7 +79,7 @@ abstract class Constraint extends Showable {
79
79
* satisfiability but will solved to give instances of
80
80
* type variables.
81
81
*/
82
- def add (poly : PolyType , tvars : List [TypeVar ])(implicit ctx : Context ): This
82
+ def add (poly : TypeLambda , tvars : List [TypeVar ])(implicit ctx : Context ): This
83
83
84
84
/** A new constraint which is derived from this constraint by updating
85
85
* the entry for parameter `param` to `tp`.
@@ -90,44 +90,44 @@ abstract class Constraint extends Showable {
90
90
*
91
91
* @pre `this contains param`.
92
92
*/
93
- def updateEntry (param : PolyParam , tp : Type )(implicit ctx : Context ): This
93
+ def updateEntry (param : TypeParamRef , tp : Type )(implicit ctx : Context ): This
94
94
95
95
/** A constraint that includes the relationship `p1 <: p2`.
96
96
* `<:` relationships between parameters ("edges") are propagated, but
97
97
* non-parameter bounds are left alone.
98
98
*/
99
- def addLess (p1 : PolyParam , p2 : PolyParam )(implicit ctx : Context ): This
99
+ def addLess (p1 : TypeParamRef , p2 : TypeParamRef )(implicit ctx : Context ): This
100
100
101
101
/** A constraint resulting from adding p2 = p1 to this constraint, and at the same
102
102
* time transferring all bounds of p2 to p1
103
103
*/
104
- def unify (p1 : PolyParam , p2 : PolyParam )(implicit ctx : Context ): This
104
+ def unify (p1 : TypeParamRef , p2 : TypeParamRef )(implicit ctx : Context ): This
105
105
106
106
/** A new constraint which is derived from this constraint by removing
107
107
* the type parameter `param` from the domain and replacing all top-level occurrences
108
108
* of the parameter elsewhere in the constraint by type `tp`, or a conservative
109
109
* approximation of it if that is needed to avoid cycles.
110
110
* Occurrences nested inside a refinement or prefix are not affected.
111
111
*/
112
- def replace (param : PolyParam , tp : Type )(implicit ctx : Context ): This
112
+ def replace (param : TypeParamRef , tp : Type )(implicit ctx : Context ): This
113
113
114
114
/** Is entry associated with `pt` removable? This is the case if
115
115
* all type parameters of the entry are associated with type variables
116
116
* which have their `inst` fields set.
117
117
*/
118
- def isRemovable (pt : PolyType ): Boolean
118
+ def isRemovable (pt : TypeLambda ): Boolean
119
119
120
120
/** A new constraint with all entries coming from `pt` removed. */
121
- def remove (pt : PolyType )(implicit ctx : Context ): This
121
+ def remove (pt : TypeLambda )(implicit ctx : Context ): This
122
122
123
- /** The polytypes constrained by this constraint */
124
- def domainPolys : List [PolyType ]
123
+ /** The type lambdas constrained by this constraint */
124
+ def domainLambdas : List [TypeLambda ]
125
125
126
- /** The polytype parameters constrained by this constraint */
127
- def domainParams : List [PolyParam ]
126
+ /** The type lambda parameters constrained by this constraint */
127
+ def domainParams : List [TypeParamRef ]
128
128
129
129
/** Check whether predicate holds for all parameters in constraint */
130
- def forallParams (p : PolyParam => Boolean ): Boolean
130
+ def forallParams (p : TypeParamRef => Boolean ): Boolean
131
131
132
132
/** Perform operation `op` on all typevars, or only on uninstantiated
133
133
* typevars, depending on whether `uninstOnly` is set or not.
@@ -143,6 +143,6 @@ abstract class Constraint extends Showable {
143
143
/** Check that no constrained parameter contains itself as a bound */
144
144
def checkNonCyclic ()(implicit ctx : Context ): Unit
145
145
146
- /** Check that constraint only refers to PolyParams bound by itself */
146
+ /** Check that constraint only refers to TypeParamRefs bound by itself */
147
147
def checkClosed ()(implicit ctx : Context ): Unit
148
148
}
0 commit comments