@@ -1939,12 +1939,12 @@ trait Applications extends Compatibility {
19391939
19401940 record(" resolveOverloaded.FunProto" , alts.length)
19411941 val alts1 = narrowBySize(alts)
1942- // report.log (i"narrowed by size: ${alts1.map(_.symbol.showDcl)}%, %")
1942+ overload.println (i " narrowed by size: ${alts1.map(_.symbol.showDcl)}%, % " )
19431943 if isDetermined(alts1) then alts1
19441944 else
19451945 record(" resolveOverloaded.narrowedBySize" , alts1.length)
19461946 val alts2 = narrowByShapes(alts1)
1947- // report.log (i"narrowed by shape: ${alts2.map(_.symbol.showDcl)}%, %")
1947+ overload.println (i " narrowed by shape: ${alts2.map(_.symbol.showDcl)}%, % " )
19481948 if isDetermined(alts2) then alts2
19491949 else
19501950 record(" resolveOverloaded.narrowedByShape" , alts2.length)
@@ -1977,8 +1977,14 @@ trait Applications extends Compatibility {
19771977 * new java.io.ObjectOutputStream(f)
19781978 */
19791979 pt match {
1980- case SAMType (mtp) => narrowByTypes(alts, mtp.paramInfos, mtp.resultType)
1981- case _ => compat
1980+ case SAMType (mtp) =>
1981+ narrowByTypes(alts, mtp.paramInfos, mtp.resultType)
1982+ case _ =>
1983+ // pick any alternatives that are not methods since these might be convertible
1984+ // to the expected type, or be used as extension method arguments.
1985+ val convertible = alts.filterNot(alt =>
1986+ normalize(alt, IgnoredProto (pt)).widenSingleton.isInstanceOf [MethodType ])
1987+ if convertible.length == 1 then convertible else compat
19821988 }
19831989 else compat
19841990 }
0 commit comments