@@ -1447,7 +1447,7 @@ trait Applications extends Compatibility {
14471447 * that takes fewer.
14481448 */
14491449 def compare (alt1 : TermRef , alt2 : TermRef )(using Context ): Int = trace(i " compare( $alt1, $alt2) " , overload) {
1450- record(" compare" )
1450+ record(" resolveOverloaded. compare" )
14511451
14521452 /** Is alternative `alt1` with type `tp1` as specific as alternative
14531453 * `alt2` with type `tp2` ?
@@ -1754,7 +1754,7 @@ trait Applications extends Compatibility {
17541754 */
17551755 private def resolveOverloaded1 (alts : List [TermRef ], pt : Type )(using Context ): List [TermRef ] =
17561756 trace(i " resolve over $alts%, %, pt = $pt" , typr, show = true ) {
1757- record(" resolveOverloaded1" )
1757+ record(s " resolveOverloaded1 " , alts.length )
17581758
17591759 def isDetermined (alts : List [TermRef ]) = alts.isEmpty || alts.tail.isEmpty
17601760
@@ -1840,8 +1840,8 @@ trait Applications extends Compatibility {
18401840 alts.filterConserve(sizeFits(_))
18411841
18421842 def narrowByShapes (alts : List [TermRef ]): List [TermRef ] =
1843- val normArgs = args.mapWithIndexConserve(normArg(alts, _, _))
1844- if normArgs.exists(untpd.isFunctionWithUnknownParamType) then
1843+ if args.exists(untpd.isFunctionWithUnknownParamType) then
1844+ val normArgs = args.mapWithIndexConserve(normArg(alts, _, _))
18451845 if hasNamedArg(args) then narrowByTrees(alts, normArgs.map(treeShape), resultType)
18461846 else narrowByTypes(alts, normArgs.map(typeShape), resultType)
18471847 else
@@ -1859,14 +1859,17 @@ trait Applications extends Compatibility {
18591859 alts2
18601860 }
18611861
1862+ record(" resolveOverloaded.FunProto" , alts.length)
18621863 val alts1 = narrowBySize(alts)
18631864 // report.log(i"narrowed by size: ${alts1.map(_.symbol.showDcl)}%, %")
18641865 if isDetermined(alts1) then alts1
18651866 else
1867+ record(" resolveOverloaded.narrowedBySize" , alts1.length)
18661868 val alts2 = narrowByShapes(alts1)
18671869 // report.log(i"narrowed by shape: ${alts2.map(_.symbol.showDcl)}%, %")
18681870 if isDetermined(alts2) then alts2
18691871 else
1872+ record(" resolveOverloaded.narrowedByShape" , alts2.length)
18701873 pretypeArgs(alts2, pt)
18711874 narrowByTrees(alts2, pt.typedArgs(normArg(alts2, _, _)), resultType)
18721875
@@ -1915,6 +1918,7 @@ trait Applications extends Compatibility {
19151918 case tp : MethodType => stripImplicit(tp.resultType).isInstanceOf [MethodType ]
19161919 case _ => false
19171920
1921+ record(" resolveOverloaded.narrowedApplicable" , candidates.length)
19181922 val found = narrowMostSpecific(candidates)
19191923 if (found.length <= 1 ) found
19201924 else
0 commit comments