@@ -173,17 +173,17 @@ object desugar {
173173 vparamss = (setterParam :: Nil ) :: Nil ,
174174 tpt = TypeTree (defn.UnitType ),
175175 rhs = setterRhs
176- ).withMods((mods | Accessor ) &~ (CaseAccessor | Implicit | Given | Lazy ))
176+ ).withMods((mods | Accessor ) &~ (CaseAccessor | ImplicitOrGiven | Lazy ))
177177 Thicket (vdef, setter)
178178 }
179179 else vdef
180180 }
181181
182- def makeImplicitParameters (tpts : List [Tree ], contextualFlag : FlagSet = EmptyFlags , forPrimaryConstructor : Boolean = false )(implicit ctx : Context ): List [ValDef ] =
182+ def makeImplicitParameters (tpts : List [Tree ], implicitFlag : FlagSet , forPrimaryConstructor : Boolean = false )(implicit ctx : Context ): List [ValDef ] =
183183 for (tpt <- tpts) yield {
184184 val paramFlags : FlagSet = if (forPrimaryConstructor) PrivateLocalParamAccessor else Param
185185 val epname = EvidenceParamName .fresh()
186- ValDef (epname, tpt, EmptyTree ).withFlags(paramFlags | Implicit | contextualFlag )
186+ ValDef (epname, tpt, EmptyTree ).withFlags(paramFlags | implicitFlag )
187187 }
188188
189189 /** 1. Expand context bounds to evidence params. E.g.,
@@ -219,7 +219,7 @@ object desugar {
219219 val epbuf = new ListBuffer [ValDef ]
220220 def desugarContextBounds (rhs : Tree ): Tree = rhs match {
221221 case ContextBounds (tbounds, cxbounds) =>
222- epbuf ++= makeImplicitParameters(cxbounds, forPrimaryConstructor = isPrimaryConstructor)
222+ epbuf ++= makeImplicitParameters(cxbounds, Implicit , forPrimaryConstructor = isPrimaryConstructor)
223223 tbounds
224224 case LambdaTypeTree (tparams, body) =>
225225 cpy.LambdaTypeTree (rhs)(tparams, desugarContextBounds(body))
@@ -322,7 +322,7 @@ object desugar {
322322 meth
323323 case evidenceParams =>
324324 val vparamss1 = meth.vparamss.reverse match {
325- case (vparams @ (vparam :: _)) :: rvparamss if vparam.mods is Implicit =>
325+ case (vparams @ (vparam :: _)) :: rvparamss if vparam.mods is ImplicitOrGiven =>
326326 ((evidenceParams ++ vparams) :: rvparamss).reverse
327327 case _ =>
328328 meth.vparamss :+ evidenceParams
@@ -333,7 +333,7 @@ object desugar {
333333 /** The implicit evidence parameters of `meth`, as generated by `desugar.defDef` */
334334 private def evidenceParams (meth : DefDef )(implicit ctx : Context ): List [ValDef ] =
335335 meth.vparamss.reverse match {
336- case (vparams @ (vparam :: _)) :: _ if vparam.mods is Implicit =>
336+ case (vparams @ (vparam :: _)) :: _ if vparam.mods is ImplicitOrGiven =>
337337 vparams.dropWhile(! _.name.is(EvidenceParamName ))
338338 case _ =>
339339 Nil
@@ -344,7 +344,7 @@ object desugar {
344344 private def toDefParam (tparam : TypeDef ): TypeDef =
345345 tparam.withMods(tparam.rawMods & EmptyFlags | Param )
346346 private def toDefParam (vparam : ValDef ): ValDef =
347- vparam.withMods(vparam.rawMods & (Implicit | Erased ) | Param )
347+ vparam.withMods(vparam.rawMods & (ImplicitOrGiven | Erased ) | Param )
348348
349349 /** The expansion of a class definition. See inline comments for what is involved */
350350 def classDef (cdef : TypeDef )(implicit ctx : Context ): Tree = {
@@ -412,7 +412,7 @@ object desugar {
412412 if (isCaseClass && originalTparams.isEmpty)
413413 ctx.error(CaseClassMissingParamList (cdef), namePos)
414414 ListOfNil
415- } else if (isCaseClass && originalVparamss.head.exists(_.mods.is(Implicit ))) {
415+ } else if (isCaseClass && originalVparamss.head.exists(_.mods.is(ImplicitOrGiven ))) {
416416 ctx.error(" Case classes should have a non-implicit parameter list" , namePos)
417417 ListOfNil
418418 }
@@ -507,18 +507,17 @@ object desugar {
507507 // new C[Ts](paramss)
508508 lazy val creatorExpr = {
509509 val vparamss = constrVparamss match {
510- case (vparam :: _) :: _ if vparam.mods.is(Implicit ) => // add a leading () to match class parameters
510+ case (vparam :: _) :: _ if vparam.mods.is(ImplicitOrGiven ) => // add a leading () to match class parameters
511511 Nil :: constrVparamss
512512 case _ =>
513513 constrVparamss
514514 }
515515 val nu = (makeNew(classTypeRef) /: vparamss) { (nu, vparams) =>
516516 val app = Apply (nu, vparams.map(refOfDef))
517517 vparams match {
518- case vparam :: _ if vparam.mods.is(Given ) => app.pushAttachment( ApplyGiven , () )
519- case _ =>
518+ case vparam :: _ if vparam.mods.is(Given ) => app.setGivenApply( )
519+ case _ => app
520520 }
521- app
522521 }
523522 ensureApplied(nu)
524523 }
@@ -1196,7 +1195,7 @@ object desugar {
11961195 def makeContextualFunction (formals : List [Type ], body : Tree , isErased : Boolean )(implicit ctx : Context ): Tree = {
11971196 val mods = if (isErased) Given | Erased else Given
11981197 val params = makeImplicitParameters(formals.map(TypeTree ), mods)
1199- new FunctionWithMods (params, body, Modifiers (Implicit | mods))
1198+ new FunctionWithMods (params, body, Modifiers (mods))
12001199 }
12011200
12021201 /** Add annotation to tree:
0 commit comments