Skip to content

Error message for using/given resolution failure #9874

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
vincenzobaz opened this issue Sep 25, 2020 · 2 comments
Closed

Error message for using/given resolution failure #9874

vincenzobaz opened this issue Sep 25, 2020 · 2 comments

Comments

@vincenzobaz
Copy link
Contributor

vincenzobaz commented Sep 25, 2020

Although new keywords have been introduced to replace implicit, the compiler still uses this term when it fails to find a given instance for a using paramenter.

Compiler Version

3.0.2

Minimized Code

def x(using y: Int): Int = y

trait A
given loop(using a: A): A = a

@main def main() = {
  x
  summon[A]
}

Output

-- Error: i9874.scala:7:3 --------------------------------------------
7 |  x
  |   ^
  |   no implicit argument of type Int was found for parameter y of method x
-- Error: i9874.scala:8:11 -------------------------------------------
8 |  summon[A]
  |           ^
  |no implicit argument of type A was found for parameter x of method summon in object Predef.
  |I found:
  |
  |    loop(/* missing */summon[A])
  |
  |But given instance loop produces a diverging implicit search when trying to match type A.
2 errors found

Expectation

I suggest to use the new terminology, for example:

no given instance of type Int was found for context parameter y of method x
no given instance of type A was found for context parameter x of method summon
@som-snytt
Copy link
Contributor

Duplicates #7710 where a comment mentions "cohesion enhancements".

@bishabosha
Copy link
Member

bishabosha commented Sep 25, 2020

This one is a duplicate, but the proposed correction looks good, which i link as a suggestion in the other issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants