Skip to content

Commit f3eb86c

Browse files
committed
Rename more ctx fields
1 parent 3515354 commit f3eb86c

File tree

3 files changed

+21
-21
lines changed

3 files changed

+21
-21
lines changed

compiler/src/dotty/tools/dotc/reporting/messages.scala

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2099,7 +2099,7 @@ object messages {
20992099
|This mechanism is used for instance in pattern ${hl("case List(x1, ..., xn)")}""".stripMargin
21002100
}
21012101

2102-
class MemberWithSameNameAsStatic()(implicit val ctx: Context)
2102+
class MemberWithSameNameAsStatic()(using ctx: Context)
21032103
extends SyntaxMsg(MemberWithSameNameAsStaticID) {
21042104
def msg = em"Companion classes cannot define members with same name as a ${hl("@static")} member"
21052105
def explain = ""
@@ -2114,25 +2114,25 @@ object messages {
21142114
|It can be removed without changing the semantics of the program. This may indicate an error.""".stripMargin
21152115
}
21162116

2117-
class TraitCompanionWithMutableStatic()(implicit val ctx: Context)
2117+
class TraitCompanionWithMutableStatic()(using ctx: Context)
21182118
extends SyntaxMsg(TraitCompanionWithMutableStaticID) {
21192119
def msg = em"Companion of traits cannot define mutable @static fields"
21202120
def explain = ""
21212121
}
21222122

2123-
class LazyStaticField()(implicit val ctx: Context)
2123+
class LazyStaticField()(using ctx: Context)
21242124
extends SyntaxMsg(LazyStaticFieldID) {
21252125
def msg = em"Lazy @static fields are not supported"
21262126
def explain = ""
21272127
}
21282128

2129-
class StaticOverridingNonStaticMembers()(implicit val ctx: Context)
2129+
class StaticOverridingNonStaticMembers()(using ctx: Context)
21302130
extends SyntaxMsg(StaticOverridingNonStaticMembersID) {
21312131
def msg = em"${hl("@static")} members cannot override or implement non-static ones"
21322132
def explain = ""
21332133
}
21342134

