Skip to content

Support implicitNotFound on parameters, like Scala 2.13.0-M5 #4986

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

Closed
smarter opened this issue Aug 22, 2018 · 3 comments
Closed

Support implicitNotFound on parameters, like Scala 2.13.0-M5 #4986

smarter opened this issue Aug 22, 2018 · 3 comments

Comments

@smarter
Copy link
Member

smarter commented Aug 22, 2018

See scala/scala#6340

@tOverney
Copy link
Contributor

Trying to tackle that right now!

tOverney added a commit to tOverney/dotty that referenced this issue Jun 18, 2019
@prolativ
Copy link
Contributor

prolativ commented Sep 22, 2020

How should this be handled with dotty's using syntax?
Instead of the old style

def foo(implicit @implicitNotFound("custom error") bar: Bar)

we can straightforwardly get

def foo(using @implicitNotFound("custom error") bar: Bar)

but what if we wanted to skip the name of the implicit parameter?
Should we then annotate the type itself instead, like

def foo(using Bar @implicitNotFound("custom error"))

?
If yes, then should we align the syntax with the parameter name to the one without it, like

def foo(using bar: Bar @implicitNotFound("custom error"))

?
Or should we require that the parameter name is always present when the annotation is used?

Also, as we would like to get rid of implicit keyword by replacing it with givens and usings, should the annotation be renamed to something like givenNotFound? That could be also just an alias.
@smarter @odersky

@smarter
Copy link
Member Author

smarter commented Sep 22, 2020

Should we then annotate the type itself instead, like

Putting the annotation on the type would make sense, but it means that the annotation leaks into error messages which involve the type of this parameter, it might be possible to tweak error message reporting to avoid that; I think we should support both but for an initial PR it's fine to just support what scalac supports.

Also, as we would like to get rid of implicit keyword by replacing it with givens and usings, should the annotation be renamed to something like givenNotFound? That could be also just an alias.

Yes probably, but this isn't the only reference to "implicit" in the standard library. I suggest leaving the names alone for now and we can discuss how they should be updated in 3.1 when we update the standard library.

prolativ added a commit to prolativ/dotty that referenced this issue Oct 6, 2020
prolativ added a commit to prolativ/dotty that referenced this issue Oct 6, 2020
prolativ added a commit to prolativ/dotty that referenced this issue Oct 6, 2020
prolativ added a commit to prolativ/dotty that referenced this issue Oct 7, 2020
prolativ added a commit to prolativ/dotty that referenced this issue Oct 21, 2020
prolativ added a commit to prolativ/dotty that referenced this issue Oct 21, 2020
prolativ added a commit to prolativ/dotty that referenced this issue Oct 27, 2020
Also fixes some complex cases of resolving type variables in `implicitNotFound` message for annotations put on type definitions
prolativ added a commit to prolativ/dotty that referenced this issue Oct 27, 2020
Also fixes some complex cases of resolving type variables in `implicitNotFound` message for annotations put on type definitions
prolativ added a commit to prolativ/dotty that referenced this issue Oct 27, 2020
Also fixes some complex cases of resolving type variables in `implicitNotFound` message for annotations put on type definitions
prolativ added a commit to prolativ/dotty that referenced this issue Oct 27, 2020
Also fixes some complex cases of resolving type variables in `implicitNotFound` message for annotations put on type definitions
prolativ added a commit to prolativ/dotty that referenced this issue Oct 29, 2020
Also fixes some complex cases of resolving type variables in `implicitNotFound` message for annotations put on type definitions
prolativ added a commit to prolativ/dotty that referenced this issue Nov 2, 2020
Also fixes some complex cases of resolving type variables in `implicitNotFound` message for annotations put on type definitions
prolativ added a commit to prolativ/dotty that referenced this issue Nov 3, 2020
Also fixes some complex cases of resolving type variables in `implicitNotFound` message for annotations put on type definitions
@smarter smarter closed this as completed in 1760da3 Nov 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants