Skip to content

Subclass with multiline params and unnamed after named param #465

@jonshea

Description

@jonshea

Commit of tree-sitter-scala you tested this on

42a1542

A code sample showing the error

Taken from https://github.com/scala/scala3/blob/main/tests/run/i14164.scala#L5-L9

class Child extends Base(
  param =
    for x <- Seq("a") yield x
    "param"
)

Show the error node

(class_definition [0, 0] - [4, 1]
  name: (identifier [0, 6] - [0, 11])
  extend: (extends_clause [0, 12] - [4, 1]
    type: (type_identifier [0, 20] - [0, 24])
    arguments: (arguments [0, 24] - [4, 1]
      (assignment_expression [1, 2] - [4, 0]
        left: (identifier [1, 2] - [1, 7])
        right: (for_expression [2, 4] - [4, 0]
          enumerators: (enumerators [2, 8] - [2, 21]
            (enumerator [2, 8] - [2, 21]
              (identifier [2, 8] - [2, 9])
              (call_expression [2, 13] - [2, 21]
                function: (identifier [2, 13] - [2, 16])
                arguments: (arguments [2, 16] - [2, 21]
                  (string [2, 17] - [2, 20])))))
          (ERROR [2, 28] - [2, 29])
          body: (indented_block [3, 4] - [4, 0]
            (string [3, 4] - [3, 11]))))))))

What do you expect the tree to look like

(compilation_unit [0, 0] - [3, 1]
  (class_definition [0, 0] - [3, 1]
    name: (identifier [0, 6] - [0, 11])
    extend: (extends_clause [0, 12] - [3, 1]
      type: (type_identifier [0, 20] - [0, 24])
      arguments: (arguments [0, 24] - [3, 1]
        (assignment_expression [1, 2] - [1, 35]
          left: (identifier [1, 2] - [1, 7])
          right: (for_expression [1, 10] - [1, 35]
            enumerators: (enumerators [1, 14] - [1, 27]
              (enumerator [1, 14] - [1, 27]
                (identifier [1, 14] - [1, 15])
                (call_expression [1, 19] - [1, 27]
                  function: (identifier [1, 19] - [1, 22])
                  arguments: (arguments [1, 22] - [1, 27]
                    (string [1, 23] - [1, 26])))))
            body: (identifier [1, 34] - [1, 35])))
        (string [2, 2] - [2, 9])))))

Where are you experiencing this error?

tree-sitter cli

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/scala3Scala 3 syntaxbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions