Skip to content

Commit aa8b454

Browse files
committed
Rename ImplicitDef -> ImplicitRef
1 parent 914d6a3 commit aa8b454

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ object Contexts {
201201
def implicits: ContextualImplicits = {
202202
if (implicitsCache == null )
203203
implicitsCache = {
204-
val implicitRefs: List[ImplicitDef] =
204+
val implicitRefs: List[ImplicitRef] =
205205
if (isClassDefContext)
206206
try owner.thisType.implicitMembers
207207
catch {

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1955,15 +1955,15 @@ object Types {
19551955
}
19561956

19571957
/** A reference to an implicit definition. This can be either a TermRef or a
1958-
* Implicits.RenamedImplicitDef.
1958+
* Implicits.RenamedImplicitRef.
19591959
*/
1960-
trait ImplicitDef {
1960+
trait ImplicitRef {
19611961
def implicitName(implicit ctx: Context): TermName
1962-
def implicitRef: TermRef
1962+
def underlyingRef: TermRef
19631963
}
19641964

19651965
abstract case class TermRef(override val prefix: Type, var designator: Designator)
1966-
extends NamedType with SingletonType with ImplicitDef {
1966+
extends NamedType with SingletonType with ImplicitRef {
19671967

19681968
type ThisType = TermRef
19691969
type ThisName = TermName
@@ -1983,7 +1983,7 @@ object Types {
19831983
denot.altsWith(p).map(withDenot(_))
19841984

19851985
def implicitName(implicit ctx: Context): TermName = name
1986-
def implicitRef = this
1986+
def underlyingRef = this
19871987
}
19881988

19891989
abstract case class TypeRef(override val prefix: Type, var designator: Designator) extends NamedType {

compiler/src/dotty/tools/dotc/typer/Implicits.scala

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ object Implicits {
4848
/** An implicit definition `implicitRef` that is visible under a different name, `alias`.
4949
* Gets generated if an implicit ref is imported via a renaming import.
5050
*/
51-
class RenamedImplicitDef(val implicitRef: TermRef, val alias: TermName) extends ImplicitDef {
51+
class RenamedImplicitRef(val underlyingRef: TermRef, val alias: TermName) extends ImplicitRef {
5252
def implicitName(implicit ctx: Context): TermName = alias
5353
}
5454

5555
/** An eligible implicit candidate, consisting of an implicit reference and a nesting level */
56-
case class Candidate(implicitDef: ImplicitDef, level: Int) {
57-
def ref: TermRef = implicitDef.implicitRef
56+
case class Candidate(implicitRef: ImplicitRef, level: Int) {
57+
def ref: TermRef = implicitRef.underlyingRef
5858
}
5959

6060
/** A common base class of contextual implicits and of-type implicits which
@@ -68,7 +68,7 @@ object Implicits {
6868
def level: Int = 0
6969

7070
/** The implicit references */
71-
def refs: List[ImplicitDef]
71+
def refs: List[ImplicitRef]
7272

7373
/** Return those references in `refs` that are compatible with type `pt`. */
7474
protected def filterMatching(pt: Type)(implicit ctx: Context): List[Candidate] = track("filterMatching") {
@@ -147,7 +147,7 @@ object Implicits {
147147
else {
148148
val nestedCtx = ctx.fresh.addMode(Mode.TypevarsMissContext)
149149
refs
150-
.filter(ref => nestedCtx.typerState.test(refMatches(ref.implicitRef)(nestedCtx)))
150+
.filter(ref => nestedCtx.typerState.test(refMatches(ref.underlyingRef)(nestedCtx)))
151151
.map(Candidate(_, level))
152152
}
153153
}
@@ -159,7 +159,7 @@ object Implicits {
159159
*/
160160
class OfTypeImplicits(tp: Type, val companionRefs: TermRefSet)(initctx: Context) extends ImplicitRefs(initctx) {
161161
assert(initctx.typer != null)
162-
lazy val refs: List[ImplicitDef] = {
162+
lazy val refs: List[ImplicitRef] = {
163163
val buf = new mutable.ListBuffer[TermRef]
164164
for (companion <- companionRefs) buf ++= companion.implicitMembers
165165
buf.toList
@@ -185,7 +185,7 @@ object Implicits {
185185
* name, b, whereas the name of the symbol is the original name, a.
186186
* @param outerCtx the next outer context that makes visible further implicits
187187
*/
188-
class ContextualImplicits(val refs: List[ImplicitDef], val outerImplicits: ContextualImplicits)(initctx: Context) extends ImplicitRefs(initctx) {
188+
class ContextualImplicits(val refs: List[ImplicitRef], val outerImplicits: ContextualImplicits)(initctx: Context) extends ImplicitRefs(initctx) {
189189
private val eligibleCache = new mutable.AnyRefMap[Type, List[Candidate]]
190190

191191
/** The level increases if current context has a different owner or scope than
@@ -827,7 +827,7 @@ trait Implicits { self: Typer =>
827827
pt)
828828
val generated1 = adapt(generated, pt)
829829
lazy val shadowing =
830-
typed(untpd.Ident(cand.implicitDef.implicitName) withPos pos.toSynthetic, funProto)(
830+
typed(untpd.Ident(cand.implicitRef.implicitName) withPos pos.toSynthetic, funProto)(
831831
nestedContext().addMode(Mode.ImplicitShadowing).setExploreTyperState())
832832
def refSameAs(shadowing: Tree): Boolean =
833833
ref.symbol == closureBody(shadowing).symbol || {

compiler/src/dotty/tools/dotc/typer/ImportInfo.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import printing.{Printer, Showable}
99
import util.SimpleIdentityMap
1010
import Symbols._, Names._, Denotations._, Types._, Contexts._, StdNames._, Flags._
1111
import Decorators.StringInterpolators
12-
import Implicits.RenamedImplicitDef
12+
import Implicits.RenamedImplicitRef
1313

1414
object ImportInfo {
1515
/** The import info for a root import from given symbol `sym` */
@@ -93,7 +93,7 @@ class ImportInfo(symf: Context => Symbol, val selectors: List[untpd.Tree],
9393
}
9494

9595
/** The implicit references imported by this import clause */
96-
def importedImplicits(implicit ctx: Context): List[ImplicitDef] = {
96+
def importedImplicits(implicit ctx: Context): List[ImplicitRef] = {
9797
val pre = site
9898
if (isWildcardImport) {
9999
val refs = pre.implicitMembers
@@ -107,7 +107,7 @@ class ImportInfo(symf: Context => Symbol, val selectors: List[untpd.Tree],
107107
val original = reverseMapping(renamed)
108108
val ref = TermRef(pre, original, denot)
109109
if (renamed == original) ref
110-
else new RenamedImplicitDef(ref, renamed)
110+
else new RenamedImplicitRef(ref, renamed)
111111
}
112112
}
113113

0 commit comments

Comments
 (0)