@@ -92,12 +92,7 @@ object TypeApplications {
92
92
object EtaExpansion {
93
93
def apply (tycon : TypeRef )(implicit ctx : Context ) = {
94
94
assert(tycon.isEtaExpandable)
95
- val tparams = tycon.typeParams
96
- val variances = tycon.typeParams.map(_.variance)
97
- TypeLambda (
98
- tparams.map(_.variance),
99
- tycon.paramBounds.map(internalize(_, tycon.typeParams)),
100
- rt => tycon.appliedTo(argRefs(rt, tparams.length)))
95
+ tycon.EtaExpand (tycon.typeParams)
101
96
}
102
97
103
98
def unapply (tp : Type )(implicit ctx : Context ): Option [TypeRef ] = {
@@ -164,10 +159,6 @@ object TypeApplications {
164
159
}
165
160
}
166
161
167
- private def internalize [T <: Type ](tp : T , tparams : List [Symbol ])(implicit ctx : Context ) =
168
- (rt : RefinedType ) =>
169
- new ctx.SafeSubstMap (tparams, argRefs(rt, tparams.length)).apply(tp).asInstanceOf [T ]
170
-
171
162
/** Adapt all arguments to possible higher-kinded type parameters using adaptIfHK
172
163
*/
173
164
def adaptArgs (tparams : List [Symbol ], args : List [Type ])(implicit ctx : Context ): List [Type ] =
@@ -235,9 +226,6 @@ class TypeApplications(val self: Type) extends AnyVal {
235
226
final def hkTypeParams (implicit ctx : Context ): List [TypeSymbol ] =
236
227
self.LambdaTrait .typeParams
237
228
238
- final def paramBounds (implicit ctx : Context ): List [TypeBounds ] =
239
- typeParams.map(self.memberInfo(_).bounds)
240
-
241
229
/** The Lambda trait underlying a type lambda */
242
230
def LambdaTrait (implicit ctx : Context ): Symbol = self.stripTypeVar match {
243
231
case RefinedType (parent, tpnme.hkApply) =>
@@ -262,11 +250,15 @@ class TypeApplications(val self: Type) extends AnyVal {
262
250
* type T[X] >: L <: U becomes type T >: L <: ([X] -> _ <: U)
263
251
*/
264
252
def LambdaAbstract (tparams : List [Symbol ])(implicit ctx : Context ): Type = {
253
+ def internalize [T <: Type ](tp : T ) =
254
+ (rt : RefinedType ) =>
255
+ new ctx.SafeSubstMap (tparams, argRefs(rt, tparams.length))
256
+ .apply(tp).asInstanceOf [T ]
265
257
def expand (tp : Type ) = {
266
258
TypeLambda (
267
259
tparams.map(_.variance),
268
- tparams.map(tparam => internalize(tparam.info. bounds, tparams )),
269
- internalize(tp, tparams ))
260
+ tparams.map(tparam => internalize(self.memberInfo( tparam). bounds)),
261
+ internalize(tp))
270
262
}
271
263
self match {
272
264
case self : TypeAlias =>
0 commit comments