diff options
author | Martin Odersky <odersky@gmail.com> | 2014-01-02 09:41:47 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-01-02 09:41:47 +0100 |
commit | 427e517b770633f656fcbf28957a0c8e9cba89c8 (patch) | |
tree | 7a814c9b5aeb2acce2d41db4e7abe5c8d3de4c93 | |
parent | 3f053053787b531a8ca2670f4c88ab941629dc50 (diff) | |
download | dotty-427e517b770633f656fcbf28957a0c8e9cba89c8.tar.gz dotty-427e517b770633f656fcbf28957a0c8e9cba89c8.tar.bz2 dotty-427e517b770633f656fcbf28957a0c8e9cba89c8.zip |
Avoiding converting with a view to a TypeVar
This triggered an assertion violation in ImplicitSearch. When checking an argument for a method, it's possible that the method parameter is a lower bound, and the argument is incompatible with that lower bound. In this case an implicit conversion towards the variable was searched, which leads to an explosion of the search space (the variable expands to WildcardType, so _every_ implicit is eligible). Better to search for a conversion to the lower bound (or, in fact, and equivalently, the underlying type parameter) instead.
-rw-r--r-- | src/dotty/tools/dotc/typer/Implicits.scala | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/typer/Implicits.scala b/src/dotty/tools/dotc/typer/Implicits.scala index de74917a8..340305202 100644 --- a/src/dotty/tools/dotc/typer/Implicits.scala +++ b/src/dotty/tools/dotc/typer/Implicits.scala @@ -252,7 +252,7 @@ trait Implicits { self: Typer => * result is compatible with type `to`. */ def inferView(from: Tree, to: Type)(implicit ctx: Context): SearchResult = track("inferView") { - inferImplicit(to, from, from.pos) + inferImplicit(to.stripTypeVar, from, from.pos) } /** Find an implicit parameter or conversion. |