@@ -1939,12 +1939,12 @@ trait Applications extends Compatibility {
1939
1939
1940
1940
record(" resolveOverloaded.FunProto" , alts.length)
1941
1941
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)}%, % " )
1943
1943
if isDetermined(alts1) then alts1
1944
1944
else
1945
1945
record(" resolveOverloaded.narrowedBySize" , alts1.length)
1946
1946
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)}%, % " )
1948
1948
if isDetermined(alts2) then alts2
1949
1949
else
1950
1950
record(" resolveOverloaded.narrowedByShape" , alts2.length)
@@ -1977,8 +1977,14 @@ trait Applications extends Compatibility {
1977
1977
* new java.io.ObjectOutputStream(f)
1978
1978
*/
1979
1979
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
1982
1988
}
1983
1989
else compat
1984
1990
}
0 commit comments