Skip to content

Commit 9eb6b7b

Browse files
committed
Turn off implicit search in applyOverloaded
It's not necessary and doing an implicit search after typer does not sound like a good idea.
1 parent e18eb0f commit 9eb6b7b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,8 +1149,18 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
11491149
}
11501150
}
11511151

1152+
/** Construct the application `$receiver.$method[$targs]($args)` using overloading resolution
1153+
* to find a matching overload of `$method` if necessary.
1154+
* This is useful when overloading resolution needs to be performed in a phase after typer.
1155+
* Note that this will not perform any kind of implicit search.
1156+
*
1157+
* @param expectedType An expected type of the application used to guide overloading resolution
1158+
* @param isContextual Is this a contextual application (i.e., one that would be written using `.using(...)`) ?
1159+
*/
11521160
def applyOverloaded(receiver: Tree, method: TermName, args: List[Tree], targs: List[Type],
11531161
expectedType: Type, isContextual: Boolean = false)(implicit ctx: Context): Tree = {
1162+
implicit val ctx1: Context = ctx.retractMode(Mode.ImplicitsEnabled)
1163+
11541164
val typer = ctx.typer
11551165
val proto = FunProtoTyped(args, expectedType)(typer, isContextual)
11561166
val denot = receiver.tpe.member(method)

0 commit comments

Comments
 (0)