@@ -173,17 +173,17 @@ object desugar {
173
173
vparamss = (setterParam :: Nil ) :: Nil ,
174
174
tpt = TypeTree (defn.UnitType ),
175
175
rhs = setterRhs
176
- ).withMods((mods | Accessor ) &~ (CaseAccessor | Implicit | Given | Lazy ))
176
+ ).withMods((mods | Accessor ) &~ (CaseAccessor | ImplicitOrGiven | Lazy ))
177
177
Thicket (vdef, setter)
178
178
}
179
179
else vdef
180
180
}
181
181
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 ] =
183
183
for (tpt <- tpts) yield {
184
184
val paramFlags : FlagSet = if (forPrimaryConstructor) PrivateLocalParamAccessor else Param
185
185
val epname = EvidenceParamName .fresh()
186
- ValDef (epname, tpt, EmptyTree ).withFlags(paramFlags | Implicit | contextualFlag )
186
+ ValDef (epname, tpt, EmptyTree ).withFlags(paramFlags | implicitFlag )
187
187
}
188
188
189
189
/** 1. Expand context bounds to evidence params. E.g.,
@@ -219,7 +219,7 @@ object desugar {
219
219
val epbuf = new ListBuffer [ValDef ]
220
220
def desugarContextBounds (rhs : Tree ): Tree = rhs match {
221
221
case ContextBounds (tbounds, cxbounds) =>
222
- epbuf ++= makeImplicitParameters(cxbounds, forPrimaryConstructor = isPrimaryConstructor)
222
+ epbuf ++= makeImplicitParameters(cxbounds, Implicit , forPrimaryConstructor = isPrimaryConstructor)
223
223
tbounds
224
224
case LambdaTypeTree (tparams, body) =>
225
225
cpy.LambdaTypeTree (rhs)(tparams, desugarContextBounds(body))
@@ -322,7 +322,7 @@ object desugar {
322
322
meth
323
323
case evidenceParams =>
324
324
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 =>
326
326
((evidenceParams ++ vparams) :: rvparamss).reverse
327
327
case _ =>
328
328
meth.vparamss :+ evidenceParams
@@ -333,7 +333,7 @@ object desugar {
333
333
/** The implicit evidence parameters of `meth`, as generated by `desugar.defDef` */
334
334
private def evidenceParams (meth : DefDef )(implicit ctx : Context ): List [ValDef ] =
335
335
meth.vparamss.reverse match {
336
- case (vparams @ (vparam :: _)) :: _ if vparam.mods is Implicit =>
336
+ case (vparams @ (vparam :: _)) :: _ if vparam.mods is ImplicitOrGiven =>
337
337
vparams.dropWhile(! _.name.is(EvidenceParamName ))
338
338
case _ =>
339
339
Nil
@@ -344,7 +344,7 @@ object desugar {
344
344
private def toDefParam (tparam : TypeDef ): TypeDef =
345
345
tparam.withMods(tparam.rawMods & EmptyFlags | Param )
346
346
private def toDefParam (vparam : ValDef ): ValDef =
347
- vparam.withMods(vparam.rawMods & (Implicit | Erased ) | Param )
347
+ vparam.withMods(vparam.rawMods & (ImplicitOrGiven | Erased ) | Param )
348
348
349
349
/** The expansion of a class definition. See inline comments for what is involved */
350
350
def classDef (cdef : TypeDef )(implicit ctx : Context ): Tree = {
@@ -412,7 +412,7 @@ object desugar {
412
412
if (isCaseClass && originalTparams.isEmpty)
413
413
ctx.error(CaseClassMissingParamList (cdef), namePos)
414
414
ListOfNil
415
- } else if (isCaseClass && originalVparamss.head.exists(_.mods.is(Implicit ))) {
415
+ } else if (isCaseClass && originalVparamss.head.exists(_.mods.is(ImplicitOrGiven ))) {
416
416
ctx.error(" Case classes should have a non-implicit parameter list" , namePos)
417
417
ListOfNil
418
418
}
@@ -507,18 +507,17 @@ object desugar {
507
507
// new C[Ts](paramss)
508
508
lazy val creatorExpr = {
509
509
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
511
511
Nil :: constrVparamss
512
512
case _ =>
513
513
constrVparamss
514
514
}
515
515
val nu = (makeNew(classTypeRef) /: vparamss) { (nu, vparams) =>
516
516
val app = Apply (nu, vparams.map(refOfDef))
517
517
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
520
520
}
521
- app
522
521
}
523
522
ensureApplied(nu)
524
523
}
@@ -1196,7 +1195,7 @@ object desugar {
1196
1195
def makeContextualFunction (formals : List [Type ], body : Tree , isErased : Boolean )(implicit ctx : Context ): Tree = {
1197
1196
val mods = if (isErased) Given | Erased else Given
1198
1197
val params = makeImplicitParameters(formals.map(TypeTree ), mods)
1199
- new FunctionWithMods (params, body, Modifiers (Implicit | mods))
1198
+ new FunctionWithMods (params, body, Modifiers (mods))
1200
1199
}
1201
1200
1202
1201
/** Add annotation to tree:
0 commit comments