Skip to content

Infix types in match type cases #360

@susliko

Description

@susliko

Commit of tree-sitter-scala you tested this on

59ab070

A code sample showing the error

type F[T] = T match {
  case t *: EmptyTuple => t
  case t *: rest => t 
}

Show the error node

(compilation_unit [0, 0] - [4, 0]
  (type_definition [0, 0] - [3, 1]
    name: (type_identifier [0, 5] - [0, 6])
    type_parameters: (type_parameters [0, 6] - [0, 9]
      name: (identifier [0, 7] - [0, 8]))
    (ERROR [0, 12] - [0, 19]
      (type_identifier [0, 12] - [0, 13]))
    type: (structural_type [0, 20] - [3, 1]
      (ERROR [1, 2] - [1, 6])
      (infix_expression [1, 7] - [1, 22]
        left: (identifier [1, 7] - [1, 8])
        operator: (operator_identifier [1, 9] - [1, 11])
        right: (identifier [1, 12] - [1, 22]))
      (ERROR [1, 23] - [2, 21]
        (infix_expression [1, 26] - [2, 8]
          left: (identifier [1, 26] - [1, 27])
          operator: (identifier [2, 2] - [2, 6])
          right: (identifier [2, 7] - [2, 8]))
        (operator_identifier [2, 9] - [2, 11])
        (lambda_expression [2, 12] - [2, 21]
          parameters: (identifier [2, 12] - [2, 16])
          (identifier [2, 20] - [2, 21]))))))

What do you expect the tree to look like

t *: rest should be parsed as an infix type instead of infix expression

Where are you experiencing this error?

No response

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