Skip to content

Commit 7edab06

Browse files
committed
Convert even mode contect functions to CFTs
1 parent 13421df commit 7edab06

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,9 @@ abstract class Reporter extends interfaces.ReporterResult {
126126

127127
/** Run `op` and return `true` if errors were reported by this reporter.
128128
*/
129-
def reportsErrorsFor(op: Context => Unit)(using Context): Boolean = {
129+
def reportsErrorsFor(op: Context ?=> Unit)(using Context): Boolean = {
130130
val initial = errorCount
131-
op(ctx)
131+
op
132132
errorCount > initial
133133
}
134134

compiler/src/dotty/tools/dotc/transform/SyntheticMembers.scala

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ class SyntheticMembers(thisPhase: DenotTransformer) {
8080
else NoSymbol
8181
}
8282

83-
private def synthesizeDef(sym: TermSymbol, rhsFn: List[List[Tree]] => Context => Tree)(using Context): Tree =
84-
DefDef(sym, rhsFn(_)(ctx.withOwner(sym))).withSpan(ctx.owner.span.focus)
83+
private def synthesizeDef(sym: TermSymbol, rhsFn: List[List[Tree]] => Context ?=> Tree)(using Context): Tree =
84+
DefDef(sym, rhsFn(_)(using ctx.withOwner(sym))).withSpan(ctx.owner.span.focus)
8585

8686
/** If this is a case or value class, return the appropriate additional methods,
8787
* otherwise return nothing.
@@ -131,7 +131,7 @@ class SyntheticMembers(thisPhase: DenotTransformer) {
131131
case nme.ordinal => Select(This(clazz), nme.ordinalDollar)
132132
}
133133
report.log(s"adding $synthetic to $clazz at ${currentPhase}")
134-
synthesizeDef(synthetic, treess => ctx => syntheticRHS(treess)(using ctx))
134+
synthesizeDef(synthetic, syntheticRHS)
135135
}
136136

137137
/** The class
@@ -476,12 +476,12 @@ class SyntheticMembers(thisPhase: DenotTransformer) {
476476
classParents = oldClassInfo.classParents :+ parent)
477477
clazz.copySymDenotation(info = newClassInfo).installAfter(thisPhase)
478478
}
479-
def addMethod(name: TermName, info: Type, cls: Symbol, body: (Symbol, Tree, Context) => Tree): Unit = {
479+
def addMethod(name: TermName, info: Type, cls: Symbol, body: (Symbol, Tree) => Context ?=> Tree): Unit = {
480480
val meth = newSymbol(clazz, name, Synthetic | Method, info, coord = clazz.coord)
481481
if (!existingDef(meth, clazz).exists) {
482482
meth.entered
483483
newBody = newBody :+
484-
synthesizeDef(meth, vrefss => ctx => body(cls, vrefss.head.head, ctx))
484+
synthesizeDef(meth, vrefss => body(cls, vrefss.head.head))
485485
}
486486
}
487487
val linked = clazz.linkedClass
@@ -500,12 +500,12 @@ class SyntheticMembers(thisPhase: DenotTransformer) {
500500
def makeProductMirror(cls: Symbol) = {
501501
addParent(defn.Mirror_ProductClass.typeRef)
502502
addMethod(nme.fromProduct, MethodType(defn.ProductClass.typeRef :: Nil, monoType.typeRef), cls,
503-
fromProductBody(_, _)(using _).ensureConforms(monoType.typeRef)) // t4758.scala or i3381.scala are examples where a cast is needed
503+
fromProductBody(_, _).ensureConforms(monoType.typeRef)) // t4758.scala or i3381.scala are examples where a cast is needed
504504
}
505505
def makeSumMirror(cls: Symbol) = {
506506
addParent(defn.Mirror_SumClass.typeRef)
507507
addMethod(nme.ordinal, MethodType(monoType.typeRef :: Nil, defn.IntType), cls,
508-
ordinalBody(_, _)(using _))
508+
ordinalBody(_, _))
509509
}
510510

511511
if (clazz.is(Module)) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1174,7 +1174,7 @@ trait Checking {
11741174

11751175
/** check that annotation `annot` is applicable to symbol `sym` */
11761176
def checkAnnotApplicable(annot: Tree, sym: Symbol)(using Context): Boolean =
1177-
!ctx.reporter.reportsErrorsFor { implicit ctx =>
1177+
!ctx.reporter.reportsErrorsFor {
11781178
val annotCls = Annotations.annotClass(annot)
11791179
val pos = annot.sourcePos
11801180
if (annotCls == defn.MainAnnot) {

0 commit comments

Comments
 (0)