Skip to content

Extension methods do not see each other when overloaded #7986

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
anatoliykmetyuk opened this issue Jan 14, 2020 · 2 comments
Closed

Extension methods do not see each other when overloaded #7986

anatoliykmetyuk opened this issue Jan 14, 2020 · 2 comments

Comments

@anatoliykmetyuk
Copy link
Contributor

anatoliykmetyuk commented Jan 14, 2020

minimized code

case class Project(name: String)
def (name: String) dependencies = ???
def (project: Project) dependencies = project.name.dependencies
Compilation output
-- [E008] Member Not Found Error: /Users/kmetiuk/Projects/scala3/pg/sandbox/iss1.scala:3:51
3 |def (project: Project) dependencies = project.name.dependencies
  |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^
  |                              value dependencies is not a member of String
1 error found

expectation

The following compiles fine (dependencies -> dependenciez):

case class Project(name: String)
def (name: String) dependencies = ???
def (project: Project) dependenciez = project.name.dependencies

So the original code should also compile.

Possibly related: #7375, #7401.

@anatoliykmetyuk anatoliykmetyuk changed the title Extension methods do not work when overloaded Extension methods do not see each other when overloaded Jan 14, 2020
odersky added a commit to dotty-staging/dotty that referenced this issue Jan 14, 2020
Propagate cyclic reference errors when searching extension methods
@odersky
Copy link
Contributor

odersky commented Jan 14, 2020

It does not find the member because there is a cyclic reference, since dependencies does not have a result type.

odersky added a commit to dotty-staging/dotty that referenced this issue Jan 14, 2020
Issue a warning if a cyclic reference is encountered when searching
for an applicable extension method.
odersky added a commit to dotty-staging/dotty that referenced this issue Nov 16, 2020
@odersky
Copy link
Contributor

odersky commented Jan 1, 2021

Fixed by #10902

@odersky odersky closed this as completed Jan 7, 2021
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