-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fix(#16459) xml parse regression #19531
Conversation
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.
🤔
|
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 ```
I need to come up with good solution for pattern match with `if` guard.
3e83bde
to
0423862
Compare
Confusing LARROW just after XML pattern breaks the parser.
5d1f0b4
to
4b0fff5
Compare
val auxiliary6 = for (case _ @ <div>empty</div><- Seq(xml)) yield () | ||
val auxiliary7 = for (case _ @ <div>empty</div><-Seq(xml)) yield () |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The left arrow just after xml closing tag broke the parser.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
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.
53bbb78
to
3d156b6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for the fix!
Backports #19531 to the LTS branch. PR submitted by the release tooling. [skip ci]
close #16459
The parser could not parse
if expr
that contains single-quoted text(s) inside XML literal with newline(s) becausefollowedByToken
, which is used to detectdo
orthen
token afterif
, unintentionally consumed XMLSTART symbol, which prevented the parser from delegating parse to XML parser.