Skip to content

Given instances' extension methods with implicit arguments don't chain #7084

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 Aug 22, 2019 · 2 comments
Closed

Comments

@anatoliykmetyuk
Copy link
Contributor

type Foo

given A {
  def (y: Any) g given Foo: Any = ???
}

def f(x: Any) given Foo: Any = x.g.g

Out:

-- [E008] Member Not Found Error: ../pg/Macros2.scala:7:33 ---------------------
7 |def f(x: Any) given Foo: Any = x.g.g
  |                               ^^^
  |        value g is not a member of Any - did you mean x.==?.
  |        An extension method was tried, but could not be fully constructed:
  |
  |            Macros2$package.A.g(x)
one error found

However, the following works:

type Foo

given A {
  def (y: Any) g given Foo: Any = ???
}

def f(x: Any) given Foo: Any = {
  val a = x.g
  a.g
}

The following also works:

type Foo

def (y: Any) g given Foo: Any = ???

def f(x: Any) given Foo: Any = x.g.g
@anatoliykmetyuk anatoliykmetyuk changed the title Extension objects' methods with implicit arguments don't chain Given instances' extension methods with implicit arguments don't chain Aug 22, 2019
@milessabin
Copy link
Contributor

Is this an artefact of the result type being Any?

@anatoliykmetyuk
Copy link
Contributor Author

anatoliykmetyuk commented Aug 23, 2019

No, AFAIK reproduces for any other type.

anatoliykmetyuk added a commit that referenced this issue Aug 26, 2019
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

2 participants