Skip to content

Commit

Permalink
Fix #5346: Refine implicit resolution spec
Browse files Browse the repository at this point in the history
Add discussion of by-name parameters.
  • Loading branch information
odersky committed Dec 17, 2018
1 parent fcc35d2 commit 1206dad
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/docs/reference/changed/implicit-resolution.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,13 @@ affect implicits on the language level.
most (but not all) divergence errors in Scala 2 would terminate the implicit
search as a whole.

5. Scala-2 gives a lower level of priority to implicit conversions with call-by-name
parameters relative to implicit conversions with call-by-value parameters. Dotty
drops this distinction. So the following code snippet would be ambiguous in Dotty:

implicit def conv1(x: Int): A = new A(x)
implicit def conv2(x: => Int): A = new A(x)
def buzz(y: A) = ???
buzz(1) // error: ambiguous

[//]: # todo: expand with precise rules

0 comments on commit 1206dad

Please sign in to comment.