|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The log messages intented to chronicle implicit search were
always being filtered out by virtue of the fact that the the tree
passed to `printTyping` was already typed, (e.g. with an implicit
MethodType.)
This commit enabled printing in this case, although it still
filters out trees that are deemed unfit for typer tracing,
such as `()`. In the context of implicit search, this happens
to filter out the noise of:
```
| | | [search #2] start `()`, searching for adaptation to pt=Unit => Foo[Int,Int] (silent: value <local Test> in Test) implicits disabled
| | | [search #3] start `()`, searching for adaptation to pt=(=> Unit) => Foo[Int,Int] (silent: value <local Test> in Test) implicits disabled
| | | \-> <error>
```
... which I think is desirable.
The motivation for this fix was to better display the interaction
between implicit search and type inference. For instance:
```
class Foo[A, B]
class Test {
implicit val f: Foo[Int, String] = ???
def t[A, B](a: A)(implicit f: Foo[A, B]) = ???
t(1)
}
```
````
% scalac -Ytyper-debug sandbox/instantiate.scala
...
| |-- t(1) BYVALmode-EXPRmode (site: value <local Test> in Test)
| | |-- t BYVALmode-EXPRmode-FUNmode-POLYmode (silent: value <local Test> in Test)
| | | [adapt] [A, B](a: A)(implicit f: Foo[A,B])Nothing adapted to [A, B](a: A)(implicit f: Foo[A,B])Nothing
| | | \-> (a: A)(implicit f: Foo[A,B])Nothing
| | |-- 1 BYVALmode-EXPRmode-POLYmode (site: value <local Test> in Test)
| | | \-> Int(1)
| | solving for (A: ?A, B: ?B)
| | solving for (B: ?B)
| | [search #1] start `[A, B](a: A)(implicit f: Foo[A,B])Nothing` inferring type B, searching for adaptation to pt=Foo[Int,B] (silent: value <local Test> in Test) implicits disabled
| | [search #1] considering f
| | [adapt] f adapted to => Foo[Int,String] based on pt Foo[Int,B]
| | [search #1] solve tvars=?B, tvars.constr= >: String <: String
| | solving for (B: ?B)
| | [search #1] success inferred value of type Foo[Int,=?String] is SearchResult(Test.this.f, TreeTypeSubstituter(List(type B),List(String)))
| | |-- [A, B](a: A)(implicit f: Foo[A,B])Nothing BYVALmode-EXPRmode (site: value <local Test> in Test)
| | | \-> Nothing
| | [adapt] [A, B](a: A)(implicit f: Foo[A,B])Nothing adapted to [A, B](a: A)(implicit f: Foo[A,B])Nothing
| | \-> Nothing
```
|