New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Context bounds are not added as dedicated given clause #7127
Comments
Ok, I found https://dotty.epfl.ch/docs/reference/contextual/relationship-implicits.html#context-bounds but I still think if you are using given clauses the context bounds should be added as a new clause. And if not that then at least appended to the end of the last given clause and not be prepended. |
I think this is done here: I think that |
Updated syntax object Test {
class Somethingable[T]
def fun[T: Somethingable](t: T)(given Int)(given String) = ()
fun(1)(given 3)(given "test")(given Somethingable())
} |
Note that the current desugaring adds the contexts bounds at the start of the last given/implicit parameter list. Desugaring to the previous example to def fun[T](t: T)(given Int)(given Somethingable[T], String) = () This seems to be necessary for Scala2 compat. |
Yes, it's necessary for Scala-2 compat. |
(I'm on
0.18.1-bin-20190827-2bbfd17-NIGHTLY
)According to https://dotty.epfl.ch/docs/reference/contextual/context-bounds.html, context bounds are added to the function signature as their own given clause. But Apparently they are prepended to the last given clause
minimized code
expectation
Code compiles
actual
note
Following works:
As you can see,
Somethingable()
has to be supplied as first parameter of the last given clause.The text was updated successfully, but these errors were encountered: