diff options
author | Martin Odersky <odersky@gmail.com> | 2014-05-09 18:55:10 +0200 |
---|---|---|
committer | Samuel Gruetter <samuel.gruetter@epfl.ch> | 2014-05-20 13:38:49 +0200 |
commit | 394b645dd2d44ff68597527c6c690c73653f1bcb (patch) | |
tree | 22e72a22f891c002d5fef946361d223d6f6fc1a4 /src/dotty/tools/dotc/typer/Applications.scala | |
parent | 67e5130e63b10631106490cbc1cec5adcd5273e6 (diff) | |
download | dotty-394b645dd2d44ff68597527c6c690c73653f1bcb.tar.gz dotty-394b645dd2d44ff68597527c6c690c73653f1bcb.tar.bz2 dotty-394b645dd2d44ff68597527c6c690c73653f1bcb.zip |
Fix of pos/t2429
This was a hard nut to crack. The problem exemplified by t2429 is that in a situation like
val x: T = foo(...)
where `foo` needs implicit parameters the expected result type `T` is propagated into the
typechecking of foo(...) and consequently also into the implicit parameter search. This
is often necessary, for instance to instantiate type parameters. But it can lead to overconstrained
searches if in fact the right expansion is
val x: T = viewToT(foo(...)(implicit params))
where `viewToT` is some implicit conversion. The fix handles that case by re-hecking the
application foo(...) with an empty result type, if the implicit parameter search fails.
But the re-checking is very subtle as is explained in the comment to `TyperState#tryWithFallback`.
Diffstat (limited to 'src/dotty/tools/dotc/typer/Applications.scala')
-rw-r--r-- | src/dotty/tools/dotc/typer/Applications.scala | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/typer/Applications.scala b/src/dotty/tools/dotc/typer/Applications.scala index 92acb7939..a4c26080d 100644 --- a/src/dotty/tools/dotc/typer/Applications.scala +++ b/src/dotty/tools/dotc/typer/Applications.scala @@ -346,7 +346,7 @@ trait Applications extends Compatibility { self: Typer => init() def addArg(arg: Tree, formal: Type): Unit = - typedArgBuf += adaptInterpolated(arg, formal.widenExpr) + typedArgBuf += adaptInterpolated(arg, formal.widenExpr, EmptyTree) def makeVarArg(n: Int, elemFormal: Type): Unit = { val args = typedArgBuf.takeRight(n).toList |