Skip to content

Commit 32700e9

Browse files
committed
Renamings and simplifications
1 parent bd2cb26 commit 32700e9

File tree

5 files changed

+13
-17
lines changed

5 files changed

+13
-17
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ class Definitions {
130130
val resParamRef = enterTypeParam(cls, paramNamePrefix ++ "R", Covariant, decls).typeRef
131131
val methodType = MethodType.maker(
132132
isJava = false,
133-
isImplicit = name.isImplicitFunction,
133+
isOldImplicit = false,
134134
isContextual = name.isImplicitFunction,
135135
isErased = name.isErasedFunction)
136136
decls.enter(newMethod(cls, nme.apply, methodType(argParamRefs, resParamRef), Deferred))

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

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -333,19 +333,16 @@ object Types {
333333
/** Is this an alias TypeBounds? */
334334
final def isTypeAlias: Boolean = this.isInstanceOf[TypeAlias]
335335

336-
/** Is this a MethodType which is from Java */
336+
/** Is this a MethodType which is from Java? */
337337
def isJavaMethod: Boolean = false
338338

339-
/** Is this a MethodType which has implicit or contextual parameters */
339+
/** Is this a Method or PolyType which has implicit or contextual parameters? */
340340
def isImplicitMethod: Boolean = false
341341

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

345-
/** Is this a Method or PolyType which has implicit parameters as first value parameter list? */
346-
def isImplicit: Boolean = false
347-
348-
/** Is this a MethodType for which the parameters will not be used */
345+
/** Is this a MethodType for which the parameters will not be used? */
349346
def isErasedMethod: Boolean = false
350347

351348
/** Is this a match type or a higher-kinded abstraction of one?
@@ -3196,7 +3193,6 @@ object Types {
31963193
final override def isContextual: Boolean =
31973194
companion.eq(ContextualMethodType) ||
31983195
companion.eq(ErasedContextualMethodType)
3199-
final override def isImplicit = isImplicitMethod
32003196

32013197
def computeSignature(implicit ctx: Context): Signature = {
32023198
val params = if (isErasedMethod) Nil else paramInfos
@@ -3289,16 +3285,16 @@ object Types {
32893285
}
32903286

32913287
object MethodType extends MethodTypeCompanion("MethodType") {
3292-
def maker(isJava: Boolean = false, isImplicit: Boolean = false, isErased: Boolean = false, isContextual: Boolean = false): MethodTypeCompanion = {
3288+
def maker(isJava: Boolean = false, isOldImplicit: Boolean = false, isErased: Boolean = false, isContextual: Boolean = false): MethodTypeCompanion = {
32933289
if (isJava) {
3294-
assert(!isImplicit)
3290+
assert(!isOldImplicit)
32953291
assert(!isErased)
32963292
assert(!isContextual)
32973293
JavaMethodType
32983294
}
32993295
else if (isContextual)
33003296
if (isErased) ErasedContextualMethodType else ContextualMethodType
3301-
else if (isImplicit)
3297+
else if (isOldImplicit)
33023298
if (isErased) ErasedImplicitMethodType else ImplicitMethodType
33033299
else
33043300
if (isErased) ErasedMethodType else MethodType
@@ -3389,7 +3385,7 @@ object Types {
33893385
def computeSignature(implicit ctx: Context): Signature = resultSignature
33903386

33913387
override def isContextual = resType.isContextual
3392-
override def isImplicit = resType.isImplicit
3388+
override def isImplicitMethod = resType.isImplicitMethod
33933389

33943390
/** Merge nested polytypes into one polytype. nested polytypes are normally not supported
33953391
* but can arise as temporary data structures.

compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -767,10 +767,10 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
767767
case METHODtpe | IMPLICITMETHODtpe =>
768768
val restpe = readTypeRef()
769769
val params = until(end, () => readSymbolRef())
770-
def isOldImplicit =
770+
val isOldImplicit =
771771
tag == IMPLICITMETHODtpe ||
772772
params.nonEmpty && (params.head is OldImplicit)
773-
val maker = MethodType.maker(isImplicit = isOldImplicit)
773+
val maker = MethodType.maker(isOldImplicit = isOldImplicit)
774774
maker.fromSymbols(params, restpe)
775775
case POLYtpe =>
776776
val restpe = readTypeRef()

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,10 @@ trait NamerContextOps { this: Context =>
134134
def methodType(typeParams: List[Symbol], valueParamss: List[List[Symbol]], resultType: Type, isJava: Boolean = false)(implicit ctx: Context): Type = {
135135
val monotpe =
136136
(valueParamss :\ resultType) { (params, resultType) =>
137-
val (isImplicit, isErased, isContextual) =
137+
val (isOldImplicit, isErased, isContextual) =
138138
if (params.isEmpty) (false, false, false)
139139
else (params.head is OldImplicit, params.head is Erased, params.head.is(Given))
140-
val make = MethodType.maker(isJava = isJava, isImplicit = isImplicit, isErased = isErased, isContextual = isContextual)
140+
val make = MethodType.maker(isJava = isJava, isOldImplicit = isOldImplicit, isErased = isErased, isContextual = isContextual)
141141
if (isJava)
142142
for (param <- params)
143143
if (param.info.isDirectRef(defn.ObjectClass)) param.info = defn.AnyType

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3114,7 +3114,7 @@ class Typer extends Namer
31143114
*/
31153115
protected def matchingApply(methType: MethodOrPoly, pt: FunProto)(implicit ctx: Context): Boolean =
31163116
methType.isContextual == pt.isContextual ||
3117-
methType.isImplicit && pt.isContextual // for a transition allow `with` arguments for regular implicit parameters
3117+
methType.isImplicitMethod && pt.isContextual // for a transition allow `with` arguments for regular implicit parameters
31183118

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

0 commit comments

Comments
 (0)