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(
2748
2748
i " \n - ${imp.symbol.showDcl}${convs.map(c => " \n - " + c.symbol.showDcl).mkString}"
2749
2749
def noChainConversionsNote (ignoredConversions : Iterable [(TermRef , Iterable [TermRef ])]): Option [String ] = {
2750
2750
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}"
2752
2752
}.mkString
2753
2753
Option .when(ignoredConversions.nonEmpty)(
2754
2754
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:
935
935
allImplicits(ctx.implicits).map { imp =>
936
936
// todo imp.underlyingRef.underlying does not work for implicit functions or givens
937
937
// 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))
940
949
}.filter(_._2.nonEmpty)
941
950
else
942
951
Nil
You can’t perform that action at this time.
0 commit comments