Skip to content

Commit 59bca1c

Browse files
committed
Drop (using ...) closures in compiler codebase
1 parent 8f4324c commit 59bca1c

File tree

7 files changed

+11
-11
lines changed

7 files changed

+11
-11
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ object Annotations {
124124
object LazyBodyAnnotation {
125125
def apply(bodyFn: Context ?=> Tree): LazyBodyAnnotation =
126126
new LazyBodyAnnotation:
127-
protected var myTree: Tree | (Context ?=> Tree) = (using ctx) => bodyFn(using ctx)
127+
protected var myTree: Tree | (Context ?=> Tree) = ctx ?=> bodyFn(using ctx)
128128
}
129129

130130
object Annotation {
@@ -155,15 +155,15 @@ object Annotations {
155155
/** Create an annotation where the tree is computed lazily. */
156156
def deferred(sym: Symbol)(treeFn: Context ?=> Tree)(using Context): Annotation =
157157
new LazyAnnotation {
158-
protected var myTree: Tree | (Context ?=> Tree) = (using ctx) => treeFn(using ctx)
158+
protected var myTree: Tree | (Context ?=> Tree) = ctx ?=> treeFn(using ctx)
159159
protected var mySym: Symbol | (Context ?=> Symbol) = sym
160160
}
161161

162162
/** Create an annotation where the symbol and the tree are computed lazily. */
163163
def deferredSymAndTree(symFn: Context ?=> Symbol)(treeFn: Context ?=> Tree)(using Context): Annotation =
164164
new LazyAnnotation {
165-
protected var mySym: Symbol | (Context ?=> Symbol) = (using ctx) => symFn(using ctx)
166-
protected var myTree: Tree | (Context ?=> Tree) = (using ctx) => treeFn(using ctx)
165+
protected var mySym: Symbol | (Context ?=> Symbol) = ctx ?=> symFn(using ctx)
166+
protected var myTree: Tree | (Context ?=> Tree) = ctx ?=> treeFn(using ctx)
167167
}
168168

169169
/** Extractor for child annotations */

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2506,7 +2506,7 @@ object SymDenotations {
25062506
}
25072507

25082508
object LazyType:
2509-
private val NoSymbolFn = (using _: Context) => NoSymbol
2509+
private val NoSymbolFn = (_: Context) ?=> NoSymbol
25102510

25112511
/** A subtrait of LazyTypes where completerTypeParams yields a List[TypeSymbol], which
25122512
* should be completed independently of the info.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5148,7 +5148,7 @@ object Types {
51485148
derivedSuperType(tp, this(thistp), this(supertp))
51495149

51505150
case tp: LazyRef =>
5151-
LazyRef { (using refCtx) =>
5151+
LazyRef { refCtx ?=>
51525152
val ref1 = tp.ref
51535153
if refCtx.runId == mapCtx.runId then this(ref1)
51545154
else // splice in new run into map context

compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -587,10 +587,10 @@ class ClassfileParser(
587587
}
588588

589589
protected var mySym: Symbol | (Context ?=> Symbol) =
590-
(using ctx: Context) => annotType.classSymbol
590+
(ctx: Context) ?=> annotType.classSymbol
591591

592592
protected var myTree: Tree | (Context ?=> Tree) =
593-
(using ctx: Context) => untpd.resolveConstructor(annotType, args)
593+
(ctx: Context) ?=> untpd.resolveConstructor(annotType, args)
594594

595595
def untpdTree(using Context): untpd.Tree =
596596
untpd.New(untpd.TypeTree(annotType), List(args))

compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ class TreeUnpickler(reader: TastyReader,
603603
forkAt(templateStart).indexTemplateParams()(using localContext(sym))
604604
}
605605
else if (sym.isInlineMethod)
606-
sym.addAnnotation(LazyBodyAnnotation { (using ctx0: Context) =>
606+
sym.addAnnotation(LazyBodyAnnotation { (ctx0: Context) ?=>
607607
val ctx1 = localContext(sym)(using ctx0).addMode(Mode.ReadPositions)
608608
inContext(sourceChangeContext(Addr(0))(using ctx1)) {
609609
// avoids space leaks by not capturing the current context

compiler/src/dotty/tools/dotc/quoted/PickledQuotes.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ object PickledQuotes {
7474
override def transform(tree: tpd.Tree)(using Context): tpd.Tree = tree match {
7575
case Hole(isTerm, idx, args) =>
7676
val reifiedArgs = args.map { arg =>
77-
if (arg.isTerm) (using q: Quotes) => new ExprImpl(arg, QuotesImpl.scopeId)
77+
if (arg.isTerm) (q: Quotes) ?=> new ExprImpl(arg, QuotesImpl.scopeId)
7878
else new TypeImpl(arg, QuotesImpl.scopeId)
7979
}
8080
if isTerm then

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ object Implicits:
249249
else
250250
val candidates = new mutable.ListBuffer[Candidate]
251251
def tryCandidate(extensionOnly: Boolean)(ref: ImplicitRef) =
252-
var ckind = exploreInFreshCtx { (using ctx: FreshContext) =>
252+
var ckind = exploreInFreshCtx { (ctx: FreshContext) ?=>
253253
ctx.setMode(ctx.mode | Mode.TypevarsMissContext)
254254
candidateKind(ref.underlyingRef)
255255
}

0 commit comments

Comments
 (0)