@@ -1447,7 +1447,7 @@ trait Applications extends Compatibility {
1447
1447
* that takes fewer.
1448
1448
*/
1449
1449
def compare (alt1 : TermRef , alt2 : TermRef )(using Context ): Int = trace(i " compare( $alt1, $alt2) " , overload) {
1450
- record(" compare" )
1450
+ record(" resolveOverloaded. compare" )
1451
1451
1452
1452
/** Is alternative `alt1` with type `tp1` as specific as alternative
1453
1453
* `alt2` with type `tp2` ?
@@ -1754,7 +1754,7 @@ trait Applications extends Compatibility {
1754
1754
*/
1755
1755
private def resolveOverloaded1 (alts : List [TermRef ], pt : Type )(using Context ): List [TermRef ] =
1756
1756
trace(i " resolve over $alts%, %, pt = $pt" , typr, show = true ) {
1757
- record(" resolveOverloaded1" )
1757
+ record(s " resolveOverloaded1 " , alts.length )
1758
1758
1759
1759
def isDetermined (alts : List [TermRef ]) = alts.isEmpty || alts.tail.isEmpty
1760
1760
@@ -1840,8 +1840,8 @@ trait Applications extends Compatibility {
1840
1840
alts.filterConserve(sizeFits(_))
1841
1841
1842
1842
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, _, _))
1845
1845
if hasNamedArg(args) then narrowByTrees(alts, normArgs.map(treeShape), resultType)
1846
1846
else narrowByTypes(alts, normArgs.map(typeShape), resultType)
1847
1847
else
@@ -1859,14 +1859,17 @@ trait Applications extends Compatibility {
1859
1859
alts2
1860
1860
}
1861
1861
1862
+ record(" resolveOverloaded.FunProto" , alts.length)
1862
1863
val alts1 = narrowBySize(alts)
1863
1864
// report.log(i"narrowed by size: ${alts1.map(_.symbol.showDcl)}%, %")
1864
1865
if isDetermined(alts1) then alts1
1865
1866
else
1867
+ record(" resolveOverloaded.narrowedBySize" , alts1.length)
1866
1868
val alts2 = narrowByShapes(alts1)
1867
1869
// report.log(i"narrowed by shape: ${alts2.map(_.symbol.showDcl)}%, %")
1868
1870
if isDetermined(alts2) then alts2
1869
1871
else
1872
+ record(" resolveOverloaded.narrowedByShape" , alts2.length)
1870
1873
pretypeArgs(alts2, pt)
1871
1874
narrowByTrees(alts2, pt.typedArgs(normArg(alts2, _, _)), resultType)
1872
1875
@@ -1915,6 +1918,7 @@ trait Applications extends Compatibility {
1915
1918
case tp : MethodType => stripImplicit(tp.resultType).isInstanceOf [MethodType ]
1916
1919
case _ => false
1917
1920
1921
+ record(" resolveOverloaded.narrowedApplicable" , candidates.length)
1918
1922
val found = narrowMostSpecific(candidates)
1919
1923
if (found.length <= 1 ) found
1920
1924
else
0 commit comments