aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer/Applications.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/dotty/tools/dotc/typer/Applications.scala')
-rw-r--r--src/dotty/tools/dotc/typer/Applications.scala11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/typer/Applications.scala b/src/dotty/tools/dotc/typer/Applications.scala
index 66fb4c3e1..05b0c50ce 100644
--- a/src/dotty/tools/dotc/typer/Applications.scala
+++ b/src/dotty/tools/dotc/typer/Applications.scala
@@ -410,6 +410,7 @@ trait Applications extends Compatibility { self: Typer =>
val result = {
var typedArgs = typedArgBuf.toList
+ println(s"typed args of $methRef = $typedArgs")
val ownType =
if (!success) ErrorType
else {
@@ -611,9 +612,17 @@ trait Applications extends Compatibility { self: Typer =>
/** Is given method reference applicable to argument types `args`?
* @param resultType The expected result type of the application
*/
- def isApplicableToTrees(methRef: TermRef, args: List[Tree], resultType: Type)(implicit ctx: Context) =
+ def isApplicableToTrees(methRef: TermRef, args: List[Tree], resultType: Type)(implicit ctx: Context): Boolean =
new ApplicableToTrees(methRef, args, resultType)(ctx.fresh.withNewTyperState).success
+ def isApplicableToTrees(tp: Type, args: List[Tree], resultType: Type)(implicit ctx: Context): Boolean = tp match {
+ case methRef: TermRef => isApplicableToTrees(methRef, args, resultType)
+ case _ =>
+ val app = tp.member(nme.apply)
+ app.exists && app.hasAltWith(d =>
+ isApplicableToTrees(TermRef(tp, nme.apply).withDenot(d), args, resultType))
+ }
+
/** Is given method reference applicable to arguments `args`?
* @param resultType The expected result type of the application
*/