Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Backport "Fix(#16459) xml parse regression" to LTS #20877

Merged
merged 5 commits into from
Jul 1, 2024
Merged

Commits on Jun 30, 2024

  1. fix(#16459): cannot parse text in xml literal with newline

    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]
    i10416 authored and WojciechMazur committed Jun 30, 2024
    Configuration menu
    Copy the full SHA
    ce35410 View commit details
    Browse the repository at this point in the history
  2. tryfix(16459): xml literal in for comprehension

    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]
    i10416 authored and WojciechMazur committed Jun 30, 2024
    Configuration menu
    Copy the full SHA
    ab4b733 View commit details
    Browse the repository at this point in the history
  3. tryfix(16459): add more test cases

    I need to come up with good solution for pattern match with `if` guard.
    
    [Cherry-picked 0423862]
    i10416 authored and WojciechMazur committed Jun 30, 2024
    Configuration menu
    Copy the full SHA
    69418c6 View commit details
    Browse the repository at this point in the history
  4. tryfix(16459): workaround LARROW, but find a corner-case

    Confusing LARROW just after XML pattern breaks the parser.
    
    [Cherry-picked 4b0fff5]
    i10416 authored and WojciechMazur committed Jun 30, 2024
    Configuration menu
    Copy the full SHA
    873a908 View commit details
    Browse the repository at this point in the history
  5. fix(16459): add patch to syntax error

    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]
    i10416 authored and WojciechMazur committed Jun 30, 2024
    Configuration menu
    Copy the full SHA
    a406088 View commit details
    Browse the repository at this point in the history