tree-sitter / tree-sitter-scala

Scala grammar for tree-sitter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[scala 3] support given keyword inside for comprehension

antosha417 opened this issue · comments

Commit of tree-sitter-scala you tested this on

8062487

A code sample showing the error

package foobar

@main def run =
  for
    given Int <- Some(1)
    two <- Some(2)
  yield println(s"one plus two: ${summon[Int] + two}")

Show the error node

function_declaration [0, 0] - [0, 13]
  annotation [0, 0] - [0, 5]
    name: type_identifier [0, 1] - [0, 5]
  name: identifier [0, 10] - [0, 13]
ERROR [0, 14] - [5, 0]
  infix_pattern [2, 4] - [4, 54]
    left: infix_pattern [2, 4] - [3, 18]
      left: infix_pattern [2, 4] - [3, 10]
        left: infix_pattern [2, 4] - [2, 24]
          left: infix_pattern [2, 4] - [2, 16]
            left: identifier [2, 4] - [2, 9]
            operator: identifier [2, 10] - [2, 13]
            right: operator_identifier [2, 14] - [2, 16]
          operator: identifier [2, 17] - [2, 21]
          right: tuple_pattern [2, 21] - [2, 24]
            integer_literal [2, 22] - [2, 23]
        operator: identifier [3, 4] - [3, 7]
        right: operator_identifier [3, 8] - [3, 10]
      operator: identifier [3, 11] - [3, 15]
      right: tuple_pattern [3, 15] - [3, 18]
        integer_literal [3, 16] - [3, 17]
    operator: identifier [4, 2] - [4, 7]
    right: case_class_pattern [4, 8] - [4, 54]
      type: type_identifier [4, 8] - [4, 15]
      pattern: interpolated_string_expression [4, 16] - [4, 53]
        interpolator: identifier [4, 16] - [4, 17]
        interpolated_string [4, 17] - [4, 53]
          interpolation [4, 32] - [4, 52]
            block [4, 33] - [4, 52]
              infix_expression [4, 34] - [4, 51]
                left: generic_function [4, 34] - [4, 45]
                  function: identifier [4, 34] - [4, 40]
                  type_arguments: type_arguments [4, 40] - [4, 45]
                    type_identifier [4, 41] - [4, 44]
                operator: operator_identifier [4, 46] - [4, 47]
                right: identifier [4, 48] - [4, 51]
Screenshot 2023-07-03 at 11 07 08

What do you expect the tree to look like

grammar should parse this file without error

Where are you experiencing this error?

nvim-treesitter

@antosha417 thanks for reporting!