Skip to content

Commit 357a2aa

Browse files
committed
Remove the previously added FromImplicit flag
1 parent 2e6c00b commit 357a2aa

File tree

5 files changed

+12
-7
lines changed

5 files changed

+12
-7
lines changed

compiler/src/dotty/tools/dotc/ast/Desugar.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ object desugar {
635635
ValDef(vparam.name, vparam.tpt, vparam.rhs)
636636
.withSpan(vparam.span)
637637
.withAttachmentsFrom(vparam)
638-
.withMods(mods & (GivenOrImplicit | Erased | hasDefault | Tracked | FromImplicit) | Param)
638+
.withMods(mods & (GivenOrImplicit | Erased | hasDefault | Tracked) | Param)
639639
}
640640

641641
/** Desugar type def (not param): Under x.moduliity this can expand

compiler/src/dotty/tools/dotc/ast/untpd.scala

+1-1
Original file line numberDiff line numberDiff 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

compiler/src/dotty/tools/dotc/core/Flags.scala

-3
Original file line numberDiff line numberDiff line change
@@ -436,9 +436,6 @@ object Flags {
436436
/** Symbol is a constructor proxy (either companion, or apply method) */
437437
val (ConstructorProxy @ _, _, _) = newFlags(62, "<constructor proxy>") // (could be merged with Lifted)
438438

439-
/** Changed from implicit with -Yimplicits-as-given flags */
440-
val (FromImplicit @ _, _, _) = newFlags(63, "<from implicit>")
441-
442439
// --------- Combined Flag Sets and Conjunctions ----------------------
443440

444441
/** All possible flags */

compiler/src/dotty/tools/dotc/core/NamerOps.scala

+2-2
Original file line numberDiff line numberDiff 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

compiler/src/dotty/tools/dotc/core/Symbols.scala

+8
Original file line numberDiff line numberDiff 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`. */

0 commit comments

Comments
 (0)