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

Trailing coma after for comprehension in lambda parameter of a function #449

Open
susliko opened this issue Dec 20, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@susliko
Copy link
Collaborator

susliko commented Dec 20, 2024

Commit of tree-sitter-scala you tested this on

fb999c7

A code sample showing the error

object Foo:
  def foo(f: Option[Int] => Option[Int]): Option[Int] = f(None)

  foo(o =>
    for {
      a <- o
    } yield a,
  )

Show the error node

...
          (lambda_expression ; [3, 6] - [7, 2]
            parameters: (identifier) ; [3, 6] - [3, 7]
            (indented_block ; [4, 4] - [7, 2]
              (for_expression ; [4, 4] - [6, 13]
                enumerators: (enumerators ; [5, 6] - [6, 4]
                  (enumerator ; [5, 6] - [5, 12]
                    (identifier) ; [5, 6] - [5, 7]
                    (identifier))) ; [5, 11] - [5, 12]
                body: (identifier)) ; [6, 12] - [6, 13]
              (ERROR)))))))) ; [6, 13] - [6, 14]
...

What do you expect the tree to look like

          (lambda_expression ; [3, 6] - [7, 2]
            parameters: (identifier) ; [3, 6] - [3, 7]
            (indented_block ; [4, 4] - [7, 2]
              (for_expression ; [4, 4] - [6, 13]
                enumerators: (enumerators ; [5, 6] - [6, 4]
                  (enumerator ; [5, 6] - [5, 12]
                    (identifier) ; [5, 6] - [5, 7]
                    (identifier))) ; [5, 11] - [5, 12]
                body: (identifier))))))))) ; [6, 12] - [6, 13]

Where are you experiencing this error?

nvim-treesitter

@susliko susliko added the bug Something isn't working label Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant