Skip to content

Commit 0a3f889

Browse files
committed
Rename more ctx fields
1 parent 697b832 commit 0a3f889

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

compiler/src/dotty/tools/dotc/Run.scala

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,8 @@ class Run(comp: Compiler, ictx: Context) extends ImplicitRunInfo with Constraint
6969
private var myCtx = rootContext(ictx)
7070

7171
/** The context created for this run */
72-
def runContext: Context = myCtx
73-
74-
protected implicit def ctx: Context = myCtx
75-
assert(ctx.runId <= Periods.MaxPossibleRunId)
72+
given runContext[Dummy_so_its_a_def] as Context = myCtx
73+
assert(runContext.runId <= Periods.MaxPossibleRunId)
7674

7775
private var myUnits: List[CompilationUnit] = _
7876
private var myUnitsCached: List[CompilationUnit] = _
@@ -108,12 +106,12 @@ class Run(comp: Compiler, ictx: Context) extends ImplicitRunInfo with Constraint
108106
private var finalizeActions = mutable.ListBuffer[() => Unit]()
109107

110108
def compile(fileNames: List[String]): Unit = try {
111-
val sources = fileNames.map(ctx.getSource(_))
109+
val sources = fileNames.map(runContext.getSource(_))
112110
compileSources(sources)
113111
}
114112
catch {
115113
case NonFatal(ex) =>
116-
ctx.echo(i"exception occurred while compiling $units%, %")
114+
runContext.echo(i"exception occurred while compiling $units%, %")
117115
throw ex
118116
}
119117

@@ -266,7 +264,7 @@ class Run(comp: Compiler, ictx: Context) extends ImplicitRunInfo with Constraint
266264
/** Print summary; return # of errors encountered */
267265
def printSummary(): Unit = {
268266
printMaxConstraint()
269-
val r = ctx.reporter
267+
val r = runContext.reporter
270268
r.printSummary
271269
}
272270

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ trait ImplicitRunInfo {
510510
* opaque type aliases, and abstract types, but not type parameters or package objects.
511511
*/
512512
def isAnchor(sym: Symbol) =
513-
sym.isClass && !sym.is(Package) && (!sym.isPackageObject || ctx.scala2CompatMode)
513+
sym.isClass && !sym.is(Package) && (!sym.isPackageObject || runContext.scala2CompatMode)
514514
|| sym.isOpaqueAlias
515515
|| sym.is(Deferred, butNot = Param)
516516

@@ -579,12 +579,12 @@ trait ImplicitRunInfo {
579579
addPath(pre.cls.sourceModule.termRef)
580580
case pre: TermRef =>
581581
if (pre.symbol.is(Package)) {
582-
if (ctx.scala2CompatMode) {
582+
if (runContext.scala2CompatMode) {
583583
addCompanion(pre, pre.member(nme.PACKAGE).symbol)
584584
addPath(pre.prefix)
585585
}
586586
}
587-
else if (!pre.symbol.isPackageObject || ctx.scala2CompatMode) {
587+
else if (!pre.symbol.isPackageObject || runContext.scala2CompatMode) {
588588
comps += pre
589589
addPath(pre.prefix)
590590
}
@@ -624,7 +624,7 @@ trait ImplicitRunInfo {
624624
}
625625
else
626626
collectCompanions(tp)
627-
val result = new OfTypeImplicits(tp, refs)(ctx)
627+
val result = new OfTypeImplicits(tp, refs)(runContext)
628628
if (canCache &&
629629
((tp eq rootTp) || // first type traversed is always cached
630630
!incomplete.contains(tp))) // other types are cached if they are not incomplete

0 commit comments

Comments
 (0)