aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer/Applications.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-08-22 09:27:34 +0200
committerMartin Odersky <odersky@gmail.com>2013-08-22 09:27:34 +0200
commitcbcdbd6fb8c0bf372a61b4ddd5b6ce181964776d (patch)
tree3586e93b3e71ca8f11b9b7bd7e6a80af1a226dcf /src/dotty/tools/dotc/typer/Applications.scala
parent4d8329667a71242e56907a73760f1212a96d9376 (diff)
downloaddotty-cbcdbd6fb8c0bf372a61b4ddd5b6ce181964776d.tar.gz
dotty-cbcdbd6fb8c0bf372a61b4ddd5b6ce181964776d.tar.bz2
dotty-cbcdbd6fb8c0bf372a61b4ddd5b6ce181964776d.zip
Various bug fixes for typer.
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
*/