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(#16459) xml parse regression" to LTS #20877

Merged
merged 5 commits into from
Jul 1, 2024
Merged

Conversation

WojciechMazur
Copy link
Contributor

Backports #19531 to the LTS branch.

PR submitted by the release tooling.
[skip ci]

The parser could not parse `if expr` that contains single-quoted text(s) inside
XML literal with newline(s) because `followedByToken`, which is used to detect `do` or `then` token after `if`,
unintentionally consumed XMLSTART symbol, which prevented the parser from delegating parse to XML parser.

[Cherry-picked 1fc27df]
xml literal may appear in LHS of for comprehension.

The previous fix caused a syntax error for the following code.

```scala
val actual: List[Node] = for (case t @ <book><title>Blabla</title></book> <- NodeSeq.fromSeq(books.child).toList)
  yield t
```

[Cherry-picked c8d7ca1]
I need to come up with good solution for pattern match with `if` guard.

[Cherry-picked 0423862]
Confusing LARROW just after XML pattern breaks the parser.

[Cherry-picked 4b0fff5]
Add a patch to cover the cornercase where xml pattern in parens confuse
the parser.

Before this commit, the following code compiles,

```scala
for (case _ @ <div>empty</div> <- Seq(xml)) yield ()
```
but the following resulted in syntax error.

```scala
for (case _ @ <div>empty</div><-Seq(xml)) yield ()
```

Because `followingIsEnclosedGenerators` always comes after `for` and
`(`, I beleive it would not break the parser to early-exit when
`XMLSTART` is found.

[Cherry-picked 3d156b6]
@WojciechMazur
Copy link
Contributor Author

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

Reference

@WojciechMazur WojciechMazur merged commit e888601 into lts-3.3 Jul 1, 2024
19 checks passed
@WojciechMazur WojciechMazur deleted the lts-19531 branch July 1, 2024 08:40
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