diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2013-08-11 21:54:11 +0200 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2013-10-11 13:03:49 +0200 |
commit | 210dbc7887bc42eed4154de65d0ff5f46ca5ee58 (patch) | |
tree | 535e273511e0503a743a14fad7099d9fa73ac04c /test/files/neg/divergent-implicit.check | |
parent | acd77803f7da7c369f4ffdc70b5eeec4a23e35ae (diff) | |
download | scala-210dbc7887bc42eed4154de65d0ff5f46ca5ee58.tar.gz scala-210dbc7887bc42eed4154de65d0ff5f46ca5ee58.tar.bz2 scala-210dbc7887bc42eed4154de65d0ff5f46ca5ee58.zip |
SI-3346 implicit parameters can now guide implicit view inference
This simple patch makes it possible for implicit views to benefit from
fundep-guided type inference, eliminating a nasty special case in
implicit inference.
Here are the changes that I had to apply to the tests (they exposed
quite a number of interesting questions that I was happy to answer):
1) neg/t5845.scala now works, so I moved it to pos. That easily makes sense,
because the test was just a canary to track previous state of things.
2) neg/divergent_implicit.scala, neg/t5578.scala and neg/t7519.scala
changed their messages to less informative ones, because inapplicable
implicit views now get disqualified early and therefore don't display
their error messages to the user. This is an unfortunate but necessary
byproduct of this change, and one can argue that the behavior is now
completely consistent with implicit vals (that also don't explain why
this or that implicit val got disqualified, but rather display a generic
implicit value not found message).
3) scaladoc/implicits-chaining.scala and scaladoc/implicits-base.scala.
Immediate culling of apriori inapplicable implicit views messes things up
for Scaladoc, because it's interested in potentially applicable views,
having infrastructure to track various constraints (type bounds, requirements
for implicit parameters, etc) that guide applicability of views and then
present it to the user. Therefore, when scaladoc is detected, implicit search
reverts to the old behavior.
4) We still cannot have Jason's workaround to type constructor inference
mentioned in comments to SI-3346, because it's not really about implicit
parameters of implicit views, but about type inference flowing from the
implicit parameter list to a preceding parameter list in order to affect
inference of an implicit view. This is something that's still too ambitious.
Diffstat (limited to 'test/files/neg/divergent-implicit.check')
-rw-r--r-- | test/files/neg/divergent-implicit.check | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/test/files/neg/divergent-implicit.check b/test/files/neg/divergent-implicit.check index 5f20df1b91..60d876409f 100644 --- a/test/files/neg/divergent-implicit.check +++ b/test/files/neg/divergent-implicit.check @@ -3,16 +3,14 @@ divergent-implicit.scala:4: error: type mismatch; required: String val x1: String = 1 ^ -divergent-implicit.scala:5: error: diverging implicit expansion for type Int => String -starting with method cast in object Test1 - val x2: String = cast[Int, String](1) - ^ -divergent-implicit.scala:14: error: diverging implicit expansion for type Test2.Baz => Test2.Bar -starting with method baz2bar in object Test2 +divergent-implicit.scala:14: error: type mismatch; + found : Test2.Foo + required: Test2.Bar val x: Bar = new Foo ^ -divergent-implicit.scala:15: error: diverging implicit expansion for type Test2.Foo => Test2.Bar -starting with method foo2bar in object Test2 +divergent-implicit.scala:15: error: type mismatch; + found : Test2.Baz + required: Test2.Bar val y: Bar = new Baz ^ -four errors found +three errors found |