@@ -234,7 +234,7 @@ object desugar {
234234 * of the same method.
235235 * @param evidenceFlags The flags to use for evidence definitions
236236 * @param freshName A function to generate fresh names for evidence definitions
237- * @param allParams If `tdef` is a type paramter, all parameters of the owning method,
237+ * @param allParamss If `tdef` is a type paramter, all parameters of the owning method,
238238 * otherwise the empty list.
239239 */
240240 private def desugarContextBounds (
@@ -246,29 +246,31 @@ object desugar {
246246
247247 val evidenceNames = mutable.ListBuffer [TermName ]()
248248
249- def desugarRhs (rhs : Tree ): Tree = rhs match
250- case ContextBounds (tbounds, cxbounds ) =>
249+ def desugarRHS (rhs : Tree ): Tree = rhs match
250+ case ContextBounds (tbounds, ctxbounds ) =>
251251 val isMember = evidenceFlags.isAllOf(DeferredGivenFlags )
252- for bound <- cxbounds do
252+ for bound <- ctxbounds do
253253 val evidenceName = bound match
254254 case ContextBoundTypeTree (_, _, ownName) if ! ownName.isEmpty =>
255255 ownName // if there is an explicitly given name, use it.
256- case _ if Config .nameSingleContextBounds && ! isMember
257- && cxbounds.tail.isEmpty && Feature .enabled(Feature .modularity) =>
258- tdef.name.toTermName
259256 case _ =>
260- freshName(bound)
257+ if Config .nameSingleContextBounds
258+ && ! isMember
259+ && ctxbounds.tail.isEmpty
260+ && Feature .enabled(Feature .modularity)
261+ then tdef.name.toTermName
262+ else freshName(bound)
261263 evidenceNames += evidenceName
262264 val evidenceParam = ValDef (evidenceName, bound, EmptyTree ).withFlags(evidenceFlags)
263265 evidenceParam.pushAttachment(ContextBoundParam , ())
264266 evidenceBuf += evidenceParam
265267 tbounds
266268 case LambdaTypeTree (tparams, body) =>
267- cpy.LambdaTypeTree (rhs)(tparams, desugarRhs (body))
269+ cpy.LambdaTypeTree (rhs)(tparams, desugarRHS (body))
268270 case _ =>
269271 rhs
270272
271- val tdef1 = cpy.TypeDef (tdef)(rhs = desugarRhs (tdef.rhs))
273+ val tdef1 = cpy.TypeDef (tdef)(rhs = desugarRHS (tdef.rhs))
272274 // Under x.modularity, if there was a context bound, and `tdef`s name as a term name is
273275 // neither a name of an existing parameter nor a name of generated evidence for
274276 // the same method, add a WitnessAnnotation with all generated evidence names to `tdef`.
@@ -695,10 +697,10 @@ object desugar {
695697 case _ => false
696698 }
697699
698- def isRepeated (tree : Tree ): Boolean = stripByNameType(tree) match {
700+ /** Is this a repeated argument x* (using a spread operator)? */
701+ def isRepeated (tree : Tree ): Boolean = stripByNameType(tree) match
699702 case PostfixOp (_, Ident (tpnme.raw.STAR )) => true
700703 case _ => false
701- }
702704
703705 def appliedRef (tycon : Tree , tparams : List [TypeDef ] = constrTparams, widenHK : Boolean = false ) = {
704706 val targs = for (tparam <- tparams) yield {
@@ -1218,7 +1220,7 @@ object desugar {
12181220
12191221 /** Extract a synthesized given name from a type tree. This is used for
12201222 * both anonymous givens and (under x.modularity) deferred givens.
1221- * @param followArgs If true include argument types in the name
1223+ * @param followArgs if true include argument types in the name
12221224 */
12231225 private class NameExtractor (followArgs : Boolean ) extends UntypedTreeAccumulator [String ] {
12241226 private def extractArgs (args : List [Tree ])(using Context ): String =
0 commit comments