Skip to content

Commit d7a3629

Browse files
committed
Rename isGivenApply => isUsingApply
1 parent f8c70ee commit d7a3629

File tree

9 files changed

+22
-22
lines changed

9 files changed

+22
-22
lines changed

compiler/src/dotty/tools/dotc/ast/Desugar.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ object desugar {
574574
val nu = vparamss.foldLeft(makeNew(classTypeRef)) { (nu, vparams) =>
575575
val app = Apply(nu, vparams.map(refOfDef))
576576
vparams match {
577-
case vparam :: _ if vparam.mods.is(Given) => app.setGivenApply()
577+
case vparam :: _ if vparam.mods.is(Given) => app.setUsingApply()
578578
case _ => app
579579
}
580580
}

compiler/src/dotty/tools/dotc/ast/Trees.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,8 +439,8 @@ object Trees {
439439
extends GenericApply[T] {
440440
type ThisTree[-T >: Untyped] = Apply[T]
441441

442-
def isGivenApply = hasAttachment(untpd.ApplyGiven)
443-
def setGivenApply() = { putAttachment(untpd.ApplyGiven, ()); this }
442+
def isUsingApply = hasAttachment(untpd.ApplyGiven)
443+
def setUsingApply() = { putAttachment(untpd.ApplyGiven, ()); this }
444444
}
445445

446446
/** fun[args] */

compiler/src/dotty/tools/dotc/parsing/Parsers.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2293,7 +2293,7 @@ object Parsers {
22932293

22942294
def mkApply(fn: Tree, args: (List[Tree], Boolean)): Tree =
22952295
val res = Apply(fn, args._1)
2296-
if args._2 then res.setGivenApply()
2296+
if args._2 then res.setUsingApply()
22972297
res
22982298

22992299
val argumentExpr: () => Tree = () => exprInParens() match {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
390390
else
391391
toTextLocal(fun)
392392
~ "("
393-
~ Str("using ").provided(app.isGivenApply && !homogenizedView)
393+
~ Str("using ").provided(app.isUsingApply && !homogenizedView)
394394
~ toTextGlobal(args, ", ")
395395
~ ")"
396396
case tree: TypeApply =>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ object Erasure {
545545
val Apply(fun, args) = tree
546546
if (fun.symbol == defn.cbnArg)
547547
typedUnadapted(args.head, pt)
548-
else typedExpr(fun, FunProto(args, pt)(this, isGivenApply = false)) match {
548+
else typedExpr(fun, FunProto(args, pt)(this, isUsingApply = false)) match {
549549
case fun1: Apply => // arguments passed in prototype were already passed
550550
fun1
551551
case fun1 =>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,7 @@ trait Applications extends Compatibility {
833833
def typedApply(tree: untpd.Apply, pt: Type)(implicit ctx: Context): Tree = {
834834

835835
def realApply(implicit ctx: Context): Tree = {
836-
val originalProto = new FunProto(tree.args, IgnoredProto(pt))(this, tree.isGivenApply)(argCtx(tree))
836+
val originalProto = new FunProto(tree.args, IgnoredProto(pt))(this, tree.isUsingApply)(argCtx(tree))
837837
record("typedApply")
838838
val fun1 = typedFunPart(tree.fun, originalProto)
839839

@@ -1763,7 +1763,7 @@ trait Applications extends Compatibility {
17631763
alts2
17641764
}
17651765

1766-
if pt.isGivenApply then
1766+
if pt.isUsingApply then
17671767
val alts0 = alts.filterConserve { alt =>
17681768
val mt = alt.widen.stripPoly
17691769
mt.isImplicitMethod || mt.isContextualMethod

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ object EtaExpansion extends LiftImpure {
233233
if (mt.paramInfos.nonEmpty && mt.paramInfos.last.isRepeatedParam)
234234
ids = ids.init :+ repeated(ids.last)
235235
val app = Apply(lifted, ids)
236-
if (mt.isContextualMethod) app.setGivenApply()
236+
if (mt.isContextualMethod) app.setUsingApply()
237237
val body = if (isLastApplication) app else PostfixOp(app, Ident(nme.WILDCARD))
238238
val fn =
239239
if (mt.isContextualMethod) new untpd.FunctionWithMods(params, body, Modifiers(Given))

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ object ProtoTypes {
228228

229229
trait ApplyingProto extends ProtoType // common trait of ViewProto and FunProto
230230
trait FunOrPolyProto extends ProtoType { // common trait of PolyProto and FunProto
231-
def isGivenApply: Boolean = false
231+
def isUsingApply: Boolean = false
232232
}
233233

234234
class FunProtoState {
@@ -251,7 +251,7 @@ object ProtoTypes {
251251
* [](args): resultType
252252
*/
253253
case class FunProto(args: List[untpd.Tree], resType: Type)(typer: Typer,
254-
override val isGivenApply: Boolean, state: FunProtoState = new FunProtoState)(implicit val ctx: Context)
254+
override val isUsingApply: Boolean, state: FunProtoState = new FunProtoState)(implicit val ctx: Context)
255255
extends UncachedGroundType with ApplyingProto with FunOrPolyProto {
256256
override def resultType(implicit ctx: Context): Type = resType
257257

@@ -265,7 +265,7 @@ object ProtoTypes {
265265

266266
def derivedFunProto(args: List[untpd.Tree] = this.args, resultType: Type, typer: Typer = this.typer): FunProto =
267267
if ((args eq this.args) && (resultType eq this.resultType) && (typer eq this.typer)) this
268-
else new FunProto(args, resultType)(typer, isGivenApply)
268+
else new FunProto(args, resultType)(typer, isUsingApply)
269269

270270
/** @return True if all arguments have types.
271271
*/
@@ -355,7 +355,7 @@ object ProtoTypes {
355355
case pt: FunProto =>
356356
pt
357357
case _ =>
358-
state.tupled = new FunProto(untpd.Tuple(args) :: Nil, resultType)(typer, isGivenApply)
358+
state.tupled = new FunProto(untpd.Tuple(args) :: Nil, resultType)(typer, isUsingApply)
359359
tupled
360360
}
361361

@@ -390,14 +390,14 @@ object ProtoTypes {
390390

391391
override def withContext(newCtx: Context): ProtoType =
392392
if (newCtx `eq` ctx) this
393-
else new FunProto(args, resType)(typer, isGivenApply, state)(newCtx)
393+
else new FunProto(args, resType)(typer, isUsingApply, state)(newCtx)
394394
}
395395

396396
/** A prototype for expressions that appear in function position
397397
*
398398
* [](args): resultType, where args are known to be typed
399399
*/
400-
class FunProtoTyped(args: List[tpd.Tree], resultType: Type)(typer: Typer, isGivenApply: Boolean)(implicit ctx: Context) extends FunProto(args, resultType)(typer, isGivenApply)(ctx) {
400+
class FunProtoTyped(args: List[tpd.Tree], resultType: Type)(typer: Typer, isUsingApply: Boolean)(implicit ctx: Context) extends FunProto(args, resultType)(typer, isUsingApply)(ctx) {
401401
override def typedArgs(norm: (untpd.Tree, Int) => untpd.Tree)(implicit ctx: Context): List[tpd.Tree] = args
402402
override def withContext(ctx: Context): FunProtoTyped = this
403403
}
@@ -444,7 +444,7 @@ object ProtoTypes {
444444
}
445445

446446
class UnapplyFunProto(argType: Type, typer: Typer)(implicit ctx: Context) extends FunProto(
447-
untpd.TypedSplice(dummyTreeOfType(argType)(ctx.source))(ctx) :: Nil, WildcardType)(typer, isGivenApply = false)
447+
untpd.TypedSplice(dummyTreeOfType(argType)(ctx.source))(ctx) :: Nil, WildcardType)(typer, isUsingApply = false)
448448

449449
/** A prototype for expressions [] that are type-parameterized:
450450
*

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,7 @@ class Typer extends Namer
10151015
case _ =>
10161016
given nestedCtx as Context = ctx.fresh.setNewTyperState()
10171017
val protoArgs = args map (_ withType WildcardType)
1018-
val callProto = FunProto(protoArgs, WildcardType)(this, app.isGivenApply)
1018+
val callProto = FunProto(protoArgs, WildcardType)(this, app.isUsingApply)
10191019
val expr1 = typedExpr(expr, callProto)
10201020
if nestedCtx.reporter.hasErrors then NoType
10211021
else
@@ -2626,7 +2626,7 @@ class Typer extends Namer
26262626
errorTree(tree, NoMatchingOverload(altDenots, pt)(err))
26272627
def hasEmptyParams(denot: SingleDenotation) = denot.info.paramInfoss == ListOfNil
26282628
pt match {
2629-
case pt: FunOrPolyProto if !pt.isGivenApply =>
2629+
case pt: FunOrPolyProto if !pt.isUsingApply =>
26302630
// insert apply or convert qualifier, but only for a regular application
26312631
tryInsertApplyOrImplicit(tree, pt, locked)(noMatches)
26322632
case _ =>
@@ -2777,7 +2777,7 @@ class Typer extends Namer
27772777
}
27782778
tryEither {
27792779
val app = cpy.Apply(tree)(untpd.TypedSplice(tree), namedArgs)
2780-
if (wtp.isContextualMethod) app.setGivenApply()
2780+
if (wtp.isContextualMethod) app.setUsingApply()
27812781
typr.println(i"try with default implicit args $app")
27822782
typed(app, pt, locked)
27832783
} { (_, _) =>
@@ -2794,7 +2794,7 @@ class Typer extends Namer
27942794
}
27952795
}
27962796
pt.revealIgnored match {
2797-
case pt: FunProto if pt.isGivenApply =>
2797+
case pt: FunProto if pt.isUsingApply =>
27982798
// We can end up here if extension methods are called with explicit given arguments.
27992799
// See for instance #7119.
28002800
tree
@@ -3216,8 +3216,8 @@ class Typer extends Namer
32163216
* Overridden in `ReTyper`, where all applications are treated the same
32173217
*/
32183218
protected def matchingApply(methType: MethodOrPoly, pt: FunProto)(implicit ctx: Context): Boolean =
3219-
methType.isContextualMethod == pt.isGivenApply ||
3220-
methType.isImplicitMethod && pt.isGivenApply // for a transition allow `with` arguments for regular implicit parameters
3219+
methType.isContextualMethod == pt.isUsingApply ||
3220+
methType.isImplicitMethod && pt.isUsingApply // for a transition allow `with` arguments for regular implicit parameters
32213221

32223222
/** Check that `tree == x: pt` is typeable. Used when checking a pattern
32233223
* against a selector of type `pt`. This implementation accounts for

0 commit comments

Comments
 (0)