Skip to content
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

Dot notation doesn't work in pattern guard with pattern receiver #709

Open
jiribenes opened this issue Nov 23, 2024 · 0 comments
Open

Dot notation doesn't work in pattern guard with pattern receiver #709

jiribenes opened this issue Nov 23, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@jiribenes
Copy link
Contributor

In this example, UFCS throws an error:

def find[A](list: List[A], elem: A) { eq: (A, A) => Bool }: Bool = list match {
  case Nil() => false
  case Cons(head, _) and head.eq(elem) => true
  //                         ^~~
  // Cannot resolve function eq, called on a value receiver.

  case _ => false
}

but if you just write eq(head, elem), it Just Works ™️

I think this should be somewhat unambiguous as patterns can only be values as of right now, right?

@jiribenes jiribenes added the bug Something isn't working label Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant