@@ -67,9 +67,9 @@ trait Deriving {
67
67
* the deriving ADT
68
68
* (b) a single parameter type class with a parameter of kind * and an ADT with
69
69
* one or more type parameter of kind *
70
- * (c) the Eql type class
70
+ * (c) the CanEqual type class
71
71
*
72
- * See detailed descriptions in deriveSingleParameter and deriveEql below.
72
+ * See detailed descriptions in deriveSingleParameter and deriveCanEqual below.
73
73
*
74
74
* If it passes the checks, enter a type class instance for it in the current scope.
75
75
*
@@ -145,7 +145,7 @@ trait Deriving {
145
145
//
146
146
// given derived$TC[a, b, c] given TC[a], TC[b], TC[c]: TC[a, b, c]
147
147
//
148
- // This, like the derivation for Eql , is a special case of the
148
+ // This, like the derivation for CanEqual , is a special case of the
149
149
// earlier more general multi-parameter type class model for which
150
150
// the heuristic is typically a good one.
151
151
@@ -185,8 +185,8 @@ trait Deriving {
185
185
cannotBeUnified
186
186
}
187
187
188
- def deriveEql : Unit = {
189
- // Specific derives rules for the Eql type class ... (c) above
188
+ def deriveCanEqual : Unit = {
189
+ // Specific derives rules for the CanEqual type class ... (c) above
190
190
//
191
191
// This has been extracted from the earlier more general multi-parameter
192
192
// type class model. Modulo the assumptions below, the implied semantics
@@ -196,26 +196,26 @@ trait Deriving {
196
196
// 1. Type params of the deriving class correspond to all and only
197
197
// elements of the deriving class which are relevant to equality (but:
198
198
// type params could be phantom, or the deriving class might have an
199
- // element of a non-Eql type non-parametrically).
199
+ // element of a non-CanEqual type non-parametrically).
200
200
//
201
201
// 2. Type params of kinds other than * can be assumed to be irrelevant to
202
202
// the derivation (but: eg. Foo[F[_]](fi: F[Int])).
203
203
//
204
204
// Are they reasonable? They cover some important cases (eg. Tuples of all
205
- // arities). derives Eql is opt-in, so if the semantics don't match those
205
+ // arities). derives CanEqual is opt-in, so if the semantics don't match those
206
206
// appropriate for the deriving class the author of that class can provide
207
207
// their own instance in the normal way. That being so, the question turns
208
208
// on whether there are enough types which fit these semantics for the
209
209
// feature to pay its way.
210
210
211
211
// Procedure:
212
212
// We construct a two column matrix of the deriving class type parameters
213
- // and the Eql type class parameters.
213
+ // and the CanEqual type class parameters.
214
214
//
215
215
// Rows: parameters of the deriving class
216
- // Columns: parameters of the Eql type class (L/R)
216
+ // Columns: parameters of the CanEqual type class (L/R)
217
217
//
218
- // Running example: type class: class Eql [L, R], deriving class: class A[T, U, V]
218
+ // Running example: type class: class CanEqual [L, R], deriving class: class A[T, U, V]
219
219
// clsParamss =
220
220
// T_L T_R
221
221
// U_L U_R
@@ -225,15 +225,15 @@ trait Deriving {
225
225
tparam.copy(name = s " ${tparam.name}_ $$ _ ${tcparam.name}" .toTypeName)
226
226
.asInstanceOf [TypeSymbol ])
227
227
}
228
- // Retain only rows with L/R params of kind * which Eql can be applied to.
228
+ // Retain only rows with L/R params of kind * which CanEqual can be applied to.
229
229
// No pairwise evidence will be required for params of other kinds.
230
230
val firstKindedParamss = clsParamss.filter {
231
231
case param :: _ => ! param.info.isLambdaSub
232
232
case _ => false
233
233
}
234
234
235
235
// The types of the required evidence parameters. In the running example:
236
- // Eql [T_L, T_R], Eql [U_L, U_R], Eql [V_L, V_R]
236
+ // CanEqual [T_L, T_R], CanEqual [U_L, U_R], CanEqual [V_L, V_R]
237
237
val evidenceParamInfos =
238
238
for (row <- firstKindedParamss)
239
239
yield row.map(_.typeRef)
@@ -244,12 +244,12 @@ trait Deriving {
244
244
for (n <- List .range(0 , typeClassArity))
245
245
yield cls.typeRef.appliedTo(clsParamss.map(row => row(n).typeRef))
246
246
247
- // Eql [A[T_L, U_L, V_L], A[T_R, U_R, V_R]]
247
+ // CanEqual [A[T_L, U_L, V_L], A[T_R, U_R, V_R]]
248
248
addInstance(clsParamss.flatten, evidenceParamInfos, instanceTypes)
249
249
}
250
250
251
251
if (typeClassArity == 1 ) deriveSingleParameter
252
- else if (typeClass == defn.EqlClass ) deriveEql
252
+ else if (typeClass == defn.CanEqualClass ) deriveCanEqual
253
253
else if (typeClassArity == 0 )
254
254
report.error(i " type ${typeClass.name} in derives clause of ${cls.name} has no type parameters " , derived.srcPos)
255
255
else
0 commit comments