diff options
author | Martin Odersky <odersky@gmail.com> | 2017-02-17 11:03:37 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2017-02-17 11:17:17 +0100 |
commit | 9f26d32db25824f75e5c5b2c2314352c42b074c1 (patch) | |
tree | 97ac0e5dc62b19f89d1fc4a07339e2adb472cc4b /compiler/src/dotty/tools/dotc/typer/Typer.scala | |
parent | 6df672c7e7be65d7be1cd6524c610aed4f35178c (diff) | |
download | dotty-9f26d32db25824f75e5c5b2c2314352c42b074c1.tar.gz dotty-9f26d32db25824f75e5c5b2c2314352c42b074c1.tar.bz2 dotty-9f26d32db25824f75e5c5b2c2314352c42b074c1.zip |
Treat implicit by-name arguments as lazy values
With the previous rules, the two test cases produce a
diverging implicit expansion. We avoid this by creating
for every implicit by-name argument of type T a lazy implicit
value of the same type. The implicit value is visible for all
nested implicit searches of by-name arguments. That way,
we tie the knot and obtain a recursive lazy value instead of
a diverging expansion.
Diffstat (limited to 'compiler/src/dotty/tools/dotc/typer/Typer.scala')
-rw-r--r-- | compiler/src/dotty/tools/dotc/typer/Typer.scala | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/src/dotty/tools/dotc/typer/Typer.scala b/compiler/src/dotty/tools/dotc/typer/Typer.scala index 2b57cf778..16aeb4c6d 100644 --- a/compiler/src/dotty/tools/dotc/typer/Typer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala @@ -1885,7 +1885,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit def implicitArgError(msg: String => String) = errors += (() => msg(em"parameter $pname of $methodStr")) if (errors.nonEmpty) EmptyTree - else inferImplicitArg(formal.widenExpr, implicitArgError, tree.pos.endPos) + else inferImplicitArg(formal, implicitArgError, tree.pos.endPos) } if (errors.nonEmpty) { // If there are several arguments, some arguments might already |