Skip to content

Commit f66b17e

Browse files
committed
Rename Implied -> Delegate
Todo: Should do the same in Tasty reflect
1 parent dbcb45c commit f66b17e

31 files changed

+103
-103
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ object desugar {
444444
if (enumCases.isEmpty)
445445
ctx.error("Enumerations must constain at least one case", namePos)
446446
val enumCompanionRef = new TermRefTree()
447-
val enumImport = Import(importImplied = false, enumCompanionRef, enumCases.flatMap(caseIds))
447+
val enumImport = Import(importDelegate = false, enumCompanionRef, enumCases.flatMap(caseIds))
448448
(enumImport :: enumStats, enumCases, enumCompanionRef)
449449
}
450450
else (stats, Nil, EmptyTree)
@@ -703,7 +703,7 @@ object desugar {
703703
// synthetic implicit C[Ts](p11: T11, ..., p1N: T1N) ... (pM1: TM1, ..., pMN: TMN): C[Ts] =
704704
// new C[Ts](p11, ..., p1N) ... (pM1, ..., pMN) =
705705
val implicitWrappers =
706-
if (!mods.isOneOf(ImplicitOrImplied))
706+
if (!mods.isOneOf(ImplicitOrDelegate))
707707
Nil
708708
else if (ctx.owner.is(Package)) {
709709
ctx.error(TopLevelImplicitClass(cdef), cdef.sourcePos)
@@ -717,7 +717,7 @@ object desugar {
717717
ctx.error(ImplicitCaseClass(cdef), cdef.sourcePos)
718718
Nil
719719
}
720-
else if (arity != 1 && !mods.is(Implied)) {
720+
else if (arity != 1 && !mods.is(Delegate)) {
721721
ctx.error(ImplicitClassPrimaryConstructorArity(), cdef.sourcePos)
722722
Nil
723723
}
@@ -731,7 +731,7 @@ object desugar {
731731
// implicit wrapper is typechecked in same scope as constructor, so
732732
// we can reuse the constructor parameters; no derived params are needed.
733733
DefDef(className.toTermName, constrTparams, defParamss, classTypeRef, creatorExpr)
734-
.withMods(companionMods | mods.flags.toTermFlags & ImplicitOrImplied | Synthetic | Final)
734+
.withMods(companionMods | mods.flags.toTermFlags & ImplicitOrDelegate | Synthetic | Final)
735735
.withSpan(cdef.span) :: Nil
736736
}
737737

@@ -1109,8 +1109,8 @@ object desugar {
11091109
def needsObject(stat: Tree) = stat match {
11101110
case _: ValDef | _: PatDef | _: DefDef | _: Export => true
11111111
case stat: ModuleDef =>
1112-
stat.mods.isOneOf(ImplicitOrImplied) || opaqueNames.contains(stat.name.stripModuleClassSuffix.toTypeName)
1113-
case stat: TypeDef => !stat.isClassDef || stat.mods.isOneOf(ImplicitOrImplied)
1112+
stat.mods.isOneOf(ImplicitOrDelegate) || opaqueNames.contains(stat.name.stripModuleClassSuffix.toTypeName)
1113+
case stat: TypeDef => !stat.isClassDef || stat.mods.isOneOf(ImplicitOrDelegate)
11141114
case _ => false
11151115
}
11161116
val (nestedStats, topStats) = pdef.stats.partition(needsObject)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,7 @@ object TreeInfo {
872872
/** The expression has no side effects */
873873
val Pure: PurityLevel = new PurityLevel(3)
874874

875-
/** Running the expression a second time has no side effects. Implied by `Pure`. */
875+
/** Running the expression a second time has no side effects. Delegate by `Pure`. */
876876
val Idempotent: PurityLevel = new PurityLevel(1)
877877

878878
val Impure: PurityLevel = new PurityLevel(0)

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ object Trees {
750750
def unforced: LazyTree = preRhs
751751
protected def force(x: AnyRef): Unit = preRhs = x
752752

753-
override def disableOverlapChecks = rawMods.is(Implied)
753+
override def disableOverlapChecks = rawMods.is(Delegate)
754754
// disable order checks for implicit aliases since their given clause follows
755755
// their for clause, but the two appear swapped in the DefDef.
756756
}
@@ -801,7 +801,7 @@ object Trees {
801801
* where a selector is either an untyped `Ident`, `name` or
802802
* an untyped thicket consisting of `name` and `rename`.
803803
*/
804-
case class Import[-T >: Untyped] private[ast] (importImplied: Boolean, expr: Tree[T], selectors: List[Tree[Untyped]])(implicit @constructorOnly src: SourceFile)
804+
case class Import[-T >: Untyped] private[ast] (importDelegate: Boolean, expr: Tree[T], selectors: List[Tree[Untyped]])(implicit @constructorOnly src: SourceFile)
805805
extends DenotingTree[T] {
806806
type ThisTree[-T >: Untyped] = Import[T]
807807
}
@@ -1200,9 +1200,9 @@ object Trees {
12001200
case tree: Template if (constr eq tree.constr) && (parents eq tree.parents) && (derived eq tree.derived) && (self eq tree.self) && (body eq tree.unforcedBody) => tree
12011201
case tree => finalize(tree, untpd.Template(constr, parents, derived, self, body)(sourceFile(tree)))
12021202
}
1203-
def Import(tree: Tree)(importImplied: Boolean, expr: Tree, selectors: List[untpd.Tree])(implicit ctx: Context): Import = tree match {
1204-
case tree: Import if (importImplied == tree.importImplied) && (expr eq tree.expr) && (selectors eq tree.selectors) => tree
1205-
case _ => finalize(tree, untpd.Import(importImplied, expr, selectors)(sourceFile(tree)))
1203+
def Import(tree: Tree)(importDelegate: Boolean, expr: Tree, selectors: List[untpd.Tree])(implicit ctx: Context): Import = tree match {
1204+
case tree: Import if (importDelegate == tree.importDelegate) && (expr eq tree.expr) && (selectors eq tree.selectors) => tree
1205+
case _ => finalize(tree, untpd.Import(importDelegate, expr, selectors)(sourceFile(tree)))
12061206
}
12071207
def PackageDef(tree: Tree)(pid: RefTree, stats: List[Tree])(implicit ctx: Context): PackageDef = tree match {
12081208
case tree: PackageDef if (pid eq tree.pid) && (stats eq tree.stats) => tree
@@ -1343,8 +1343,8 @@ object Trees {
13431343
cpy.TypeDef(tree)(name, transform(rhs))
13441344
case tree @ Template(constr, parents, self, _) if tree.derived.isEmpty =>
13451345
cpy.Template(tree)(transformSub(constr), transform(tree.parents), Nil, transformSub(self), transformStats(tree.body))
1346-
case Import(importImplied, expr, selectors) =>
1347-
cpy.Import(tree)(importImplied, transform(expr), selectors)
1346+
case Import(importDelegate, expr, selectors) =>
1347+
cpy.Import(tree)(importDelegate, transform(expr), selectors)
13481348
case PackageDef(pid, stats) =>
13491349
cpy.PackageDef(tree)(transformSub(pid), transformStats(stats)(localCtx))
13501350
case Annotated(arg, annot) =>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,8 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
333333
Block(cdef :: Nil, New(cls.typeRef, Nil))
334334
}
335335

336-
def Import(importImplied: Boolean, expr: Tree, selectors: List[untpd.Tree])(implicit ctx: Context): Import =
337-
ta.assignType(untpd.Import(importImplied, expr, selectors), ctx.newImportSymbol(ctx.owner, expr))
336+
def Import(importDelegate: Boolean, expr: Tree, selectors: List[untpd.Tree])(implicit ctx: Context): Import =
337+
ta.assignType(untpd.Import(importDelegate, expr, selectors), ctx.newImportSymbol(ctx.owner, expr))
338338

339339
def PackageDef(pid: RefTree, stats: List[Tree])(implicit ctx: Context): PackageDef =
340340
ta.assignType(untpd.PackageDef(pid, stats), pid)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
167167

168168
case class Inline()(implicit @constructorOnly src: SourceFile) extends Mod(Flags.Inline)
169169

170-
case class Implied()(implicit @constructorOnly src: SourceFile) extends Mod(Flags.Implied)
170+
case class Delegate()(implicit @constructorOnly src: SourceFile) extends Mod(Flags.Delegate)
171171
}
172172

173173
/** Modifiers and annotations for definitions
@@ -345,7 +345,7 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
345345
def Template(constr: DefDef, parents: List[Tree], derived: List[Tree], self: ValDef, body: LazyTreeList)(implicit src: SourceFile): Template =
346346
if (derived.isEmpty) new Template(constr, parents, self, body)
347347
else new DerivingTemplate(constr, parents ++ derived, self, body, derived.length)
348-
def Import(importImplied: Boolean, expr: Tree, selectors: List[Tree])(implicit src: SourceFile): Import = new Import(importImplied, expr, selectors)
348+
def Import(importDelegate: Boolean, expr: Tree, selectors: List[Tree])(implicit src: SourceFile): Import = new Import(importDelegate, expr, selectors)
349349
def PackageDef(pid: RefTree, stats: List[Tree])(implicit src: SourceFile): PackageDef = new PackageDef(pid, stats)
350350
def Annotated(arg: Tree, annot: Tree)(implicit src: SourceFile): Annotated = new Annotated(arg, annot)
351351

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import Scopes._
1313
import Uniques._
1414
import ast.Trees._
1515
import ast.untpd
16-
import Flags.ImplicitOrImpliedOrGiven
16+
import Flags.ImplicitOrDelegateOrGiven
1717
import util.{FreshNameCreator, NoSource, SimpleIdentityMap, SourceFile}
1818
import typer.{Implicits, ImportInfo, Inliner, NamerContextOps, SearchHistory, SearchRoot, TypeAssigner, Typer}
1919
import Implicits.ContextualImplicits
@@ -214,7 +214,7 @@ object Contexts {
214214
implicitsCache = {
215215
val implicitRefs: List[ImplicitRef] =
216216
if (isClassDefContext)
217-
try owner.thisType.implicitMembers(ImplicitOrImpliedOrGiven)
217+
try owner.thisType.implicitMembers(ImplicitOrDelegateOrGiven)
218218
catch {
219219
case ex: CyclicReference => Nil
220220
}
@@ -404,7 +404,7 @@ object Contexts {
404404
case _ => None
405405
}
406406
ctx.fresh.setImportInfo(
407-
new ImportInfo(implicit ctx => sym, imp.selectors, impNameOpt, imp.importImplied))
407+
new ImportInfo(implicit ctx => sym, imp.selectors, impNameOpt, imp.importDelegate))
408408
}
409409

410410
/** Does current phase use an erased types interpretation? */

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ object Flags {
344344
/** Symbol is a Java default method */
345345
val (_, DefaultMethod @ _, _) = newFlags(38, "<defaultmethod>")
346346

347-
val (Implied @ _, _, _) = newFlags(39, "delegate")
347+
val (Delegate @ _, _, _) = newFlags(39, "delegate")
348348

349349
/** Symbol is an enum class or enum case (if used with case) */
350350
val (Enum @ _, _, _) = newFlags(40, "<enum>")
@@ -427,7 +427,7 @@ object Flags {
427427

428428
/** Flags representing source modifiers */
429429
private val CommonSourceModifierFlags: FlagSet =
430-
commonFlags(Private, Protected, Final, Case, Implicit, Implied, Given, Override, JavaStatic)
430+
commonFlags(Private, Protected, Final, Case, Implicit, Delegate, Given, Override, JavaStatic)
431431

432432
val TypeSourceModifierFlags: FlagSet =
433433
CommonSourceModifierFlags.toTypeFlags | Abstract | Sealed | Opaque
@@ -449,7 +449,7 @@ object Flags {
449449
HigherKinded, Param, ParamAccessor,
450450
Scala2ExistentialCommon, Mutable, Opaque, Touched, JavaStatic,
451451
OuterOrCovariant, LabelOrContravariant, CaseAccessor,
452-
Extension, NonMember, Implicit, Given, Implied, Permanent, Synthetic,
452+
Extension, NonMember, Implicit, Given, Delegate, Permanent, Synthetic,
453453
SuperAccessorOrScala2x, Inline)
454454

455455
/** Flags that are not (re)set when completing the denotation, or, if symbol is
@@ -508,14 +508,14 @@ object Flags {
508508

509509
/** Flags that can apply to a module val */
510510
val RetainedModuleValFlags: FlagSet = RetainedModuleValAndClassFlags |
511-
Override | Final | Method | Implicit | Implied | Lazy |
511+
Override | Final | Method | Implicit | Delegate | Lazy |
512512
Accessor | AbsOverride | StableRealizable | Captured | Synchronized | Erased
513513

514514
/** Flags that can apply to a module class */
515515
val RetainedModuleClassFlags: FlagSet = RetainedModuleValAndClassFlags | Enum
516516

517517
/** Flags retained in export forwarders */
518-
val RetainedExportFlags = ImplicitOrImpliedOrGiven | Extension
518+
val RetainedExportFlags = ImplicitOrDelegateOrGiven | Extension
519519

520520
// ------- Other flag sets -------------------------------------
521521

@@ -539,13 +539,13 @@ object Flags {
539539
/** An inline method or inline argument proxy */
540540
val InlineOrProxy: FlagSet = Inline | InlineProxy
541541

542-
val ImplicitOrImplied: FlagSet = Implicit | Implied
543-
val ImplicitOrImpliedOrGiven: FlagSet = Given | Implicit | Implied
542+
val ImplicitOrDelegate: FlagSet = Implicit | Delegate
543+
val ImplicitOrDelegateOrGiven: FlagSet = Given | Implicit | Delegate
544544
val ImplicitOrGiven: FlagSet = Given | Implicit
545545

546-
val ImpliedOrGiven: FlagSet = Implied | Given
546+
val DelegateOrGiven: FlagSet = Delegate | Given
547547

548-
val ImplicitOrImpliedOrGivenTerm = ImplicitOrImpliedOrGiven.toTermFlags
548+
val ImplicitOrDelegateOrGivenTerm = ImplicitOrDelegateOrGiven.toTermFlags
549549

550550

551551
/** Assumed to be pure */
@@ -573,7 +573,7 @@ object Flags {
573573
val ExtensionMethod: FlagSet = Extension | Method
574574

575575
/** An implied method */
576-
val SyntheticImpliedMethod: FlagSet = Synthetic | Implied | Method
576+
val SyntheticDelegateMethod: FlagSet = Synthetic | Delegate | Method
577577

578578
/** An enum case */
579579
val EnumCase: FlagSet = Enum | Case

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ object Scopes {
409409
var irefs = new mutable.ListBuffer[TermRef]
410410
var e = lastEntry
411411
while (e ne null) {
412-
if (e.sym.isOneOf(ImplicitOrImpliedOrGiven)) {
412+
if (e.sym.isOneOf(ImplicitOrDelegateOrGiven)) {
413413
val d = e.sym.denot
414414
irefs += TermRef(NoPrefix, d.symbol.asTerm).withDenot(d)
415415
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1943,7 +1943,7 @@ object SymDenotations {
19431943
if (keepOnly eq implicitFilter)
19441944
if (this.is(Package)) Iterator.empty
19451945
// implicits in package objects are added by the overriding `memberNames` in `PackageClassDenotation`
1946-
else info.decls.iterator.filter(_.isOneOf(ImplicitOrImpliedOrGiven))
1946+
else info.decls.iterator.filter(_.isOneOf(ImplicitOrDelegateOrGiven))
19471947
else info.decls.iterator
19481948
for (sym <- ownSyms) maybeAdd(sym.name)
19491949
names

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ class CyclicReference private (val denot: SymDenotation) extends TypeError {
142142
}
143143
}
144144
// Give up and give generic errors.
145-
else if (cycleSym.isOneOf(ImplicitOrImpliedOrGiven, butNot = Method) && cycleSym.owner.isTerm)
145+
else if (cycleSym.isOneOf(ImplicitOrDelegateOrGiven, butNot = Method) && cycleSym.owner.isTerm)
146146
CyclicReferenceInvolvingImplicit(cycleSym)
147147
else
148148
CyclicReferenceInvolving(denot)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -787,12 +787,12 @@ object Types {
787787
}
788788

789789
/** The set of implicit term members of this type
790-
* @param kind A subset of {Implicit, Implied} that specifies what kind of implicit should
790+
* @param kind A subset of {Implicit, Delegate} that specifies what kind of implicit should
791791
* be returned
792792
*/
793793
final def implicitMembers(kind: FlagSet)(implicit ctx: Context): List[TermRef] = track("implicitMembers") {
794794
memberDenots(implicitFilter,
795-
(name, buf) => buf ++= member(name).altsWith(_.isOneOf(ImplicitOrImpliedOrGivenTerm & kind)))
795+
(name, buf) => buf ++= member(name).altsWith(_.isOneOf(ImplicitOrDelegateOrGivenTerm & kind)))
796796
.toList.map(d => TermRef(this, d.symbol.asTerm))
797797
}
798798

compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -531,10 +531,10 @@ class TreePickler(pickler: TastyPickler) {
531531
}
532532
pickleStats(tree.constr :: rest)
533533
}
534-
case Import(importImplied, expr, selectors) =>
534+
case Import(importDelegate, expr, selectors) =>
535535
writeByte(IMPORT)
536536
withLength {
537-
if (importImplied) writeByte(IMPLIED)
537+
if (importDelegate) writeByte(IMPLIED)
538538
pickleTree(expr)
539539
pickleSelectors(selectors)
540540
}
@@ -651,7 +651,7 @@ class TreePickler(pickler: TastyPickler) {
651651
if (flags.is(Scala2x)) writeModTag(SCALA2X)
652652
if (isTerm) {
653653
if (flags.is(Implicit)) writeModTag(IMPLICIT)
654-
if (flags.is(Implied)) writeModTag(IMPLIED)
654+
if (flags.is(Delegate)) writeModTag(IMPLIED)
655655
if (flags.is(Erased)) writeModTag(ERASED)
656656
if (flags.is(Lazy, butNot = Module)) writeModTag(LAZY)
657657
if (flags.is(AbsOverride)) { writeModTag(ABSTRACT); writeModTag(OVERRIDE) }

compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ class TreeUnpickler(reader: TastyReader,
607607
case SEALED => addFlag(Sealed)
608608
case CASE => addFlag(Case)
609609
case IMPLICIT => addFlag(Implicit)
610-
case IMPLIED => addFlag(Implied)
610+
case IMPLIED => addFlag(Delegate)
611611
case ERASED => addFlag(Erased)
612612
case LAZY => addFlag(Lazy)
613613
case OVERRIDE => addFlag(Override)
@@ -952,10 +952,10 @@ class TreeUnpickler(reader: TastyReader,
952952
assert(sourcePathAt(start).isEmpty)
953953
readByte()
954954
readEnd()
955-
val importImplied = nextByte == IMPLIED
956-
if (importImplied) readByte()
955+
val importDelegate = nextByte == IMPLIED
956+
if (importDelegate) readByte()
957957
val expr = readTerm()
958-
setSpan(start, Import(importImplied, expr, readSelectors()))
958+
setSpan(start, Import(importDelegate, expr, readSelectors()))
959959
}
960960

961961
def readSelectors()(implicit ctx: Context): List[untpd.Tree] = nextByte match {

compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1059,7 +1059,7 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
10591059
val to = untpd.Ident(toName)
10601060
if (toName.isEmpty) from else untpd.Thicket(from, untpd.Ident(toName))
10611061
})
1062-
Import(importImplied = false, expr, selectors)
1062+
Import(importDelegate = false, expr, selectors)
10631063

10641064
case TEMPLATEtree =>
10651065
setSym()

compiler/src/dotty/tools/dotc/parsing/JavaParsers.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ object JavaParsers {
600600
}
601601

602602
def importCompanionObject(cdef: TypeDef): Tree =
603-
Import(importImplied = false, Ident(cdef.name.toTermName).withSpan(NoSpan), Ident(nme.WILDCARD) :: Nil)
603+
Import(importDelegate = false, Ident(cdef.name.toTermName).withSpan(NoSpan), Ident(nme.WILDCARD) :: Nil)
604604

605605
// Importing the companion object members cannot be done uncritically: see
606606
// ticket #2377 wherein a class contains two static inner classes, each of which
@@ -662,7 +662,7 @@ object JavaParsers {
662662
// case nme.WILDCARD => Pair(ident, Ident(null) withPos Span(-1))
663663
// case _ => Pair(ident, ident)
664664
// }
665-
val imp = atSpan(start) { Import(importImplied = false, qual, List(ident)) }
665+
val imp = atSpan(start) { Import(importDelegate = false, qual, List(ident)) }
666666
imp :: Nil
667667
}
668668
}

0 commit comments

Comments
 (0)