Skip to content

Suggested import clauses should not include paths that are already part of the implicit scope #8051

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
julienrf opened this issue Jan 21, 2020 · 2 comments · Fixed by #8640
Closed
Labels
area:reporting Error reporting including formatting, implicit suggestions, etc itype:bug

Comments

@julienrf
Copy link
Contributor

minimized code

class Foo

List(new Foo).sorted

https://scastie.scala-lang.org/K9udu0oDRJCTdURWhocs4w

One of the following imports might make progress towards fixing the problem:

  import math.Ordering.comparatorToOrdering
  import math.Ordering.ordered

The suggested import clauses wouldn’t change anything because they are already part of the implicit scope (because they refer to definitions that live inside the Ordering companion object).

expectation

Import clauses that are already part of the implicit scope should not appear.

@smarter smarter added the area:reporting Error reporting including formatting, implicit suggestions, etc label Jan 21, 2020
@odersky
Copy link
Contributor

odersky commented Jan 22, 2020

But they are not part of the implicit scope here! Or are you saying that Ordering is part of the implicit scope of List?

I agree with the principle (and there's no code yet to address it), but this test does not demonstrate the failure.

@julienrf
Copy link
Contributor Author

But they are not part of the implicit scope here! Or are you saying that Ordering is part of the implicit scope of List?

The sorted method takes an implicit parameter of type Ordering[A]. So, the members of the companion object Ordering are part of the implicit scope here, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:reporting Error reporting including formatting, implicit suggestions, etc itype:bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants