@@ -211,6 +211,19 @@ object desugar {
211
211
case _ =>
212
212
rhs
213
213
}
214
+
215
+ def dropContextBounds (tparam : TypeDef ): TypeDef = {
216
+ def dropInRhs (rhs : Tree ): Tree = rhs match {
217
+ case ContextBounds (tbounds, _) =>
218
+ tbounds
219
+ case rhs @ LambdaTypeTree (tparams, body) =>
220
+ cpy.LambdaTypeTree (rhs)(tparams, dropInRhs(body))
221
+ case _ =>
222
+ rhs
223
+ }
224
+ cpy.TypeDef (tparam)(rhs = dropInRhs(tparam.rhs))
225
+ }
226
+
214
227
val tparams1 = tparams mapConserve { tparam =>
215
228
cpy.TypeDef (tparam)(rhs = desugarContextBounds(tparam.rhs))
216
229
}
@@ -239,17 +252,12 @@ object desugar {
239
252
def normalizedVparamss = meth1.vparamss map (_ map (vparam =>
240
253
cpy.ValDef (vparam)(rhs = EmptyTree )))
241
254
242
- def dropContextBound (tparam : TypeDef ) = tparam.rhs match {
243
- case ContextBounds (tbounds, _) => cpy.TypeDef (tparam)(rhs = tbounds)
244
- case _ => tparam
245
- }
246
-
247
255
def defaultGetters (vparamss : List [List [ValDef ]], n : Int ): List [DefDef ] = vparamss match {
248
256
case (vparam :: vparams) :: vparamss1 =>
249
257
def defaultGetter : DefDef =
250
258
DefDef (
251
259
name = DefaultGetterName (methName, n),
252
- tparams = meth.tparams.map(tparam => dropContextBound (toDefParam(tparam))),
260
+ tparams = meth.tparams.map(tparam => dropContextBounds (toDefParam(tparam))),
253
261
vparamss = takeUpTo(normalizedVparamss.nestedMap(toDefParam), n),
254
262
tpt = TypeTree (),
255
263
rhs = vparam.rhs
0 commit comments