Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 2.13.7 regression in implicit resolution #9829

Merged
merged 1 commit into from Dec 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/compiler/scala/tools/nsc/typechecker/Infer.scala
Expand Up @@ -1076,7 +1076,11 @@ trait Infer extends Checkable {
*/
def inferMethodInstance(fn: Tree, undetParams: List[Symbol],
args: List[Tree], pt0: Type): List[Symbol] = fn.tpe match {
case mt @ MethodType(_, _) =>
case mt: MethodType =>
// If we can't infer the type parameters, we can recover in `tryTypedApply` with an implicit conversion,
// but only when implicit conversions are enabled. In that case we have to infer the type parameters again.
def noInstanceResult = if (context.implicitsEnabled) undetParams else Nil

try {
val pt = if (pt0.typeSymbol == UnitClass) WildcardType else pt0
val formals = formalTypes(mt.paramTypes, args.length)
Expand All @@ -1101,10 +1105,10 @@ trait Infer extends Checkable {
enhanceBounds(adjusted.okParams, adjusted.okArgs, xs1)
xs1
}
} else undetParams
} else noInstanceResult
} catch ifNoInstance { msg =>
NoMethodInstanceError(fn, args, msg)
undetParams
noInstanceResult
}
case x => throw new MatchError(x)
}
Expand Down