@@ -404,9 +404,7 @@ trait Applications extends Compatibility {
404
404
private var _ok = true
405
405
406
406
def ok : Boolean = _ok
407
- def ok_= (x : Boolean ): Unit =
408
- // if !x then println("set ok to false")
409
- _ok = x
407
+ def ok_= (x : Boolean ): Unit = _ok = x
410
408
411
409
/** The function's type after widening and instantiating polytypes
412
410
* with TypeParamRefs in constraint set
@@ -416,7 +414,6 @@ trait Applications extends Compatibility {
416
414
t.widen match {
417
415
case funType : MethodType => funType
418
416
case funType : PolyType =>
419
- // rec(constrained(funType).resultType) //TODO: Could replace rec(etc) by etc.methType ?
420
417
rec(instantiateWithTypeVars(funType))
421
418
case tp => tp
422
419
}
@@ -666,7 +663,6 @@ trait Applications extends Compatibility {
666
663
defn.isFunctionType(argtpe1) && formal.match
667
664
case SAMType (sam) => argtpe <:< sam.toFunctionType(isJava = formal.classSymbol.is(JavaDefined ))
668
665
case _ => false
669
- // println(s"argOK($arg,$formal) = ${isCompatible(argtpe, formal)}")
670
666
isCompatible(argtpe, formal)
671
667
// Only allow SAM-conversion to PartialFunction if implicit conversions
672
668
// are enabled. This is necessary to avoid ambiguity between an overload
@@ -713,7 +709,6 @@ trait Applications extends Compatibility {
713
709
*/
714
710
class ApplicableToTrees (methRef : TermRef , args : List [Tree ], resultType : Type , argMatch : ArgMatch )(using Context )
715
711
extends TestApplication (methRef, methRef.widen, args, resultType, argMatch) {
716
- // println("ApplicableToTrees created")
717
712
def argType (arg : Tree , formal : Type ): Type =
718
713
if untpd.isContextualClosure(arg) && defn.isContextFunctionType(formal) then arg.tpe
719
714
else normalize(arg.tpe, formal)
@@ -1090,8 +1085,6 @@ trait Applications extends Compatibility {
1090
1085
val typedArgs = if (isNamed) typedNamedArgs(tree.args) else tree.args.mapconserve(typedType(_))
1091
1086
record(" typedTypeApply" )
1092
1087
typedExpr(tree.fun, PolyProto (typedArgs, pt)) match {
1093
- /* case _: TypeApply if !ctx.isAfterTyper => //TODO: assess removing this is okay
1094
- errorTree(tree, "illegal repeated type application") */
1095
1088
case typedFn =>
1096
1089
typedFn.tpe.widen match {
1097
1090
case pt : PolyType =>
@@ -1399,10 +1392,8 @@ trait Applications extends Compatibility {
1399
1392
* @param resultType The expected result type of the application
1400
1393
*/
1401
1394
def isApplicableMethodRef (methRef : TermRef , args : List [Tree ], resultType : Type , keepConstraint : Boolean , argMatch : ArgMatch )(using Context ): Boolean = {
1402
- // println("entered isApplicableMethodRef")
1403
1395
def isApp (using Context ): Boolean =
1404
1396
new ApplicableToTrees (methRef, args, resultType, argMatch).success
1405
- // println(isApp) // check above ^
1406
1397
if (keepConstraint) isApp else explore(isApp)
1407
1398
}
1408
1399
@@ -1764,16 +1755,10 @@ trait Applications extends Compatibility {
1764
1755
* probability of pruning the search. result type comparisons are neither cheap nor
1765
1756
* do they prune much, on average.
1766
1757
*/
1767
- def adaptByResult (chosen : TermRef , alts : List [TermRef ]) =
1768
- // println("entered adaptByResult")
1769
- // println(chosen.symbol.showDcl)
1770
- // println(alts.map(_.symbol.showDcl))
1771
- pt match {
1758
+ def adaptByResult (chosen : TermRef , alts : List [TermRef ]) = pt match {
1772
1759
case pt : FunProto if ! explore(resultConforms(chosen.symbol, chosen, pt.resultType)) =>
1773
- // println("pt funproto")
1774
1760
val conformingAlts = alts.filterConserve(alt =>
1775
1761
(alt ne chosen) && explore(resultConforms(alt.symbol, alt, pt.resultType)))
1776
- // println(conformingAlts.map(_.symbol.showDcl))
1777
1762
conformingAlts match {
1778
1763
case Nil => chosen
1779
1764
case alt2 :: Nil => alt2
@@ -1787,7 +1772,6 @@ trait Applications extends Compatibility {
1787
1772
}
1788
1773
1789
1774
def resolve (alts : List [TermRef ]): List [TermRef ] =
1790
- // println("enter resolve")
1791
1775
pt match
1792
1776
case pt : FunProto =>
1793
1777
if pt.applyKind == ApplyKind .Using then
@@ -1798,18 +1782,11 @@ trait Applications extends Compatibility {
1798
1782
case _ =>
1799
1783
1800
1784
var found = withoutMode(Mode .ImplicitsEnabled )(resolveOverloaded1(alts, pt))
1801
- // println("found =")
1802
- // println(found.map(_.symbol.showDcl))
1803
1785
if found.isEmpty && ctx.mode.is(Mode .ImplicitsEnabled ) then
1804
- // println("update found")
1805
1786
found = resolveOverloaded1(alts, pt)
1806
1787
found match
1807
- case alt :: Nil =>
1808
- // println("resolve1")
1809
- adaptByResult(alt, alts) :: Nil
1810
- case _ =>
1811
- // println("resolve2")
1812
- found
1788
+ case alt :: Nil => adaptByResult(alt, alts) :: Nil
1789
+ case _ => found
1813
1790
end resolve
1814
1791
1815
1792
/** Try an apply method, if
@@ -1857,9 +1834,6 @@ trait Applications extends Compatibility {
1857
1834
trace(i " resolve over $alts%, %, pt = $pt" , typr, show = true ) {
1858
1835
record(s " resolveOverloaded1 " , alts.length)
1859
1836
1860
- // println(pt.show)
1861
- // println(pt)
1862
-
1863
1837
def isDetermined (alts : List [TermRef ]) = alts.isEmpty || alts.tail.isEmpty
1864
1838
1865
1839
/** The shape of given tree as a type; cannot handle named arguments. */
@@ -1959,25 +1933,17 @@ trait Applications extends Compatibility {
1959
1933
record(" resolveOverloaded.FunProto" , alts.length)
1960
1934
val alts1 = narrowBySize(alts)
1961
1935
// report.log(i"narrowed by size: ${alts1.map(_.symbol.showDcl)}%, %")
1962
- // println(i"narrowed by size: ${alts1.map(_.symbol.showDcl)}%, %")
1963
1936
if isDetermined(alts1) then alts1
1964
1937
else
1965
1938
record(" resolveOverloaded.narrowedBySize" , alts1.length)
1966
1939
val alts2 = narrowByShapes(alts1)
1967
1940
// report.log(i"narrowed by shape: ${alts2.map(_.symbol.showDcl)}%, %")
1968
- // println(i"narrowed by shape: ${alts2.map(_.symbol.showDcl)}%, %")
1969
1941
if isDetermined(alts2)
1970
- then
1971
- // println("1")
1972
- // println(alts2.map(_.symbol.showDcl))
1973
- alts2
1942
+ then alts2
1974
1943
else
1975
1944
record(" resolveOverloaded.narrowedByShape" , alts2.length)
1976
1945
pretypeArgs(alts2, pt)
1977
- val res = narrowByTrees(alts2, pt.typedArgs(normArg(alts2, _, _)), resultType)
1978
- // println("2")
1979
- // println(res.map(_.symbol.showDcl))
1980
- res
1946
+ narrowByTrees(alts2, pt.typedArgs(normArg(alts2, _, _)), resultType)
1981
1947
1982
1948
case pt @ PolyProto (targs1, pt1) =>
1983
1949
val alts1 = alts.filterConserve(pt.canInstantiate)
0 commit comments