2135-
class OverloadInRefinement(rsym: Symbol)(implicit val ctx: Context)
2135+
class OverloadInRefinement(rsym: Symbol)(using ctx: Context)
21362136
extends DeclarationMsg(OverloadInRefinementID) {
21372137
def msg = "Refinements cannot introduce overloaded definitions"
21382138
def explain =
@@ -2141,14 +2141,14 @@ object messages {
21412141
}
21422142

21432143
class NoMatchingOverload(val alternatives: List[SingleDenotation], pt: Type)(
2144-
err: Errors)(implicit val ctx: Context)
2144+
err: Errors)(using ctx: Context)
21452145
extends TypeMismatchMsg(NoMatchingOverloadID) {
21462146
def msg =
21472147
em"""None of the ${err.overloadedAltsStr(alternatives)}
21482148
|match ${err.expectedTypeStr(pt)}"""
21492149
def explain = ""
21502150
}
2151-
class StableIdentPattern(tree: untpd.Tree, pt: Type)(implicit val ctx: Context)
2151+
class StableIdentPattern(tree: untpd.Tree, pt: Type)(using ctx: Context)
21522152
extends TypeMsg(StableIdentPatternID) {
21532153
def msg =
21542154
em"""Stable identifier required, but $tree found"""
@@ -2157,7 +2157,7 @@ object messages {
21572157

21582158
class IllegalSuperAccessor(base: Symbol, memberName: Name,
21592159
acc: Symbol, accTp: Type,
2160-
other: Symbol, otherTp: Type)(implicit val ctx: Context) extends DeclarationMsg(IllegalSuperAccessorID) {
2160+
other: Symbol, otherTp: Type)(using ctx: Context) extends DeclarationMsg(IllegalSuperAccessorID) {
21612161
def msg = {
21622162
// The mixin containing a super-call that requires a super-accessor
21632163
val accMixin = acc.owner
@@ -2210,7 +2210,7 @@ object messages {
22102210
def explain = ""
22112211
}
22122212

2213-
class TraitParameterUsedAsParentPrefix(cls: Symbol)(implicit val ctx: Context)
2213+
class TraitParameterUsedAsParentPrefix(cls: Symbol)(using ctx: Context)
22142214
extends DeclarationMsg(TraitParameterUsedAsParentPrefixID) {
22152215
def msg =
22162216
s"${cls.show} cannot extend from a parent that is derived via its own parameters"
@@ -2225,7 +2225,7 @@ object messages {
22252225
|""".stripMargin
22262226
}
22272227

2228-
class UnknownNamedEnclosingClassOrObject(name: TypeName)(implicit val ctx: Context)
2228+
class UnknownNamedEnclosingClassOrObject(name: TypeName)(using ctx: Context)
22292229
extends ReferenceMsg(UnknownNamedEnclosingClassOrObjectID) {
22302230
def msg =
22312231
em"""no enclosing class or object is named '${hl(name.show)}'"""
@@ -2238,13 +2238,13 @@ object messages {
22382238
""".stripMargin
22392239
}
22402240

2241-
class IllegalCyclicTypeReference(sym: Symbol, where: String, lastChecked: Type)(implicit val ctx: Context)
2241+
class IllegalCyclicTypeReference(sym: Symbol, where: String, lastChecked: Type)(using ctx: Context)
22422242
extends CyclicMsg(IllegalCyclicTypeReferenceID) {
22432243
def msg = i"illegal cyclic type reference: ${where} ${hl(lastChecked.show)} of $sym refers back to the type itself"
22442244
def explain = ""
22452245
}
22462246

2247-
class ErasedTypesCanOnlyBeFunctionTypes()(implicit val ctx: Context)
2247+
class ErasedTypesCanOnlyBeFunctionTypes()(using ctx: Context)
22482248
extends SyntaxMsg(ErasedTypesCanOnlyBeFunctionTypesID) {
22492249
def msg = "Types with erased keyword can only be function types `(erased ...) => ...`"
22502250
def explain = ""

compiler/src/dotty/tools/dotc/sbt/ExtractAPI.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ class ExtractAPI extends Phase {
124124
* without going through an intermediate representation, see
125125
* http://www.scala-sbt.org/0.13/docs/Understanding-Recompilation.html#Hashing+an+API+representation
126126
*/
127-
private class ExtractAPICollector(implicit val ctx: Context) extends ThunkHolder {
127+
private class ExtractAPICollector(implicit ctx: Context) extends ThunkHolder {
128128
import tpd._
129129
import xsbti.api
130130

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ object Implicits {
7979
* represents a set of references to implicit definitions.
8080
*/
8181
abstract class ImplicitRefs(initctx: Context) {
82-
implicit val ctx: Context =
82+
implicit val irefCtx: Context =
8383
if (initctx == NoContext) initctx else initctx retractMode Mode.ImplicitsEnabled
8484

8585
/** The nesting level of this context. Non-zero only in ContextialImplicits */
@@ -274,9 +274,9 @@ object Implicits {
274274
*/
275275
override val level: Int =
276276
if (outerImplicits == null) 1
277-
else if (ctx.scala2CompatMode ||
278-
(ctx.owner eq outerImplicits.ctx.owner) &&
279-
(ctx.scope eq outerImplicits.ctx.scope) &&
277+
else if (irefCtx.scala2CompatMode ||
278+
(irefCtx.owner eq outerImplicits.irefCtx.owner) &&
279+
(irefCtx.scope eq outerImplicits.irefCtx.scope) &&
280280
!refs.head.implicitName.is(LazyImplicitName)) outerImplicits.level
281281
else outerImplicits.level + 1
282282

@@ -302,7 +302,7 @@ object Implicits {
302302
if (monitored) record(s"elided eligible refs", elided(this))
303303
eligibles
304304
}
305-
else if (ctx eq NoContext) Nil
305+
else if (irefCtx eq NoContext) Nil
306306
else {
307307
val result = computeEligible(tp)
308308
eligibleCache.put(tp, result)
@@ -311,7 +311,7 @@ object Implicits {
311311
}
312312

313313
private def computeEligible(tp: Type): List[Candidate] = /*>|>*/ trace(i"computeEligible $tp in $refs%, %", implicitsDetailed) /*<|<*/ {
314-
if (monitored) record(s"check eligible refs in ctx", refs.length)
314+
if (monitored) record(s"check eligible refs in irefCtx", refs.length)
315315
val ownEligible = filterMatching(tp)
316316
if (isOuterMost) ownEligible
317317
else ownEligible ::: {
@@ -332,9 +332,9 @@ object Implicits {
332332
if (this == NoContext.implicits) this
333333
else {
334334
val outerExcluded = outerImplicits exclude root
335-
if (ctx.importInfo.site.termSymbol == root) outerExcluded
335+
if (irefCtx.importInfo.site.termSymbol == root) outerExcluded
336336
else if (outerExcluded eq outerImplicits) this
337-
else new ContextualImplicits(refs, outerExcluded)(ctx)
337+
else new ContextualImplicits(refs, outerExcluded)(irefCtx)
338338
}
339339
}
340340

0 commit comments

Comments
 (0)