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

Backport "fix(#15784): ident rule for pat match was too strict" to LTS #20848

Merged
merged 2 commits into from
Jun 28, 2024

Conversation

WojciechMazur
Copy link
Contributor

Backports #19501 to the LTS branch.

PR submitted by the release tooling.
[skip ci]

close #15784

Scala 2 allows backticked identifier and capital identifier in pattern
match, but Scala 3 mistakenly prohibited them.

For example, the following code is valid in Scala 2,

```scala
List(42) match {
  case List(_, Rest @ _*) => Rest
  case List(_, `Rest` @ _*) => `Rest`
  _ => ???
}
```
whereas it resulted in `Not Found Rest` error in Scala 3.

This is because the condition to detect wildcard pattern was so strict
that it chose the wrong match arm; `case _ => ifExpr`.

[Cherry-picked e236cdd]
Base automatically changed from lts-19484 to lts-18702 June 28, 2024 10:18
Base automatically changed from lts-18702 to lts-3.3 June 28, 2024 11:20
@WojciechMazur
Copy link
Contributor Author

No regressions detected in the community build up to lts-19520.

Reference

@WojciechMazur WojciechMazur merged commit 353890e into lts-3.3 Jun 28, 2024
19 checks passed
@WojciechMazur WojciechMazur deleted the lts-19501 branch June 28, 2024 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants