Skip to content

Commit eebc21e

Browse files
committed
Rename isContextual -> isContextualMethod
1 parent 7b4be99 commit eebc21e

File tree

7 files changed

+17
-17
lines changed

7 files changed

+17
-17
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
231231

232232
def valueParam(name: TermName, origInfo: Type): TermSymbol = {
233233
val maybeImplicit =
234-
if (tp.isContextual) Given
234+
if (tp.isContextualMethod) Given
235235
else if (tp.isImplicitMethod) Implicit
236236
else EmptyFlags
237237
val maybeErased = if (tp.isErasedMethod) Erased else EmptyFlags

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ object Types {
340340
def isImplicitMethod: Boolean = false
341341

342342
/** Is this a Method or PolyType which has contextual parameters as first value parameter list? */
343-
def isContextual: Boolean = false
343+
def isContextualMethod: Boolean = false
344344

345345
/** Is this a MethodType for which the parameters will not be used? */
346346
def isErasedMethod: Boolean = false
@@ -1504,7 +1504,7 @@ object Types {
15041504
def toFunctionType(dropLast: Int = 0)(implicit ctx: Context): Type = this match {
15051505
case mt: MethodType if !mt.isParamDependent =>
15061506
val formals1 = if (dropLast == 0) mt.paramInfos else mt.paramInfos dropRight dropLast
1507-
val isContextual = mt.isContextual && !ctx.erasedTypes
1507+
val isContextual = mt.isContextualMethod && !ctx.erasedTypes
15081508
val isErased = mt.isErasedMethod && !ctx.erasedTypes
15091509
val result1 = mt.nonDependentResultApprox match {
15101510
case res: MethodType => res.toFunctionType()
@@ -3185,12 +3185,12 @@ object Types {
31853185
final override def isImplicitMethod: Boolean =
31863186
companion.eq(ImplicitMethodType) ||
31873187
companion.eq(ErasedImplicitMethodType) ||
3188-
isContextual
3188+
isContextualMethod
31893189
final override def isErasedMethod: Boolean =
31903190
companion.eq(ErasedMethodType) ||
31913191
companion.eq(ErasedImplicitMethodType) ||
31923192
companion.eq(ErasedContextualMethodType)
3193-
final override def isContextual: Boolean =
3193+
final override def isContextualMethod: Boolean =
31943194
companion.eq(ContextualMethodType) ||
31953195
companion.eq(ErasedContextualMethodType)
31963196

@@ -3384,7 +3384,7 @@ object Types {
33843384

33853385
def computeSignature(implicit ctx: Context): Signature = resultSignature
33863386

3387-
override def isContextual = resType.isContextual
3387+
override def isContextualMethod = resType.isContextualMethod
33883388
override def isImplicitMethod = resType.isImplicitMethod
33893389

33903390
/** Merge nested polytypes into one polytype. nested polytypes are normally not supported

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,8 @@ class TreePickler(pickler: TastyPickler) {
260260
pickleMethodic(POLYtype, tpe)
261261
case tpe: MethodType if richTypes =>
262262
val tag = methodTypeTag(
263-
isContextual = tpe.isContextual,
264-
isImplicit = tpe.isImplicitMethod && !tpe.isContextual,
263+
isContextual = tpe.isContextualMethod,
264+
isImplicit = tpe.isImplicitMethod && !tpe.isContextualMethod,
265265
isErased = tpe.isErasedMethod)
266266
pickleMethodic(tag, tpe)
267267
case tpe: ParamRef =>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,9 @@ class PlainPrinter(_ctx: Context) extends Printer {
185185
"<noprefix>"
186186
case tp: MethodType =>
187187
changePrec(GlobalPrec) {
188-
(if (tp.isContextual) " given" else "") ~
188+
(if (tp.isContextualMethod) " given" else "") ~
189189
(if (tp.isErasedMethod) " erased" else "") ~~
190-
("(" + (if (tp.isImplicitMethod && !tp.isContextual) "implicit " else "")) ~
190+
("(" + (if (tp.isImplicitMethod && !tp.isContextualMethod) "implicit " else "")) ~
191191
paramsText(tp) ~
192192
(if (tp.resultType.isInstanceOf[MethodType]) ")" else "): ") ~
193193
toText(tp.resultType)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
232232
case dummyTreeOfType(tp) :: Nil if !(tp isRef defn.NullClass) => "null: " ~ toText(tp)
233233
case _ => toTextGlobal(args, ", ")
234234
}
235-
return "[applied to " ~ (Str("given ") provided tp.isContextual) ~ (Str("erased ") provided tp.isErasedMethod) ~ "(" ~ argsText ~ ") returning " ~ toText(resultType) ~ "]"
235+
return "[applied to " ~ (Str("given ") provided tp.isContextualMethod) ~ (Str("erased ") provided tp.isErasedMethod) ~ "(" ~ argsText ~ ") returning " ~ toText(resultType) ~ "]"
236236
case IgnoredProto(ignored) =>
237237
return "?" ~ (("(ignored: " ~ toText(ignored) ~ ")") provided ctx.settings.verbose.value)
238238
case tp @ PolyProto(targs, resType) =>

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,18 +208,18 @@ object EtaExpansion extends LiftImpure {
208208
if (isLastApplication && mt.paramInfos.length == xarity) mt.paramInfos map (_ => TypeTree())
209209
else mt.paramInfos map TypeTree
210210
var paramFlag = Synthetic | Param
211-
if (mt.isContextual) paramFlag |= Given
211+
if (mt.isContextualMethod) paramFlag |= Given
212212
else if (mt.isImplicitMethod) paramFlag |= Implicit
213213
val params = (mt.paramNames, paramTypes).zipped.map((name, tpe) =>
214214
ValDef(name, tpe, EmptyTree).withFlags(paramFlag).withSpan(tree.span.startPos))
215215
var ids: List[Tree] = mt.paramNames map (name => Ident(name).withSpan(tree.span.startPos))
216216
if (mt.paramInfos.nonEmpty && mt.paramInfos.last.isRepeatedParam)
217217
ids = ids.init :+ repeated(ids.last)
218218
val app = Apply(lifted, ids)
219-
if (mt.isContextual) app.setGivenApply()
219+
if (mt.isContextualMethod) app.setGivenApply()
220220
val body = if (isLastApplication) app else PostfixOp(app, Ident(nme.WILDCARD))
221221
val fn =
222-
if (mt.isContextual) new untpd.FunctionWithMods(params, body, Modifiers(Given))
222+
if (mt.isContextualMethod) new untpd.FunctionWithMods(params, body, Modifiers(Given))
223223
else if (mt.isImplicitMethod) new untpd.FunctionWithMods(params, body, Modifiers(Implicit))
224224
else untpd.Function(params, body)
225225
if (defs.nonEmpty) untpd.Block(defs.toList map (untpd.TypedSplice(_)), fn) else fn

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2589,7 +2589,7 @@ class Typer extends Namer
25892589
adapt(tree, pt.tupled, locked)
25902590
else
25912591
tree
2592-
else if (wtp.isContextual)
2592+
else if (wtp.isContextualMethod)
25932593
adaptNoArgs(wtp) // insert arguments implicitly
25942594
else if (tree.symbol.isPrimaryConstructor && tree.symbol.info.firstParamTypes.isEmpty)
25952595
readapt(tree.appliedToNone) // insert () to primary constructors
@@ -2687,7 +2687,7 @@ class Typer extends Namer
26872687
}
26882688
tryEither { implicit ctx =>
26892689
val app = cpy.Apply(tree)(untpd.TypedSplice(tree), namedArgs)
2690-
if (wtp.isContextual) app.setGivenApply()
2690+
if (wtp.isContextualMethod) app.setGivenApply()
26912691
typr.println(i"try with default implicit args $app")
26922692
typed(app, pt, locked)
26932693
} { (_, _) =>
@@ -3113,7 +3113,7 @@ class Typer extends Namer
31133113
* Overridden in `ReTyper`, where all applications are treated the same
31143114
*/
31153115
protected def matchingApply(methType: MethodOrPoly, pt: FunProto)(implicit ctx: Context): Boolean =
3116-
methType.isContextual == pt.isGivenApply ||
3116+
methType.isContextualMethod == pt.isGivenApply ||
31173117
methType.isImplicitMethod && pt.isGivenApply // for a transition allow `with` arguments for regular implicit parameters
31183118

31193119
/** Check that `tree == x: pt` is typeable. Used when checking a pattern

0 commit comments

Comments
 (0)