@@ -1503,7 +1503,7 @@ trait Applications extends Compatibility {
1503
1503
1504
1504
private def onMethod (tp : Type , followApply : Boolean )(p : TermRef => Boolean )(using Context ): Boolean = tp match {
1505
1505
case methRef : TermRef if methRef.widenSingleton.isInstanceOf [MethodicType ] =>
1506
- p(methRef)
1506
+ p(methRef) || tp.member(nme.apply).hasAltWith(d => p( TermRef (tp, nme.apply, d)))
1507
1507
case mt : MethodicType =>
1508
1508
p(mt.narrow)
1509
1509
case _ =>
@@ -1644,7 +1644,7 @@ trait Applications extends Compatibility {
1644
1644
tp2.isVarArgsMethod
1645
1645
&& isApplicableMethodRef(alt2, tp1.paramInfos.map(_.repeatedToSingle), WildcardType , ArgMatch .Compatible )
1646
1646
else
1647
- isApplicableMethodRef(alt2, tp1.paramInfos, WildcardType , ArgMatch .Compatible )
1647
+ isApplicableMethodRef(alt2, tp1.paramInfos, WildcardType , ArgMatch .Compatible )// || isApplicableType(alt2, tp1.paramInfos, WildcardType)
1648
1648
}
1649
1649
case tp1 : PolyType => // (2)
1650
1650
inContext(ctx.fresh.setExploreTyperState()) {
@@ -1787,8 +1787,7 @@ trait Applications extends Compatibility {
1787
1787
def narrowMostSpecific (alts : List [TermRef ])(using Context ): List [TermRef ] = {
1788
1788
record(" narrowMostSpecific" )
1789
1789
alts match {
1790
- case Nil => alts
1791
- case _ :: Nil => alts
1790
+ case Nil | _ :: Nil => alts
1792
1791
case alt1 :: alt2 :: Nil =>
1793
1792
compare(alt1, alt2) match {
1794
1793
case 1 => alt1 :: Nil
@@ -1955,7 +1954,10 @@ trait Applications extends Compatibility {
1955
1954
}
1956
1955
1957
1956
def narrowByTypes (alts : List [TermRef ], argTypes : List [Type ], resultType : Type ): List [TermRef ] =
1958
- alts.filterConserve(isApplicableMethodRef(_, argTypes, resultType, ArgMatch .CompatibleCAP ))
1957
+ alts.filterConserve { alt =>
1958
+ isApplicableMethodRef(alt, argTypes, resultType, ArgMatch .CompatibleCAP )
1959
+ || isApplicableType(alt, argTypes, resultType)
1960
+ }
1959
1961
1960
1962
/** Normalization steps before checking arguments:
1961
1963
*
0 commit comments