Skip to content

Fix is_expression and is_pattern_expression parsing #317

@tamasvajk

Description

@tamasvajk

The below two is expressions produce different parse trees. The former is correctly parsed as is_expression and latter is incorrectly parsed as is_pattern_expression.

var x = y is int;
var x = y is A;
(compilation_unit [0, 0] - [1, 15]
  (global_statement [0, 0] - [0, 17]
    (local_declaration_statement [0, 0] - [0, 17]
      (variable_declaration [0, 0] - [0, 16]
        type: (implicit_type [0, 0] - [0, 3])
        (variable_declarator [0, 4] - [0, 16]
          (identifier [0, 4] - [0, 5])
          (equals_value_clause [0, 6] - [0, 16]
            (is_expression [0, 8] - [0, 16]
              left: (identifier [0, 8] - [0, 9])
              right: (predefined_type [0, 13] - [0, 16])))))))
  (global_statement [1, 0] - [1, 15]
    (local_declaration_statement [1, 0] - [1, 15]
      (variable_declaration [1, 0] - [1, 14]
        type: (implicit_type [1, 0] - [1, 3])
        (variable_declarator [1, 4] - [1, 14]
          (identifier [1, 4] - [1, 5])
          (equals_value_clause [1, 6] - [1, 14]
            (is_pattern_expression [1, 8] - [1, 14]
              expression: (identifier [1, 8] - [1, 9])
              pattern: (constant_pattern [1, 13] - [1, 14]
                (identifier [1, 13] - [1, 14])))))))))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions