@@ -650,8 +650,8 @@ trait Applications extends Compatibility {
650
650
/** Subclass of Application for applicability tests with type arguments and value
651
651
* argument trees.
652
652
*/
653
- class ApplicableToTrees (methRef : TermRef , targs : List [ Type ], args : List [Tree ], resultType : Type )(implicit ctx : Context )
654
- extends TestApplication (methRef, methRef.widen.appliedTo(targs) , args, resultType) {
653
+ class ApplicableToTrees (methRef : TermRef , args : List [Tree ], resultType : Type )(implicit ctx : Context )
654
+ extends TestApplication (methRef, methRef.widenTermRefExpr , args, resultType) {
655
655
def argType (arg : Tree , formal : Type ): Type = normalize(arg.tpe, formal)
656
656
def treeToArg (arg : Tree ): Tree = arg
657
657
def isVarArg (arg : Tree ): Boolean = tpd.isWildcardStarArg(arg)
@@ -662,7 +662,8 @@ trait Applications extends Compatibility {
662
662
/** Subclass of Application for applicability tests with type arguments and value
663
663
* argument trees.
664
664
*/
665
- class ApplicableToTreesDirectly (methRef : TermRef , targs : List [Type ], args : List [Tree ], resultType : Type )(implicit ctx : Context ) extends ApplicableToTrees (methRef, targs, args, resultType)(ctx) {
665
+ class ApplicableToTreesDirectly (methRef : TermRef , args : List [Tree ], resultType : Type )(implicit ctx : Context )
666
+ extends ApplicableToTrees (methRef, args, resultType)(ctx) {
666
667
override def argOK (arg : TypedArg , formal : Type ): Boolean =
667
668
argType(arg, formal) relaxed_<:< formal.widenExpr
668
669
}
@@ -1240,34 +1241,33 @@ trait Applications extends Compatibility {
1240
1241
def typedUnApply (tree : untpd.UnApply , selType : Type )(implicit ctx : Context ): UnApply =
1241
1242
throw new UnsupportedOperationException (" cannot type check an UnApply node" )
1242
1243
1243
- /** Is given method reference applicable to type arguments `targs` and argument trees `args`?
1244
+ /** Is given method reference applicable to argument trees `args`?
1244
1245
* @param resultType The expected result type of the application
1245
1246
*/
1246
- def isApplicableMethodRef (methRef : TermRef , targs : List [ Type ], args : List [Tree ], resultType : Type , keepConstraint : Boolean )(implicit ctx : Context ): Boolean = {
1247
+ def isApplicableMethodRef (methRef : TermRef , args : List [Tree ], resultType : Type , keepConstraint : Boolean )(implicit ctx : Context ): Boolean = {
1247
1248
def isApp (implicit ctx : Context ): Boolean =
1248
- new ApplicableToTrees (methRef, targs, args, resultType).success
1249
+ new ApplicableToTrees (methRef, args, resultType).success
1249
1250
if (keepConstraint) isApp else ctx.test(isApp)
1250
1251
}
1251
1252
1252
- /** Is given method reference applicable to type arguments `targs` and argument trees `args` without inferring views?
1253
+ /** Is given method reference applicable to argument trees `args` without inferring views?
1253
1254
* @param resultType The expected result type of the application
1254
1255
*/
1255
- def isDirectlyApplicableMethodRef (methRef : TermRef , targs : List [ Type ], args : List [Tree ], resultType : Type )(implicit ctx : Context ): Boolean =
1256
- ctx.test(new ApplicableToTreesDirectly (methRef, targs, args, resultType).success)
1256
+ def isDirectlyApplicableMethodRef (methRef : TermRef , args : List [Tree ], resultType : Type )(implicit ctx : Context ): Boolean =
1257
+ ctx.test(new ApplicableToTreesDirectly (methRef, args, resultType).success)
1257
1258
1258
1259
/** Is given method reference applicable to argument types `args`?
1259
1260
* @param resultType The expected result type of the application
1260
1261
*/
1261
1262
def isApplicableMethodRef (methRef : TermRef , args : List [Type ], resultType : Type )(implicit ctx : Context ): Boolean =
1262
1263
ctx.test(new ApplicableToTypes (methRef, args, resultType).success)
1263
1264
1264
- /** Is given type applicable to type arguments `targs` and argument trees `args`,
1265
- * possibly after inserting an `apply`?
1265
+ /** Is given type applicable to argument trees `args`, possibly after inserting an `apply`?
1266
1266
* @param resultType The expected result type of the application
1267
1267
*/
1268
- def isApplicableType (tp : Type , targs : List [ Type ], args : List [Tree ], resultType : Type , keepConstraint : Boolean )(implicit ctx : Context ): Boolean =
1269
- onMethod(tp, targs.nonEmpty || args.nonEmpty) {
1270
- isApplicableMethodRef(_, targs, args, resultType, keepConstraint)
1268
+ def isApplicableType (tp : Type , args : List [Tree ], resultType : Type , keepConstraint : Boolean )(implicit ctx : Context ): Boolean =
1269
+ onMethod(tp, args.nonEmpty) {
1270
+ isApplicableMethodRef(_, args, resultType, keepConstraint)
1271
1271
}
1272
1272
1273
1273
/** Is given type applicable to argument types `args`, possibly after inserting an `apply`?
@@ -1538,9 +1538,7 @@ trait Applications extends Compatibility {
1538
1538
}
1539
1539
}
1540
1540
1541
- /** Resolve overloaded alternative `alts`, given expected type `pt` and
1542
- * possibly also type argument `targs` that need to be applied to each alternative
1543
- * to form the method type.
1541
+ /** Resolve overloaded alternative `alts`, given expected type `pt`.
1544
1542
* Two trials: First, without implicits or SAM conversions enabled. Then,
1545
1543
* if the first finds no eligible candidates, with implicits and SAM conversions enabled.
1546
1544
*/
@@ -1749,11 +1747,11 @@ trait Applications extends Compatibility {
1749
1747
1750
1748
def narrowByTrees (alts : List [TermRef ], args : List [Tree ], resultType : Type ): List [TermRef ] = {
1751
1749
val alts2 = alts.filter(alt =>
1752
- isDirectlyApplicableMethodRef(alt, Nil , args, resultType)
1750
+ isDirectlyApplicableMethodRef(alt, args, resultType)
1753
1751
)
1754
1752
if (alts2.isEmpty && ! ctx.isAfterTyper)
1755
1753
alts.filter(alt =>
1756
- isApplicableMethodRef(alt, Nil , args, resultType, keepConstraint = false )
1754
+ isApplicableMethodRef(alt, args, resultType, keepConstraint = false )
1757
1755
)
1758
1756
else
1759
1757
alts2
0 commit comments