@@ -256,17 +256,6 @@ object desugar {
256
256
evidenceParamBuf.toList)
257
257
end elimContextBounds
258
258
259
- // TODO: typing causes problems, so using this hack ATM that cannot handle all cases of applying @precise
260
- def isPreciseAnnot (tree : untpd.Tree )(using Context ): Boolean =
261
- tree match
262
- case Apply (Select (New (Ident (n)), _), Nil ) => n == defn.PreciseAnnot .name
263
- // inContext(ctx.fresh.setReporter(Reporter.NoReporter).setExploreTyperState()) {
264
- // try
265
- // ctx.typer.typedExpr(clsSel).tpe.classSymbol == defn.PreciseAnnot
266
- // catch case _ : Throwable => false
267
- // }
268
- case _ => false
269
-
270
259
def addDefaultGetters (meth : DefDef )(using Context ): Tree =
271
260
272
261
/** The longest prefix of parameter lists in paramss whose total number of
@@ -392,10 +381,9 @@ object desugar {
392
381
393
382
@ sharable private val synthetic = Modifiers (Synthetic )
394
383
395
- private def toDefParam (tparam : TypeDef , keepAnnotations : Boolean )( using Context ) : TypeDef = {
384
+ private def toDefParam (tparam : TypeDef , keepAnnotations : Boolean ): TypeDef = {
396
385
var mods = tparam.rawMods
397
- val onlyPreciseAnnot = mods.annotations.filter(isPreciseAnnot)
398
- if (! keepAnnotations) mods = mods.withAnnotations(onlyPreciseAnnot)
386
+ if (! keepAnnotations) mods = mods.withAnnotations(Nil )
399
387
tparam.withMods(mods & EmptyFlags | Param )
400
388
}
401
389
private def toDefParam (vparam : ValDef , keepAnnotations : Boolean , keepDefault : Boolean ): ValDef = {
@@ -486,7 +474,8 @@ object desugar {
486
474
// Annotations on class _type_ parameters are set on the derived parameters
487
475
// but not on the constructor parameters. The reverse is true for
488
476
// annotations on class _value_ parameters.
489
- val constrTparams = impliedTparams.map(toDefParam(_, keepAnnotations = false ))
477
+ val keepAnnotations = cdef.mods.flags.is(Flags .Implicit )
478
+ val constrTparams = impliedTparams.map(toDefParam(_, keepAnnotations = keepAnnotations))
490
479
val constrVparamss =
491
480
if (originalVparamss.isEmpty) { // ensure parameter list is non-empty
492
481
if (isCaseClass)
0 commit comments