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

New line breaks derives clause recognition #349

Closed
ghostbuster91 opened this issue Sep 10, 2023 · 0 comments · Fixed by #352
Closed

New line breaks derives clause recognition #349

ghostbuster91 opened this issue Sep 10, 2023 · 0 comments · Fixed by #352

Comments

@ghostbuster91
Copy link
Contributor

ghostbuster91 commented Sep 10, 2023

Commit of tree-sitter-scala you tested this on

70afdd5

A code sample showing the error

case class MyClass() extends A
    derives B

Show the error node

There is actually no error but the derives clause is incorrectly parsed as postfix_expression:

class_definition [50, 0] - [50, 33]
  name: identifier [50, 11] - [50, 18]
  class_parameters: class_parameters [50, 18] - [50, 20]
  extend: extends_clause [50, 21] - [50, 33]
    type: type_identifier [50, 29] - [50, 33]
postfix_expression [51, 4] - [51, 16]
  identifier [51, 4] - [51, 11]
  identifier [51, 12] - [51, 16]

What do you expect the tree to look like

class_definition [50, 0] - [50, 46]
  name: identifier [50, 11] - [50, 18]
  class_parameters: class_parameters [50, 18] - [50, 20]
  extend: extends_clause [50, 21] - [50, 33]
    type: type_identifier [50, 29] - [50, 33]
  derive: derives_clause [50, 34] - [50, 46]
    type: type_identifier [50, 42] - [50, 46]

Where are you experiencing this error?

nvim-treesitter

susliko added a commit to susliko/tree-sitter-scala-1 that referenced this issue Sep 18, 2023
Fixes tree-sitter#349

Now `automatic_semicolon` is not emmited when newline is followed by "derives"
susliko added a commit to susliko/tree-sitter-scala-1 that referenced this issue Sep 18, 2023
Fixes tree-sitter#349

Now `automatic_semicolon` is not emmited when newline is followed by "derives"
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 a pull request may close this issue.

1 participant