@@ -211,6 +211,19 @@ object desugar {
211211 case _ =>
212212 rhs
213213 }
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+
214227 val tparams1 = tparams mapConserve { tparam =>
215228 cpy.TypeDef (tparam)(rhs = desugarContextBounds(tparam.rhs))
216229 }
@@ -239,17 +252,12 @@ object desugar {
239252 def normalizedVparamss = meth1.vparamss map (_ map (vparam =>
240253 cpy.ValDef (vparam)(rhs = EmptyTree )))
241254
242- def dropContextBound (tparam : TypeDef ) = tparam.rhs match {
243- case ContextBounds (tbounds, _) => cpy.TypeDef (tparam)(rhs = tbounds)
244- case _ => tparam
245- }
246-
247255 def defaultGetters (vparamss : List [List [ValDef ]], n : Int ): List [DefDef ] = vparamss match {
248256 case (vparam :: vparams) :: vparamss1 =>
249257 def defaultGetter : DefDef =
250258 DefDef (
251259 name = DefaultGetterName (methName, n),
252- tparams = meth.tparams.map(tparam => dropContextBound (toDefParam(tparam))),
260+ tparams = meth.tparams.map(tparam => dropContextBounds (toDefParam(tparam))),
253261 vparamss = takeUpTo(normalizedVparamss.nestedMap(toDefParam), n),
254262 tpt = TypeTree (),
255263 rhs = vparam.rhs
0 commit comments