File tree Expand file tree Collapse file tree 3 files changed +11
-3
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 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 {
210210
211211 case class Given ()(implicit @ constructorOnly src : SourceFile ) extends Mod (Flags .Given )
212212
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 )
214214
215215 case class Erased ()(implicit @ constructorOnly src : SourceFile ) extends Mod (Flags .Erased )
216216
Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ object NamerOps:
6363 if ! isConstructor then paramss
6464 else paramss match
6565 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
6767 case _ =>
6868 if paramss.forall {
6969 case TermSymbols (vparams) => vparams.nonEmpty && vparams.head.is(Given )
@@ -80,7 +80,7 @@ object NamerOps:
8080 case TermSymbols (params) :: paramss1 =>
8181 val (isContextual, isImplicit, fromImplicit) =
8282 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 )
8484 val make = MethodType .companion(isContextual = isContextual, isImplicit = isImplicit, fromImplicit = fromImplicit)
8585 if isJava then
8686 for param <- params do
Original file line number Diff line number Diff line change @@ -392,6 +392,14 @@ object Symbols extends SymUtils {
392392 def paramVariance (using Context ): Variance = denot.variance
393393 def paramRef (using Context ): TypeRef = denot.typeRef
394394
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+
395403 /** Copy a symbol, overriding selective fields.
396404 * Note that `coord` and `compilationUnitInfo` will be set from the fields in `owner`, not
397405 * the fields in `sym`. */
You can’t perform that action at this time.
0 commit comments