Skip to content

Commit 1d8cb7c

Browse files
committed
Change Printers to givens
1 parent 86ae3ca commit 1d8cb7c

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ package printing
33

44
import core._
55
import Texts._, Types._, Flags._, Names._, Symbols._, NameOps._, Constants._, Denotations._
6-
import Contexts.Context, Scopes.Scope, Denotations.Denotation, Annotations.Annotation
6+
import Contexts.{Context}
7+
import Scopes.Scope, Denotations.Denotation, Annotations.Annotation
78
import StdNames.nme
89
import ast.Trees._
910
import typer.Implicits._
@@ -18,7 +19,8 @@ class PlainPrinter(_ctx: Context) extends Printer {
1819
/** The context of all public methods in Printer and subclasses.
1920
* Overridden in RefinedPrinter.
2021
*/
21-
protected implicit def ctx: Context = _ctx.addMode(Mode.Printing)
22+
protected def curCtx: Context = _ctx.addMode(Mode.Printing)
23+
protected given ctx[Dummy] as Context = curCtx
2224

2325
protected def printDebug = ctx.settings.YprintDebug.value
2426

compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import Names._
99
import Symbols._
1010
import NameOps._
1111
import TypeErasure.ErasedValueType
12-
import Contexts.Context
12+
import Contexts.{Context}
1313
import Annotations.Annotation
1414
import Denotations._
1515
import SymDenotations._
@@ -32,11 +32,11 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
3232

3333
/** A stack of enclosing DefDef, TypeDef, or ClassDef, or ModuleDefs nodes */
3434
private var enclosingDef: untpd.Tree = untpd.EmptyTree
35-
private var myCtx: Context = super.ctx
35+
private var myCtx: Context = super.curCtx
3636
private var printPos = ctx.settings.YprintPos.value
3737
private val printLines = ctx.settings.printLines.value
3838

39-
override protected implicit def ctx: Context = myCtx
39+
override protected def curCtx: Context = myCtx
4040

4141
def withEnclosingDef(enclDef: Tree[? >: Untyped])(op: => Text): Text = {
4242
val savedCtx = myCtx

0 commit comments

Comments
 (0)