File tree 3 files changed +11
-3
lines changed
compiler/src/dotty/tools/dotc
3 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -210,7 +210,7 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
210
210
211
211
case class Given ()(implicit @ constructorOnly src : SourceFile ) extends Mod (Flags .Given )
212
212
213
- case class GivenFromImplicit ()(implicit @ constructorOnly src : SourceFile ) extends Mod (Flags .Given | Flags . FromImplicit )
213
+ case class GivenFromImplicit ()(implicit @ constructorOnly src : SourceFile ) extends Mod (Flags .Given )
214
214
215
215
case class Erased ()(implicit @ constructorOnly src : SourceFile ) extends Mod (Flags .Erased )
216
216
Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ object NamerOps:
63
63
if ! isConstructor then paramss
64
64
else paramss match
65
65
case TypeSymbols (tparams) :: paramss1 => tparams :: normalizeIfConstructor(paramss1, isConstructor)
66
- case TermSymbols (vparam :: _) :: _ if vparam.is(Implicit ) || vparam.is( FromImplicit ) => Nil :: paramss
66
+ case TermSymbols (vparam :: _) :: _ if vparam.is(Implicit ) || vparam.isGivenFromImplicit => Nil :: paramss
67
67
case _ =>
68
68
if paramss.forall {
69
69
case TermSymbols (vparams) => vparams.nonEmpty && vparams.head.is(Given )
@@ -80,7 +80,7 @@ object NamerOps:
80
80
case TermSymbols (params) :: paramss1 =>
81
81
val (isContextual, isImplicit, fromImplicit) =
82
82
if params.isEmpty then (false , false , false )
83
- else (params.head.is(Given ), params.head.is(Implicit ), params.head.is( FromImplicit ) )
83
+ else (params.head.is(Given ), params.head.is(Implicit ), params.head.isGivenFromImplicit )
84
84
val make = MethodType .companion(isContextual = isContextual, isImplicit = isImplicit, fromImplicit = fromImplicit)
85
85
if isJava then
86
86
for param <- params do
Original file line number Diff line number Diff line change @@ -392,6 +392,14 @@ object Symbols extends SymUtils {
392
392
def paramVariance (using Context ): Variance = denot.variance
393
393
def paramRef (using Context ): TypeRef = denot.typeRef
394
394
395
+ /** Was it an implicit, changed into a given with `-Yimplicit-as-given` */
396
+ def isGivenFromImplicit (using Context ): Boolean =
397
+ ctx.settings.YimplicitAsGiven .value && (
398
+ defTree match
399
+ case defTree : DefTree => defTree.mods.mods.exists(_.isInstanceOf [untpd.Mod .GivenFromImplicit ])
400
+ case _ => false
401
+ )
402
+
395
403
/** Copy a symbol, overriding selective fields.
396
404
* Note that `coord` and `compilationUnitInfo` will be set from the fields in `owner`, not
397
405
* the fields in `sym`. */
You can’t perform that action at this time.
0 commit comments