Skip to content

Commit d165378

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 74a67d0 commit d165378

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1152,8 +1152,18 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
11521152
}
11531153
}
11541154

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

0 commit comments

Comments
 (0)