Skip to content

Backquoted == operator not treat as stable identifier during pattern match. #18247

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
jilen opened this issue Jul 19, 2023 · 2 comments · Fixed by #18327
Closed

Backquoted == operator not treat as stable identifier during pattern match. #18247

jilen opened this issue Jul 19, 2023 · 2 comments · Fixed by #18327
Labels

Comments

@jilen
Copy link

jilen commented Jul 19, 2023

Compiler version

3.3.0

Minimized code

sealed trait Op
object Op {
  case object `==` extends Op
}

def `is_==`(a: Op): true = {
  a match {
    case Op.`==` => true // won't compile
  }
}

Note other operators like +, - works just fine.

Output

 Stable identifier required, but Playground.Op.== found

Expectation

Should compile fine.

Workaround

Bind it to a constant

@jilen jilen added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Jul 19, 2023
@dwijnand dwijnand added prio:low stat:needs triage Every issue needs to have an "area" and "itype" label area:typer Spree Suitable for a future Spree and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Jul 19, 2023
@scala-center-bot
Copy link

This issue was picked for the Issue Spree No. 34 of 01 August 2023 which takes place in 7 days. @hamzaremmal, @nmcb will be working on it. If you have any insight into the issue or guidance on how to fix it, please leave it here.

@dwijnand dwijnand linked a pull request Aug 2, 2023 that will close this issue
@SethTisue
Copy link
Member

SethTisue commented Aug 3, 2023

It isn't obvious to me that we can just carve out an exception for this in the compiler unless we also change the spec?

EDIT: see PR for further commentary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants