diff options
author | Martin Odersky <odersky@gmail.com> | 2013-08-22 09:27:34 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-08-22 09:27:34 +0200 |
commit | cbcdbd6fb8c0bf372a61b4ddd5b6ce181964776d (patch) | |
tree | 3586e93b3e71ca8f11b9b7bd7e6a80af1a226dcf /src/dotty/tools/dotc/typer/Applications.scala | |
parent | 4d8329667a71242e56907a73760f1212a96d9376 (diff) | |
download | dotty-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.scala | 11 |
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 */ |