File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -2748,7 +2748,7 @@ class MissingImplicitArgument(
27482748 i " \n - ${imp.symbol.showDcl}${convs.map(c => " \n - " + c.symbol.showDcl).mkString}"
27492749 def noChainConversionsNote (ignoredConversions : Iterable [(TermRef , Iterable [TermRef ])]): Option [String ] = {
27502750 val convsFormatted = ignoredConversions.map{ (imp, convs) =>
2751- i " \n - ${imp.symbol.showDcl}${convs.map(c => " \n - " + c.symbol.showDcl).mkString}"
2751+ s " \n - ${imp.symbol.showDcl}${convs.map(c => " \n - " + c.symbol.showDcl).mkString}"
27522752 }.mkString
27532753 Option .when(ignoredConversions.nonEmpty)(
27542754 i " \n\n Note: implicit conversions are not automatically applied to arguments of using clauses. " +
Original file line number Diff line number Diff line change @@ -935,8 +935,17 @@ trait Implicits:
935935 allImplicits(ctx.implicits).map { imp =>
936936 // todo imp.underlyingRef.underlying does not work for implicit functions or givens
937937 // with type or implicit parameters
938- val convs = ctx.implicits.eligible(ViewProto (imp.underlyingRef.underlying, wildApprox(fail.expectedType)))
939- (imp.underlyingRef, convs.map(_.ref))
938+ val impRef = imp.underlyingRef
939+ val impResultType = wildApprox(impRef.underlying.finalResultType)
940+ val convs = ctx.implicits.eligible(ViewProto (impResultType, fail.expectedType))
941+ .filter { conv =>
942+ if ! conv.isConversion then false
943+ else
944+ // Actually feed the summoned implicit into the Conversion to
945+ // check if it works
946+ true
947+ }
948+ (impRef, convs.map(_.ref))
940949 }.filter(_._2.nonEmpty)
941950 else
942951 Nil
You can’t perform that action at this time.
0 commit comments