Skip to content

Misleading error on unknown member in context function #12487

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
kubukoz opened this issue May 15, 2021 · 0 comments · Fixed by #14889
Closed

Misleading error on unknown member in context function #12487

kubukoz opened this issue May 15, 2021 · 0 comments · Fixed by #14889

Comments

@kubukoz
Copy link
Contributor

kubukoz commented May 15, 2021

Compiler version

3.0.0

Minimized code

trait A {
  def combine(another: A): A = ???
}

trait Dsl {
  def example: A
}

object Dsl {
  def execute(program: (dsl: Dsl) ?=> Int): String = ???
}

def example(using a: Dsl): A = ???

import Dsl._

def demo = Dsl.execute {
  // change to `combine` and it compiles
  example notCombine example
  42
}

Output

no implicit argument of type Dsl was found for parameter a of method example

Expectation

value notCombine is not a member of A

Note: the correct behavior is triggered if execute is a top level definition, or it's imported from Dsl._ and used without a prefix.

The same behavior can be seen if combine is an extension method instead of a direct one.

odersky added a commit to dotty-staging/dotty that referenced this issue Apr 8, 2022
odersky added a commit to dotty-staging/dotty that referenced this issue Apr 8, 2022
michelou pushed a commit to michelou/scala3 that referenced this issue Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants