Skip to content

Commit 81dc91d

Browse files
committed
Remove ImplicitMethodType and JavaMethodType
1 parent c50c164 commit 81dc91d

19 files changed

+61
-64
lines changed

compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
267267
toDenot(fun.symbol).owner == defn.ArrayClass.linkedClass && fun.symbol.name == nme_apply =>
268268
val arrAnnotV: AnnotationVisitor = av.visitArray(name)
269269

270-
var actualArgs = if (fun.tpe.isInstanceOf[ImplicitMethodType]) {
270+
var actualArgs = if (fun.tpe.isImplicitMethod) {
271271
// generic array method, need to get implicit argument out of the way
272272
fun.asInstanceOf[Apply].args
273273
} else args

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,8 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] =>
450450
*/
451451
def mayBeVarGetter(sym: Symbol)(implicit ctx: Context): Boolean = {
452452
def maybeGetterType(tpe: Type): Boolean = tpe match {
453-
case _: ExprType | _: ImplicitMethodType => true
453+
case _: ExprType => true
454+
case tpe: MethodType => tpe.isImplicitMethod
454455
case tpe: PolyType => maybeGetterType(tpe.resultType)
455456
case _ => false
456457
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
195195
def valueParamss(tp: Type): (List[List[TermSymbol]], Type) = tp match {
196196
case tp: MethodType =>
197197
def valueParam(name: TermName, info: Type): TermSymbol = {
198-
val maybeImplicit = if (tp.isInstanceOf[ImplicitMethodType]) Implicit else EmptyFlags
198+
val maybeImplicit = if (tp.isImplicitMethod) Implicit else EmptyFlags
199199
ctx.newSymbol(sym, name, TermParam | maybeImplicit, info)
200200
}
201201
val params = (tp.paramNames, tp.paramInfos).zipped.map(valueParam)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ object Denotations {
325325
if (tp1.isInstanceOf[PolyType] && tp2.isInstanceOf[MethodType]) tp2
326326
else if (tp2.isInstanceOf[PolyType] && tp1.isInstanceOf[MethodType]) tp1
327327
else if (ctx.typeComparer.matchingParams(tp1, tp2) &&
328-
tp1.isImplicit == tp2.isImplicit)
328+
tp1.isImplicitMethod == tp2.isImplicitMethod)
329329
tp1.derivedLambdaType(
330330
mergeParamNames(tp1, tp2), tp1.paramInfos,
331331
infoMeet(tp1.resultType, tp2.resultType.subst(tp2, tp1)))
@@ -481,7 +481,7 @@ object Denotations {
481481
tp2 match {
482482
case tp2: MethodOrPoly
483483
if ctx.typeComparer.matchingParams(tp1, tp2) &&
484-
tp1.isImplicit == tp2.isImplicit =>
484+
tp1.isImplicitMethod == tp2.isImplicitMethod =>
485485
tp1.derivedLambdaType(
486486
mergeParamNames(tp1, tp2), tp1.paramInfos,
487487
tp1.resultType | tp2.resultType.subst(tp2, tp1))

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
508508
case tp1: MethodOrPoly =>
509509
(tp1.signature consistentParams tp2.signature) &&
510510
matchingParams(tp1, tp2) &&
511-
tp1.isImplicit == tp2.isImplicit &&
511+
tp1.isImplicitMethod == tp2.isImplicitMethod &&
512512
isSubType(tp1.resultType, tp2.resultType.subst(tp2, tp1))
513513
case _ =>
514514
false
@@ -1136,8 +1136,8 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
11361136
case formal2 :: rest2 =>
11371137
val formal2a = if (lam2.isParamDependent) formal2.subst(lam2, lam1) else formal2
11381138
(isSameTypeWhenFrozen(formal1, formal2a)
1139-
|| lam1.isJava && (formal2 isRef ObjectClass) && (formal1 isRef AnyClass)
1140-
|| lam2.isJava && (formal1 isRef ObjectClass) && (formal2 isRef AnyClass)) &&
1139+
|| lam1.isJavaMethod && (formal2 isRef ObjectClass) && (formal1 isRef AnyClass)
1140+
|| lam2.isJavaMethod && (formal1 isRef ObjectClass) && (formal2 isRef AnyClass)) &&
11411141
loop(rest1, rest2)
11421142
case nil =>
11431143
false

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ object TypeErasure {
206206
!tp.symbol.is(JavaDefined)
207207
case tp: TypeParamRef =>
208208
!tp.derivesFrom(defn.ObjectClass) &&
209-
!tp.binder.resultType.isInstanceOf[JavaMethodType]
209+
!tp.binder.resultType.isJavaMethod
210210
case tp: TypeAlias => isUnboundedGeneric(tp.alias)
211211
case tp: TypeBounds => !tp.hi.derivesFrom(defn.ObjectClass)
212212
case tp: TypeProxy => isUnboundedGeneric(tp.underlying)
@@ -398,7 +398,7 @@ class TypeErasure(isJava: Boolean, semiEraseVCs: Boolean, isConstructor: Boolean
398398
ctx.typeComparer.orType(this(tp1), this(tp2), erased = true)
399399
case tp: MethodType =>
400400
def paramErasure(tpToErase: Type) =
401-
erasureFn(tp.isJava, semiEraseVCs, isConstructor, wildcardOK)(tpToErase)
401+
erasureFn(tp.isJavaMethod, semiEraseVCs, isConstructor, wildcardOK)(tpToErase)
402402
val (names, formals0) =
403403
if (tp.paramInfos.exists(_.isPhantom)) tp.paramNames.zip(tp.paramInfos).filterNot(_._2.isPhantom).unzip
404404
else (tp.paramNames, tp.paramInfos)

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

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,12 @@ object Types {
288288
/** Is this an alias TypeBounds? */
289289
final def isAlias: Boolean = this.isInstanceOf[TypeAlias]
290290

291+
/** Is this a MethodType which is from Java */
292+
def isJavaMethod: Boolean = false
293+
294+
/** Is this a MethodType which has implicit parameters */
295+
def isImplicitMethod: Boolean = false
296+
291297
// ----- Higher-order combinators -----------------------------------
292298

293299
/** Returns true if there is a part of this type that satisfies predicate `p`.
@@ -1317,7 +1323,7 @@ object Types {
13171323
case mt: MethodType if !mt.isDependent || ctx.mode.is(Mode.AllowDependentFunctions) =>
13181324
val formals1 = if (dropLast == 0) mt.paramInfos else mt.paramInfos dropRight dropLast
13191325
defn.FunctionOf(
1320-
formals1 mapConserve (_.underlyingIfRepeated(mt.isJava)), mt.resultType, mt.isImplicit && !ctx.erasedTypes)
1326+
formals1 mapConserve (_.underlyingIfRepeated(mt.isJavaMethod)), mt.resultType, mt.isImplicitMethod && !ctx.erasedTypes)
13211327
}
13221328

13231329
/** The signature of this type. This is by default NotAMethod,
@@ -2552,9 +2558,6 @@ object Types {
25522558

25532559
override def resultType(implicit ctx: Context) = resType
25542560

2555-
def isJava: Boolean = false
2556-
def isImplicit = false
2557-
25582561
def isDependent(implicit ctx: Context): Boolean
25592562
def isParamDependent(implicit ctx: Context): Boolean
25602563

@@ -2708,12 +2711,17 @@ object Types {
27082711

27092712
type This = MethodType
27102713

2714+
def companion: MethodTypeCompanion
2715+
2716+
final override def isJavaMethod: Boolean = companion.isJava
2717+
final override def isImplicitMethod: Boolean = companion.isImplicit
2718+
27112719
val paramInfos = paramInfosExp(this)
27122720
val resType = resultTypeExp(this)
27132721
assert(resType.exists)
27142722

27152723
def computeSignature(implicit ctx: Context): Signature =
2716-
resultSignature.prepend(paramInfos, isJava)
2724+
resultSignature.prepend(paramInfos, isJavaMethod)
27172725

27182726
final override def computeHash = doHash(paramNames, resType, paramInfos)
27192727

@@ -2740,24 +2748,8 @@ object Types {
27402748
protected def prefixString = "MethodType"
27412749
}
27422750

2743-
final class CachedMethodType(paramNames: List[TermName])(paramInfosExp: MethodType => List[Type], resultTypeExp: MethodType => Type)
2744-
extends MethodType(paramNames)(paramInfosExp, resultTypeExp) {
2745-
def companion = MethodType
2746-
}
2747-
2748-
final class JavaMethodType(paramNames: List[TermName])(paramInfosExp: MethodType => List[Type], resultTypeExp: MethodType => Type)
2749-
extends MethodType(paramNames)(paramInfosExp, resultTypeExp) {
2750-
def companion = JavaMethodType
2751-
override def isJava = true
2752-
override protected def prefixString = "JavaMethodType"
2753-
}
2754-
2755-
final class ImplicitMethodType(paramNames: List[TermName])(paramInfosExp: MethodType => List[Type], resultTypeExp: MethodType => Type)
2756-
extends MethodType(paramNames)(paramInfosExp, resultTypeExp) {
2757-
def companion = ImplicitMethodType
2758-
override def isImplicit = true
2759-
override protected def prefixString = "ImplicitMethodType"
2760-
}
2751+
final class CachedMethodType(paramNames: List[TermName])(paramInfosExp: MethodType => List[Type], resultTypeExp: MethodType => Type, val companion: MethodTypeCompanion)
2752+
extends MethodType(paramNames)(paramInfosExp, resultTypeExp)
27612753

27622754
abstract class LambdaTypeCompanion[N <: Name, PInfo <: Type, LT <: LambdaType] {
27632755
def syntheticParamName(n: Int): N
@@ -2802,7 +2794,10 @@ object Types {
28022794
def syntheticParamName(n: Int) = tpnme.syntheticTypeParamName(n)
28032795
}
28042796

2805-
abstract class MethodTypeCompanion extends TermLambdaCompanion[MethodType] {
2797+
abstract class MethodTypeCompanion extends TermLambdaCompanion[MethodType] { self =>
2798+
2799+
def isJava: Boolean = false
2800+
def isImplicit: Boolean = false
28062801

28072802
/** Produce method type from parameter symbols, with special mappings for repeated
28082803
* and inline parameters:
@@ -2833,6 +2828,9 @@ object Types {
28332828
tl => tl.integrate(params, resultType))
28342829
}
28352830

2831+
final def apply(paramNames: List[TermName])(paramInfosExp: MethodType => List[Type], resultTypeExp: MethodType => Type)(implicit ctx: Context): MethodType =
2832+
checkValid(new CachedMethodType(paramNames)(paramInfosExp, resultTypeExp, self))
2833+
28362834
def checkValid(mt: MethodType)(implicit ctx: Context): mt.type = {
28372835
if (Config.checkMethodTypes)
28382836
for ((paramInfo, idx) <- mt.paramInfos.zipWithIndex)
@@ -2845,18 +2843,19 @@ object Types {
28452843
}
28462844

28472845
object MethodType extends MethodTypeCompanion {
2848-
def apply(paramNames: List[TermName])(paramInfosExp: MethodType => List[Type], resultTypeExp: MethodType => Type)(implicit ctx: Context): MethodType =
2849-
checkValid(unique(new CachedMethodType(paramNames)(paramInfosExp, resultTypeExp)))
2846+
def withKind(isJava: Boolean = false, isImplicit: Boolean = false): MethodTypeCompanion = {
2847+
if (isJava) JavaMethodType
2848+
else if (isImplicit) ImplicitMethodType
2849+
else MethodType
2850+
}
28502851
}
28512852

28522853
object JavaMethodType extends MethodTypeCompanion {
2853-
def apply(paramNames: List[TermName])(paramInfosExp: MethodType => List[Type], resultTypeExp: MethodType => Type)(implicit ctx: Context): MethodType =
2854-
unique(new JavaMethodType(paramNames)(paramInfosExp, resultTypeExp))
2854+
override def isJava: Boolean = true
28552855
}
28562856

28572857
object ImplicitMethodType extends MethodTypeCompanion {
2858-
def apply(paramNames: List[TermName])(paramInfosExp: MethodType => List[Type], resultTypeExp: MethodType => Type)(implicit ctx: Context): MethodType =
2859-
checkValid(unique(new ImplicitMethodType(paramNames)(paramInfosExp, resultTypeExp)))
2858+
override def isImplicit: Boolean = true
28602859
}
28612860

28622861
/** A ternary extractor for MethodType */

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -774,8 +774,7 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
774774
def isImplicit =
775775
tag == IMPLICITMETHODtpe ||
776776
params.nonEmpty && (params.head is Implicit)
777-
val maker = if (isImplicit) ImplicitMethodType else MethodType
778-
maker.fromSymbols(params, restpe)
777+
MethodType.withKind(isImplicit = isImplicit).fromSymbols(params, restpe)
779778
case POLYtpe =>
780779
val restpe = readTypeRef()
781780
val typeParams = until(end, readSymbolRef)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ class PlainPrinter(_ctx: Context) extends Printer {
182182
case tp: MethodType =>
183183
def paramText(name: TermName, tp: Type) = toText(name) ~ ": " ~ toText(tp)
184184
changePrec(GlobalPrec) {
185-
(if (tp.isImplicit) "(implicit " else "(") ~
185+
(if (tp.isImplicitMethod) "(implicit " else "(") ~
186186
Text((tp.paramNames, tp.paramInfos).zipped map paramText, ", ") ~
187187
(if (tp.resultType.isInstanceOf[MethodType]) ")" else "): ") ~
188188
toText(tp.resultType)

compiler/src/dotty/tools/dotc/sbt/ExtractAPI.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ private class ExtractAPICollector(implicit val ctx: Context) extends ThunkHolder
308308
val params = (pnames, ptypes, defaults).zipped.map((pname, ptype, isDefault) =>
309309
new api.MethodParameter(pname.toString, apiType(ptype),
310310
isDefault, api.ParameterModifier.Plain))
311-
new api.ParameterList(params.toArray, mt.isImplicit) :: paramLists(restpe, params.length)
311+
new api.ParameterList(params.toArray, mt.isImplicitMethod) :: paramLists(restpe, params.length)
312312
case _ =>
313313
Nil
314314
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class ElimRepeated extends MiniPhaseTransform with InfoTransformer with Annotati
5454
val resultType1 = elimRepeated(resultType)
5555
val paramTypes1 =
5656
if (paramTypes.nonEmpty && paramTypes.last.isRepeatedParam) {
57-
val last = paramTypes.last.underlyingIfRepeated(tp.isJava)
57+
val last = paramTypes.last.underlyingIfRepeated(tp.isJavaMethod)
5858
paramTypes.init :+ last
5959
} else paramTypes
6060
tp.derivedLambdaType(paramNames, paramTypes1, resultType1)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ trait Applications extends Compatibility { self: Typer with Dynamic =>
557557
typedArgBuf.trimEnd(n)
558558
val elemtpt = TypeTree(elemFormal)
559559
val seqLit =
560-
if (methodType.isJava) JavaSeqLiteral(args, elemtpt)
560+
if (methodType.isJavaMethod) JavaSeqLiteral(args, elemtpt)
561561
else SeqLiteral(args, elemtpt)
562562
typedArgBuf += seqToRepeated(seqLit)
563563
}
@@ -1149,7 +1149,7 @@ trait Applications extends Compatibility { self: Typer with Dynamic =>
11491149

11501150
/** Drop any implicit parameter section */
11511151
def stripImplicit(tp: Type): Type = tp match {
1152-
case mt: ImplicitMethodType =>
1152+
case mt: MethodType if mt.isImplicitMethod =>
11531153
resultTypeApprox(mt)
11541154
case pt: PolyType =>
11551155
pt.derivedLambdaType(pt.paramNames, pt.paramInfos, stripImplicit(pt.resultType))

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ object ErrorReporting {
116116
def dropJavaMethod(tp: Type): Type = tp match {
117117
case tp: PolyType =>
118118
tp.derivedLambdaType(resType = dropJavaMethod(tp.resultType))
119-
case tp: JavaMethodType =>
119+
case tp: MethodType if tp.isJavaMethod =>
120120
MethodType(tp.paramNames, tp.paramInfos, dropJavaMethod(tp.resultType))
121121
case tp => tp
122122
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ object EtaExpansion {
145145
ids = ids.init :+ repeated(ids.last)
146146
var body: Tree = Apply(lifted, ids)
147147
mt.resultType match {
148-
case rt: MethodType if !rt.isImplicit => body = PostfixOp(body, Ident(nme.WILDCARD))
148+
case rt: MethodType if !rt.isImplicitMethod => body = PostfixOp(body, Ident(nme.WILDCARD))
149149
case _ =>
150150
}
151151
val fn = untpd.Function(params, body)

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,15 @@ object Implicits {
6565

6666
def discardForView(tpw: Type, argType: Type): Boolean = tpw match {
6767
case mt: MethodType =>
68-
mt.isImplicit ||
68+
mt.isImplicitMethod ||
6969
mt.paramInfos.length != 1 ||
7070
!ctx.typerState.test(argType relaxed_<:< mt.paramInfos.head)
7171
case poly: PolyType =>
7272
// We do not need to call ProtoTypes#constrained on `poly` because
7373
// `refMatches` is always called with mode TypevarsMissContext enabled.
7474
poly.resultType match {
7575
case mt: MethodType =>
76-
mt.isImplicit ||
76+
mt.isImplicitMethod ||
7777
mt.paramInfos.length != 1 ||
7878
!ctx.typerState.test(argType relaxed_<:< wildApprox(mt.paramInfos.head, null, Set.empty))
7979
case rtp =>
@@ -109,7 +109,7 @@ object Implicits {
109109
}
110110

111111
def discardForValueType(tpw: Type): Boolean = tpw.stripPoly match {
112-
case tpw: MethodType => !tpw.isImplicit
112+
case tpw: MethodType => !tpw.isImplicitMethod
113113
case _ => false
114114
}
115115

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,11 @@ trait NamerContextOps { this: Context =>
107107
def methodType(typeParams: List[Symbol], valueParamss: List[List[Symbol]], resultType: Type, isJava: Boolean = false)(implicit ctx: Context): Type = {
108108
val monotpe =
109109
(valueParamss :\ resultType) { (params, resultType) =>
110-
val make =
111-
if (params.nonEmpty && (params.head is Implicit)) ImplicitMethodType
112-
else if (isJava) JavaMethodType
113-
else MethodType
110+
val isImplicit = params.nonEmpty && (params.head is Implicit)
114111
if (isJava)
115112
for (param <- params)
116113
if (param.info.isDirectRef(defn.ObjectClass)) param.info = defn.AnyType
117-
make.fromSymbols(params.asInstanceOf[List[TermSymbol]], resultType)
114+
MethodType.withKind(isJava, isImplicit).fromSymbols(params.asInstanceOf[List[TermSymbol]], resultType)
118115
}
119116
if (typeParams.nonEmpty) PolyType.fromParams(typeParams.asInstanceOf[List[TypeSymbol]], monotpe)
120117
else if (valueParamss.isEmpty) ExprType(monotpe)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ object ProtoTypes {
446446
case poly: PolyType =>
447447
normalize(constrained(poly).resultType, pt)
448448
case mt: MethodType =>
449-
if (mt.isImplicit) normalize(resultTypeApprox(mt), pt)
449+
if (mt.isImplicitMethod) normalize(resultTypeApprox(mt), pt)
450450
else if (mt.isDependent) tp
451451
else {
452452
val rt = normalize(mt.resultType, pt)

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1345,7 +1345,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
13451345
* @param cinfo The info of its constructor
13461346
*/
13471347
def maybeCall(ref: Tree, psym: Symbol, cinfo: Type): Tree = cinfo.stripPoly match {
1348-
case cinfo @ MethodType(Nil) if cinfo.resultType.isInstanceOf[ImplicitMethodType] =>
1348+
case cinfo @ MethodType(Nil) if cinfo.resultType.isImplicitMethod =>
13491349
val icall = New(ref).select(nme.CONSTRUCTOR).appliedToNone
13501350
typedExpr(untpd.TypedSplice(icall))(superCtx)
13511351
case cinfo @ MethodType(Nil) if !cinfo.resultType.isInstanceOf[MethodType] =>
@@ -1990,7 +1990,8 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
19901990
}
19911991
}
19921992

1993-
def adaptNoArgsImplicitMethod(wtp: ImplicitMethodType): Tree = {
1993+
def adaptNoArgsImplicitMethod(wtp: MethodType): Tree = {
1994+
assert(wtp.isImplicitMethod)
19941995
val tvarsToInstantiate = tvarsInParams(tree)
19951996
wtp.paramInfos.foreach(instantiateSelected(_, tvarsToInstantiate))
19961997
val constr = ctx.typerState.constraint
@@ -2085,7 +2086,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
20852086
typed(etaExpand(tree, wtp, arity), pt)
20862087
else if (wtp.paramInfos.isEmpty && isAutoApplied(tree.symbol))
20872088
adaptInterpolated(tpd.Apply(tree, Nil), pt)
2088-
else if (wtp.isImplicit)
2089+
else if (wtp.isImplicitMethod)
20892090
err.typeMismatch(tree, pt)
20902091
else
20912092
missingArgs(wtp)
@@ -2148,8 +2149,8 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
21482149
wtp match {
21492150
case wtp: ExprType =>
21502151
adaptInterpolated(tree.withType(wtp.resultType), pt)
2151-
case wtp: ImplicitMethodType
2152-
if constrainResult(wtp, followAlias(pt)) || !functionExpected =>
2152+
case wtp: MethodType
2153+
if wtp.isImplicitMethod && constrainResult(wtp, followAlias(pt)) || !functionExpected =>
21532154
adaptNoArgsImplicitMethod(wtp)
21542155
case wtp: MethodType if !pt.isInstanceOf[SingletonType] =>
21552156
val arity =

doc-tool/src/dotty/tools/dottydoc/model/factories.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ object factories {
170170
isByName = tpe.isInstanceOf[ExprType],
171171
isRepeated = tpe.isRepeatedParam
172172
)
173-
}, mt.isImplicit) :: paramLists(mt.resultType)
173+
}, mt.isImplicitMethod) :: paramLists(mt.resultType)
174174

175175
case mp: TermParamRef =>
176176
paramLists(mp.underlying)

0 commit comments

Comments
 (0)