================================================================================
Assignment to Prefix Unary Expressions
================================================================================

a = +a;
a = -a;
a = !a;
a = ~a;
a = ++a;
a = --a;
a = a++;
a = a--;
a = a!;

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (expression_statement
      (assignment_expression
        left: (identifier)
        right: (prefix_unary_expression
          (identifier)))))
  (global_statement
    (expression_statement
      (assignment_expression
        left: (identifier)
        right: (prefix_unary_expression
          (identifier)))))
  (global_statement
    (expression_statement
      (assignment_expression
        left: (identifier)
        right: (prefix_unary_expression
          (identifier)))))
  (global_statement
    (expression_statement
      (assignment_expression
        left: (identifier)
        right: (prefix_unary_expression
          (identifier)))))
  (global_statement
    (expression_statement
      (assignment_expression
        left: (identifier)
        right: (prefix_unary_expression
          (identifier)))))
  (global_statement
    (expression_statement
      (assignment_expression
        left: (identifier)
        right: (prefix_unary_expression
          (identifier)))))
  (global_statement
    (expression_statement
      (assignment_expression
        left: (identifier)
        right: (postfix_unary_expression
          (identifier)))))
  (global_statement
    (expression_statement
      (assignment_expression
        left: (identifier)
        right: (postfix_unary_expression
          (identifier)))))
  (global_statement
    (expression_statement
      (assignment_expression
        left: (identifier)
        right: (postfix_unary_expression
          (identifier))))))

================================================================================
Assignment to Binary Expressions
================================================================================

a = a + a;
a = a - a;
a = a * a;
a = a / a;
a = a % a;
a = a & a;
a = a | a;
a = a ^ a;
a = a >> a;
a = a << a;
a = a >>> a;

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (expression_statement
      (assignment_expression
        left: (identifier)
        right: (binary_expression
          left: (identifier)
          right: (identifier)))))
  (global_statement
    (expression_statement
      (assignment_expression
        left: (identifier)
        right: (binary_expression
          left: (identifier)
          right: (identifier)))))
  (global_statement
    (expression_statement
      (assignment_expression
        left: (identifier)
        right: (binary_expression
          left: (identifier)
          right: (identifier)))))
  (global_statement
    (expression_statement
      (assignment_expression
        left: (identifier)
        right: (binary_expression
          left: (identifier)
          right: (identifier)))))
  (global_statement
    (expression_statement
      (assignment_expression
        left: (identifier)
        right: (binary_expression
          left: (identifier)
          right: (identifier)))))
  (global_statement
    (expression_statement
      (assignment_expression
        left: (identifier)
        right: (binary_expression
          left: (identifier)
          right: (identifier)))))
  (global_statement
    (expression_statement
      (assignment_expression
        left: (identifier)
        right: (binary_expression
          left: (identifier)
          right: (identifier)))))
  (global_statement
    (expression_statement
      (assignment_expression
        left: (identifier)
        right: (binary_expression
          left: (identifier)
          right: (identifier)))))
  (global_statement
    (expression_statement
      (assignment_expression
        left: (identifier)
        right: (binary_expression
          left: (identifier)
          right: (identifier)))))
  (global_statement
    (expression_statement
      (assignment_expression
        left: (identifier)
        right: (binary_expression
          left: (identifier)
          right: (identifier)))))
  (global_statement
    (expression_statement
      (assignment_expression
        left: (identifier)
        right: (binary_expression
          left: (identifier)
          right: (identifier))))))

================================================================================
Assignment to Binary Equality Expressions
================================================================================

a = a == b;
a = a != b;
a = a < b;
a = a <= b;
a = a > b;
a = a >= b;

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (expression_statement
      (assignment_expression
        left: (identifier)
        right: (binary_expression
          left: (identifier)
          right: (identifier)))))
  (global_statement
    (expression_statement
      (assignment_expression
        left: (identifier)
        right: (binary_expression
          left: (identifier)
          right: (identifier)))))
  (global_statement
    (expression_statement
      (assignment_expression
        left: (identifier)
        right: (binary_expression
          left: (identifier)
          right: (identifier)))))
  (global_statement
    (expression_statement
      (assignment_expression
        left: (identifier)
        right: (binary_expression
          left: (identifier)
          right: (identifier)))))
  (global_statement
    (expression_statement
      (assignment_expression
        left: (identifier)
        right: (binary_expression
          left: (identifier)
          right: (identifier)))))
  (global_statement
    (expression_statement
      (assignment_expression
        left: (identifier)
        right: (binary_expression
          left: (identifier)
          right: (identifier))))))

================================================================================
Assignment Binary Expressions
================================================================================

a += a;
a -= a;
a *= a;
a /= a;
a %= a;
a++;
a--;
a <<= a;
a >>= a;
a >>>= a;

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (expression_statement
      (assignment_expression
        left: (identifier)
        right: (identifier))))
  (global_statement
    (expression_statement
      (assignment_expression
        left: (identifier)
        right: (identifier))))
  (global_statement
    (expression_statement
      (assignment_expression
        left: (identifier)
        right: (identifier))))
  (global_statement
    (expression_statement
      (assignment_expression
        left: (identifier)
        right: (identifier))))
  (global_statement
    (expression_statement
      (assignment_expression
        left: (identifier)
        right: (identifier))))
  (global_statement
    (expression_statement
      (postfix_unary_expression
        (identifier))))
  (global_statement
    (expression_statement
      (postfix_unary_expression
        (identifier))))
  (global_statement
    (expression_statement
      (assignment_expression
        left: (identifier)
        right: (identifier))))
  (global_statement
    (expression_statement
      (assignment_expression
        left: (identifier)
        right: (identifier))))
  (global_statement
    (expression_statement
      (assignment_expression
        left: (identifier)
        right: (identifier)))))

================================================================================
Assignment LValue types
================================================================================

a = 1;
a.b = 1;
a[b] = 1;
(a, b) = (1, 2);
(var a, b) = (1, 2);
var x = new A
{
  a = 1,
  [b] = 1
};
(a) = 1;
*p = 0;

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (expression_statement
      (assignment_expression
        left: (identifier)
        right: (integer_literal))))
  (global_statement
    (expression_statement
      (assignment_expression
        left: (member_access_expression
          expression: (identifier)
          name: (identifier))
        right: (integer_literal))))
  (global_statement
    (expression_statement
      (assignment_expression
        left: (element_access_expression
          expression: (identifier)
          subscript: (bracketed_argument_list
            (argument
              (identifier))))
        right: (integer_literal))))
  (global_statement
    (expression_statement
      (assignment_expression
        left: (tuple_expression
          (argument
            (identifier))
          (argument
            (identifier)))
        right: (tuple_expression
          (argument
            (integer_literal))
          (argument
            (integer_literal))))))
  (global_statement
    (expression_statement
      (assignment_expression
        left: (tuple_expression
          (argument
            (declaration_expression
              type: (implicit_type)
              name: (identifier)))
          (argument
            (identifier)))
        right: (tuple_expression
          (argument
            (integer_literal))
          (argument
            (integer_literal))))))
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (object_creation_expression
            type: (identifier)
            initializer: (initializer_expression
              (assignment_expression
                left: (identifier)
                right: (integer_literal))
              (assignment_expression
                left: (element_binding_expression
                  (argument
                    (identifier)))
                right: (integer_literal))))))))
  (global_statement
    (expression_statement
      (assignment_expression
        left: (parenthesized_expression
          (identifier))
        right: (integer_literal))))
  (global_statement
    (expression_statement
      (assignment_expression
        left: (prefix_unary_expression
          (identifier))
        right: (integer_literal)))))

================================================================================
Ternary Expression
================================================================================

class Foo {
  void Test() {
    var y = x ? "foo" : "bar";
  }
}

--------------------------------------------------------------------------------

(compilation_unit
  (class_declaration
    name: (identifier)
    body: (declaration_list
      (method_declaration
        returns: (predefined_type)
        name: (identifier)
        parameters: (parameter_list)
        body: (block
          (local_declaration_statement
            (variable_declaration
              type: (implicit_type)
              (variable_declarator
                name: (identifier)
                (conditional_expression
                  condition: (identifier)
                  consequence: (string_literal
                    (string_literal_content))
                  alternative: (string_literal
                    (string_literal_content)))))))))))

================================================================================
Binary Expressions
================================================================================

class Foo {
  void Test() {
    var b = x == y;
    var i = 1 + 2;
  }
}

--------------------------------------------------------------------------------

(compilation_unit
  (class_declaration
    name: (identifier)
    body: (declaration_list
      (method_declaration
        returns: (predefined_type)
        name: (identifier)
        parameters: (parameter_list)
        body: (block
          (local_declaration_statement
            (variable_declaration
              type: (implicit_type)
              (variable_declarator
                name: (identifier)
                (binary_expression
                  left: (identifier)
                  right: (identifier)))))
          (local_declaration_statement
            (variable_declaration
              type: (implicit_type)
              (variable_declarator
                name: (identifier)
                (binary_expression
                  left: (integer_literal)
                  right: (integer_literal))))))))))

================================================================================
Ternary expressions is type
================================================================================

var t = x is int
  ? a
  : b;

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (conditional_expression
            condition: (is_expression
              left: (identifier)
              right: (predefined_type))
            consequence: (identifier)
            alternative: (identifier)))))))

================================================================================
Ternary expressions is nullable type
================================================================================

var u = x is int?
  ? a
  : b;

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (conditional_expression
            condition: (is_expression
              left: (identifier)
              right: (nullable_type
                type: (predefined_type)))
            consequence: (identifier)
            alternative: (identifier)))))))

================================================================================
Prefix-Unary Expressions
================================================================================

class Foo {
  void Test() {
    ++x;
    --y;
  }
}

--------------------------------------------------------------------------------

(compilation_unit
  (class_declaration
    name: (identifier)
    body: (declaration_list
      (method_declaration
        returns: (predefined_type)
        name: (identifier)
        parameters: (parameter_list)
        body: (block
          (expression_statement
            (prefix_unary_expression
              (identifier)))
          (expression_statement
            (prefix_unary_expression
              (identifier))))))))

================================================================================
Cast expressions
================================================================================

void Test() {
  a = (B)c + (C)d;
}

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_function_statement
      type: (predefined_type)
      name: (identifier)
      parameters: (parameter_list)
      body: (block
        (expression_statement
          (assignment_expression
            left: (identifier)
            right: (binary_expression
              left: (cast_expression
                type: (identifier)
                value: (identifier))
              right: (cast_expression
                type: (identifier)
                value: (identifier)))))))))

================================================================================
Cast expression of array access
================================================================================

b = (float)a[0];

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (expression_statement
      (assignment_expression
        left: (identifier)
        right: (cast_expression
          type: (predefined_type)
          value: (element_access_expression
            expression: (identifier)
            subscript: (bracketed_argument_list
              (argument
                (integer_literal)))))))))

================================================================================
Cast with parenthesized expression
================================================================================

var o = (A.A)(a.a.a);
var o = (Int32)(1);
var o = (Int32)(1);
var o = (Int32)((1));

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (cast_expression
            type: (qualified_name
              qualifier: (identifier)
              name: (identifier))
            value: (parenthesized_expression
              (member_access_expression
                expression: (member_access_expression
                  expression: (identifier)
                  name: (identifier))
                name: (identifier))))))))
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (cast_expression
            type: (identifier)
            value: (parenthesized_expression
              (integer_literal)))))))
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (cast_expression
            type: (identifier)
            value: (parenthesized_expression
              (integer_literal)))))))
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (cast_expression
            type: (identifier)
            value: (parenthesized_expression
              (parenthesized_expression
                (integer_literal)))))))))

================================================================================
Precedence of unary prefix operator and element access
================================================================================

b = +a[0];

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (expression_statement
      (assignment_expression
        left: (identifier)
        right: (prefix_unary_expression
          (element_access_expression
            expression: (identifier)
            subscript: (bracketed_argument_list
              (argument
                (integer_literal)))))))))

================================================================================
Precedence of switch_expression and binary_expression
================================================================================

b = 2 * a switch
{
    1 => 1,
    _ => 0,
};

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (expression_statement
      (assignment_expression
        left: (identifier)
        right: (binary_expression
          left: (integer_literal)
          right: (switch_expression
            (identifier)
            (switch_expression_arm
              (constant_pattern
                (integer_literal))
              (integer_literal))
            (switch_expression_arm
              (discard)
              (integer_literal))))))))

================================================================================
Anonymous object creation with empty body
================================================================================

void b() {
  var x = new {
  };
}

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_function_statement
      type: (predefined_type)
      name: (identifier)
      parameters: (parameter_list)
      body: (block
        (local_declaration_statement
          (variable_declaration
            type: (implicit_type)
            (variable_declarator
              name: (identifier)
              (anonymous_object_creation_expression))))))))

================================================================================
Target-type object creation
================================================================================

void b() {
  Friend friend = new("hi");
}

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_function_statement
      type: (predefined_type)
      name: (identifier)
      parameters: (parameter_list)
      body: (block
        (local_declaration_statement
          (variable_declaration
            type: (identifier)
            (variable_declarator
              name: (identifier)
              (implicit_object_creation_expression
                (argument_list
                  (argument
                    (string_literal
                      (string_literal_content))))))))))))

================================================================================
Anonymous object creation with single unnamed
================================================================================

void b() {
  var x = new {
    args
  };
}

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_function_statement
      type: (predefined_type)
      name: (identifier)
      parameters: (parameter_list)
      body: (block
        (local_declaration_statement
          (variable_declaration
            type: (implicit_type)
            (variable_declarator
              name: (identifier)
              (anonymous_object_creation_expression
                (identifier)))))))))

================================================================================
Anonymous object creation with single named
================================================================================

void b() {
  var x = new {
    test = "This"
  };
}

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_function_statement
      type: (predefined_type)
      name: (identifier)
      parameters: (parameter_list)
      body: (block
        (local_declaration_statement
          (variable_declaration
            type: (implicit_type)
            (variable_declarator
              name: (identifier)
              (anonymous_object_creation_expression
                (identifier)
                (string_literal
                  (string_literal_content))))))))))

================================================================================
Checked expressions
================================================================================

void b() {
  var three = checked(1 + 2);
}

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_function_statement
      type: (predefined_type)
      name: (identifier)
      parameters: (parameter_list)
      body: (block
        (local_declaration_statement
          (variable_declaration
            type: (implicit_type)
            (variable_declarator
              name: (identifier)
              (checked_expression
                (binary_expression
                  left: (integer_literal)
                  right: (integer_literal))))))))))

================================================================================
Object creation expressions
================================================================================

void b() {
  new C.D(1, "hi");
  a = new E
  {
    Foo = bar,
  };

  b = new E(1);

  c = new E(1) { };
}

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_function_statement
      type: (predefined_type)
      name: (identifier)
      parameters: (parameter_list)
      body: (block
        (expression_statement
          (object_creation_expression
            type: (qualified_name
              qualifier: (identifier)
              name: (identifier))
            arguments: (argument_list
              (argument
                (integer_literal))
              (argument
                (string_literal
                  (string_literal_content))))))
        (expression_statement
          (assignment_expression
            left: (identifier)
            right: (object_creation_expression
              type: (identifier)
              initializer: (initializer_expression
                (assignment_expression
                  left: (identifier)
                  right: (identifier))))))
        (expression_statement
          (assignment_expression
            left: (identifier)
            right: (object_creation_expression
              type: (identifier)
              arguments: (argument_list
                (argument
                  (integer_literal))))))
        (expression_statement
          (assignment_expression
            left: (identifier)
            right: (object_creation_expression
              type: (identifier)
              arguments: (argument_list
                (argument
                  (integer_literal)))
              initializer: (initializer_expression))))))))

================================================================================
Named parameters in constructors
================================================================================

void b() {
  var z = new C(a: 1, b: "hi");
}

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_function_statement
      type: (predefined_type)
      name: (identifier)
      parameters: (parameter_list)
      body: (block
        (local_declaration_statement
          (variable_declaration
            type: (implicit_type)
            (variable_declarator
              name: (identifier)
              (object_creation_expression
                type: (identifier)
                arguments: (argument_list
                  (argument
                    name: (identifier)
                    (integer_literal))
                  (argument
                    name: (identifier)
                    (string_literal
                      (string_literal_content))))))))))))

================================================================================
Named parameters in method calls
================================================================================

void b() {
  z = A.B(a: 1, b: "hi");
}

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_function_statement
      type: (predefined_type)
      name: (identifier)
      parameters: (parameter_list)
      body: (block
        (expression_statement
          (assignment_expression
            left: (identifier)
            right: (invocation_expression
              function: (member_access_expression
                expression: (identifier)
                name: (identifier))
              arguments: (argument_list
                (argument
                  name: (identifier)
                  (integer_literal))
                (argument
                  name: (identifier)
                  (string_literal
                    (string_literal_content)))))))))))

================================================================================
Named parameters using contextually reserved words
================================================================================

void b() {
  resultNode = B(from: 1, into: "hi");
}

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_function_statement
      type: (predefined_type)
      name: (identifier)
      parameters: (parameter_list)
      body: (block
        (expression_statement
          (assignment_expression
            left: (identifier)
            right: (invocation_expression
              function: (identifier)
              arguments: (argument_list
                (argument
                  name: (identifier)
                  (integer_literal))
                (argument
                  name: (identifier)
                  (string_literal
                    (string_literal_content)))))))))))

================================================================================
Anonymous method expressions
================================================================================

void a() {
  var d = delegate(int a) {
    return a;
  };
}

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_function_statement
      type: (predefined_type)
      name: (identifier)
      parameters: (parameter_list)
      body: (block
        (local_declaration_statement
          (variable_declaration
            type: (implicit_type)
            (variable_declarator
              name: (identifier)
              (anonymous_method_expression
                parameters: (parameter_list
                  (parameter
                    type: (predefined_type)
                    name: (identifier)))
                (block
                  (return_statement
                    (identifier)))))))))))

================================================================================
Anonymous method expression with discard parameters
================================================================================

void a() {
  var d = delegate(int _, int _) {
    return a;
  };
}

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_function_statement
      type: (predefined_type)
      name: (identifier)
      parameters: (parameter_list)
      body: (block
        (local_declaration_statement
          (variable_declaration
            type: (implicit_type)
            (variable_declarator
              name: (identifier)
              (anonymous_method_expression
                parameters: (parameter_list
                  (parameter
                    type: (predefined_type)
                    name: (identifier))
                  (parameter
                    type: (predefined_type)
                    name: (identifier)))
                (block
                  (return_statement
                    (identifier)))))))))))

================================================================================
Anonymous method expression with modifiers
================================================================================

void m() {
  var a = static delegate(int a) { return a; };
  var b = async delegate(int a) { return a; };
  var c = async static delegate(int a) { return a; };
  var d = static async delegate(int a) { return a; };
}

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_function_statement
      type: (predefined_type)
      name: (identifier)
      parameters: (parameter_list)
      body: (block
        (local_declaration_statement
          (variable_declaration
            type: (implicit_type)
            (variable_declarator
              name: (identifier)
              (anonymous_method_expression
                (modifier)
                parameters: (parameter_list
                  (parameter
                    type: (predefined_type)
                    name: (identifier)))
                (block
                  (return_statement
                    (identifier)))))))
        (local_declaration_statement
          (variable_declaration
            type: (implicit_type)
            (variable_declarator
              name: (identifier)
              (anonymous_method_expression
                (modifier)
                parameters: (parameter_list
                  (parameter
                    type: (predefined_type)
                    name: (identifier)))
                (block
                  (return_statement
                    (identifier)))))))
        (local_declaration_statement
          (variable_declaration
            type: (implicit_type)
            (variable_declarator
              name: (identifier)
              (anonymous_method_expression
                (modifier)
                (modifier)
                parameters: (parameter_list
                  (parameter
                    type: (predefined_type)
                    name: (identifier)))
                (block
                  (return_statement
                    (identifier)))))))
        (local_declaration_statement
          (variable_declaration
            type: (implicit_type)
            (variable_declarator
              name: (identifier)
              (anonymous_method_expression
                (modifier)
                (modifier)
                parameters: (parameter_list
                  (parameter
                    type: (predefined_type)
                    name: (identifier)))
                (block
                  (return_statement
                    (identifier)))))))))))

================================================================================
Lambda expressions
================================================================================

void a() {
  var l = x => x + 1;
  var l = (A a, B b) => { return a.c(b); };
  var l = RetType (A a, B b) => { return 1; };
}

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_function_statement
      type: (predefined_type)
      name: (identifier)
      parameters: (parameter_list)
      body: (block
        (local_declaration_statement
          (variable_declaration
            type: (implicit_type)
            (variable_declarator
              name: (identifier)
              (lambda_expression
                parameters: (implicit_parameter)
                body: (binary_expression
                  left: (identifier)
                  right: (integer_literal))))))
        (local_declaration_statement
          (variable_declaration
            type: (implicit_type)
            (variable_declarator
              name: (identifier)
              (lambda_expression
                parameters: (parameter_list
                  (parameter
                    type: (identifier)
                    name: (identifier))
                  (parameter
                    type: (identifier)
                    name: (identifier)))
                body: (block
                  (return_statement
                    (invocation_expression
                      function: (member_access_expression
                        expression: (identifier)
                        name: (identifier))
                      arguments: (argument_list
                        (argument
                          (identifier))))))))))
        (local_declaration_statement
          (variable_declaration
            type: (implicit_type)
            (variable_declarator
              name: (identifier)
              (lambda_expression
                type: (identifier)
                parameters: (parameter_list
                  (parameter
                    type: (identifier)
                    name: (identifier))
                  (parameter
                    type: (identifier)
                    name: (identifier)))
                body: (block
                  (return_statement
                    (integer_literal)))))))))))

================================================================================
Async Lambda
================================================================================

void a()
{
    Do(async () => {});
}

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_function_statement
      type: (predefined_type)
      name: (identifier)
      parameters: (parameter_list)
      body: (block
        (expression_statement
          (invocation_expression
            function: (identifier)
            arguments: (argument_list
              (argument
                (lambda_expression
                  (modifier)
                  parameters: (parameter_list)
                  body: (block))))))))))

================================================================================
Lambda expression with modifiers
================================================================================

void a() {
  var lam = static x => x + 1;
  var bda = async x => x + 1;
  var syn = async static x => x + 1;
  var txt = static async x => x + 1;
}

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_function_statement
      type: (predefined_type)
      name: (identifier)
      parameters: (parameter_list)
      body: (block
        (local_declaration_statement
          (variable_declaration
            type: (implicit_type)
            (variable_declarator
              name: (identifier)
              (lambda_expression
                (modifier)
                parameters: (implicit_parameter)
                body: (binary_expression
                  left: (identifier)
                  right: (integer_literal))))))
        (local_declaration_statement
          (variable_declaration
            type: (implicit_type)
            (variable_declarator
              name: (identifier)
              (lambda_expression
                (modifier)
                parameters: (implicit_parameter)
                body: (binary_expression
                  left: (identifier)
                  right: (integer_literal))))))
        (local_declaration_statement
          (variable_declaration
            type: (implicit_type)
            (variable_declarator
              name: (identifier)
              (lambda_expression
                (modifier)
                (modifier)
                parameters: (implicit_parameter)
                body: (binary_expression
                  left: (identifier)
                  right: (integer_literal))))))
        (local_declaration_statement
          (variable_declaration
            type: (implicit_type)
            (variable_declarator
              name: (identifier)
              (lambda_expression
                (modifier)
                (modifier)
                parameters: (implicit_parameter)
                body: (binary_expression
                  left: (identifier)
                  right: (integer_literal))))))))))

================================================================================
Lambda expression with discard parameters
================================================================================

void a() {
  var lam = (_, _) => 0;
  var bda = (int _, int _) => 0;
}

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_function_statement
      type: (predefined_type)
      name: (identifier)
      parameters: (parameter_list)
      body: (block
        (local_declaration_statement
          (variable_declaration
            type: (implicit_type)
            (variable_declarator
              name: (identifier)
              (lambda_expression
                parameters: (parameter_list
                  (parameter
                    name: (identifier))
                  (parameter
                    name: (identifier)))
                body: (integer_literal)))))
        (local_declaration_statement
          (variable_declaration
            type: (implicit_type)
            (variable_declarator
              name: (identifier)
              (lambda_expression
                parameters: (parameter_list
                  (parameter
                    type: (predefined_type)
                    name: (identifier))
                  (parameter
                    type: (predefined_type)
                    name: (identifier)))
                body: (integer_literal)))))))))

================================================================================
Lambda expression with ref modifier
================================================================================

MyIntDelegate a = (ref int i) => i + 1;

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (identifier)
        (variable_declarator
          name: (identifier)
          (lambda_expression
            parameters: (parameter_list
              (parameter
                type: (ref_type
                  type: (predefined_type))
                name: (identifier)))
            body: (binary_expression
              left: (identifier)
              right: (integer_literal))))))))

================================================================================
Invocation expressions
================================================================================

void a() {
  b(c, in d, out e, ref f, out var g);
}

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_function_statement
      type: (predefined_type)
      name: (identifier)
      parameters: (parameter_list)
      body: (block
        (expression_statement
          (invocation_expression
            function: (identifier)
            arguments: (argument_list
              (argument
                (identifier))
              (argument
                (identifier))
              (argument
                (identifier))
              (argument
                (identifier))
              (argument
                (declaration_expression
                  type: (implicit_type)
                  name: (identifier))))))))))

================================================================================
Tuple expressions
================================================================================

void a() {
  b = (c, d: "e");
}

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_function_statement
      type: (predefined_type)
      name: (identifier)
      parameters: (parameter_list)
      body: (block
        (expression_statement
          (assignment_expression
            left: (identifier)
            right: (tuple_expression
              (argument
                (identifier))
              (argument
                name: (identifier)
                (string_literal
                  (string_literal_content))))))))))

================================================================================
Implicit array creation
================================================================================

void b() {
  var z = new [] { 1, 2, 3 };
}

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_function_statement
      type: (predefined_type)
      name: (identifier)
      parameters: (parameter_list)
      body: (block
        (local_declaration_statement
          (variable_declaration
            type: (implicit_type)
            (variable_declarator
              name: (identifier)
              (implicit_array_creation_expression
                (initializer_expression
                  (integer_literal)
                  (integer_literal)
                  (integer_literal))))))))))

================================================================================
Implicit multi array creation
================================================================================

void b() {
  var z = new [,] { { 1, 1 }, { 2, 2 }, { 3, 3 } };
}

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_function_statement
      type: (predefined_type)
      name: (identifier)
      parameters: (parameter_list)
      body: (block
        (local_declaration_statement
          (variable_declaration
            type: (implicit_type)
            (variable_declarator
              name: (identifier)
              (implicit_array_creation_expression
                (initializer_expression
                  (initializer_expression
                    (integer_literal)
                    (integer_literal))
                  (initializer_expression
                    (integer_literal)
                    (integer_literal))
                  (initializer_expression
                    (integer_literal)
                    (integer_literal)))))))))))

================================================================================
Stackalloc implicit array
================================================================================

void b() {
  var z = stackalloc [] { 1, 2, 3 };
}

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_function_statement
      type: (predefined_type)
      name: (identifier)
      parameters: (parameter_list)
      body: (block
        (local_declaration_statement
          (variable_declaration
            type: (implicit_type)
            (variable_declarator
              name: (identifier)
              (implicit_stackalloc_expression
                (initializer_expression
                  (integer_literal)
                  (integer_literal)
                  (integer_literal))))))))))

================================================================================
Stackalloc explicit array
================================================================================

void b() {
  var z = stackalloc int[] { 1, 2, 3 };
}

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_function_statement
      type: (predefined_type)
      name: (identifier)
      parameters: (parameter_list)
      body: (block
        (local_declaration_statement
          (variable_declaration
            type: (implicit_type)
            (variable_declarator
              name: (identifier)
              (stackalloc_expression
                type: (array_type
                  type: (predefined_type)
                  rank: (array_rank_specifier))
                (initializer_expression
                  (integer_literal)
                  (integer_literal)
                  (integer_literal))))))))))

================================================================================
Explicit array creation
================================================================================

void b() {
  var z = new int[3] { 1, 2, 3 };
  var b = new byte[,] { { 1, 2 }, { 2, 3 } };
}

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_function_statement
      type: (predefined_type)
      name: (identifier)
      parameters: (parameter_list)
      body: (block
        (local_declaration_statement
          (variable_declaration
            type: (implicit_type)
            (variable_declarator
              name: (identifier)
              (array_creation_expression
                type: (array_type
                  type: (predefined_type)
                  rank: (array_rank_specifier
                    (integer_literal)))
                (initializer_expression
                  (integer_literal)
                  (integer_literal)
                  (integer_literal))))))
        (local_declaration_statement
          (variable_declaration
            type: (implicit_type)
            (variable_declarator
              name: (identifier)
              (array_creation_expression
                type: (array_type
                  type: (predefined_type)
                  rank: (array_rank_specifier))
                (initializer_expression
                  (initializer_expression
                    (integer_literal)
                    (integer_literal))
                  (initializer_expression
                    (integer_literal)
                    (integer_literal)))))))))))

================================================================================
Explicit multi array creation
================================================================================

void b() {
  var z = new int[3,2] { { 1, 1 }, { 2, 2 }, { 3, 3 } };
}

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_function_statement
      type: (predefined_type)
      name: (identifier)
      parameters: (parameter_list)
      body: (block
        (local_declaration_statement
          (variable_declaration
            type: (implicit_type)
            (variable_declarator
              name: (identifier)
              (array_creation_expression
                type: (array_type
                  type: (predefined_type)
                  rank: (array_rank_specifier
                    (integer_literal)
                    (integer_literal)))
                (initializer_expression
                  (initializer_expression
                    (integer_literal)
                    (integer_literal))
                  (initializer_expression
                    (integer_literal)
                    (integer_literal))
                  (initializer_expression
                    (integer_literal)
                    (integer_literal)))))))))))

================================================================================
Array of named tuple
================================================================================

void a() {
  var z = new (string b, string c)[3];
}

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_function_statement
      type: (predefined_type)
      name: (identifier)
      parameters: (parameter_list)
      body: (block
        (local_declaration_statement
          (variable_declaration
            type: (implicit_type)
            (variable_declarator
              name: (identifier)
              (array_creation_expression
                type: (array_type
                  type: (tuple_type
                    (tuple_element
                      type: (predefined_type)
                      name: (identifier))
                    (tuple_element
                      type: (predefined_type)
                      name: (identifier)))
                  rank: (array_rank_specifier
                    (integer_literal)))))))))))

================================================================================
Makeref
================================================================================

void b() {
  var gp = __makeref(g);
}

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_function_statement
      type: (predefined_type)
      name: (identifier)
      parameters: (parameter_list)
      body: (block
        (local_declaration_statement
          (variable_declaration
            type: (implicit_type)
            (variable_declarator
              name: (identifier)
              (makeref_expression
                (identifier)))))))))

================================================================================
Postfix unary
================================================================================

void b() {
  a--;
  a++;
  var b=a!;
}

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_function_statement
      type: (predefined_type)
      name: (identifier)
      parameters: (parameter_list)
      body: (block
        (expression_statement
          (postfix_unary_expression
            (identifier)))
        (expression_statement
          (postfix_unary_expression
            (identifier)))
        (local_declaration_statement
          (variable_declaration
            type: (implicit_type)
            (variable_declarator
              name: (identifier)
              (postfix_unary_expression
                (identifier)))))))))

================================================================================
__reftype
================================================================================

void b() {
  var z = __reftype(g);
}

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_function_statement
      type: (predefined_type)
      name: (identifier)
      parameters: (parameter_list)
      body: (block
        (local_declaration_statement
          (variable_declaration
            type: (implicit_type)
            (variable_declarator
              name: (identifier)
              (reftype_expression
                (identifier)))))))))

================================================================================
__refvalue
================================================================================

void b() {
  var z = __refvalue(g, int);
}

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_function_statement
      type: (predefined_type)
      name: (identifier)
      parameters: (parameter_list)
      body: (block
        (local_declaration_statement
          (variable_declaration
            type: (implicit_type)
            (variable_declarator
              name: (identifier)
              (refvalue_expression
                value: (identifier)
                type: (predefined_type)))))))))

================================================================================
sizeof
================================================================================

void b() {
  var z = sizeof(int);
}

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_function_statement
      type: (predefined_type)
      name: (identifier)
      parameters: (parameter_list)
      body: (block
        (local_declaration_statement
          (variable_declaration
            type: (implicit_type)
            (variable_declarator
              name: (identifier)
              (sizeof_expression
                type: (predefined_type)))))))))

================================================================================
typeof
================================================================================

void b() {
  var y = typeof(int);
  var z = typeof(List<string>.Enumerator);
}

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_function_statement
      type: (predefined_type)
      name: (identifier)
      parameters: (parameter_list)
      body: (block
        (local_declaration_statement
          (variable_declaration
            type: (implicit_type)
            (variable_declarator
              name: (identifier)
              (typeof_expression
                type: (predefined_type)))))
        (local_declaration_statement
          (variable_declaration
            type: (implicit_type)
            (variable_declarator
              name: (identifier)
              (typeof_expression
                type: (qualified_name
                  qualifier: (generic_name
                    (identifier)
                    (type_argument_list
                      (predefined_type)))
                  name: (identifier))))))))))

================================================================================
switch expression
================================================================================

void b() {
  var r = operation switch {
      1 => "one",
      2 => "two",
      _ => "more"
  };

  var t = obj.Parent.Parent switch {
    A(S.G) { Parent: A { Parent: B baseProperty } } => baseProperty.Type,
    _ => null,
  };
}

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_function_statement
      type: (predefined_type)
      name: (identifier)
      parameters: (parameter_list)
      body: (block
        (local_declaration_statement
          (variable_declaration
            type: (implicit_type)
            (variable_declarator
              name: (identifier)
              (switch_expression
                (identifier)
                (switch_expression_arm
                  (constant_pattern
                    (integer_literal))
                  (string_literal
                    (string_literal_content)))
                (switch_expression_arm
                  (constant_pattern
                    (integer_literal))
                  (string_literal
                    (string_literal_content)))
                (switch_expression_arm
                  (discard)
                  (string_literal
                    (string_literal_content)))))))
        (local_declaration_statement
          (variable_declaration
            type: (implicit_type)
            (variable_declarator
              name: (identifier)
              (switch_expression
                (member_access_expression
                  expression: (member_access_expression
                    expression: (identifier)
                    name: (identifier))
                  name: (identifier))
                (switch_expression_arm
                  (recursive_pattern
                    type: (identifier)
                    (positional_pattern_clause
                      (subpattern
                        (constant_pattern
                          (member_access_expression
                            expression: (identifier)
                            name: (identifier)))))
                    (property_pattern_clause
                      (subpattern
                        (identifier)
                        (recursive_pattern
                          type: (identifier)
                          (property_pattern_clause
                            (subpattern
                              (identifier)
                              (declaration_pattern
                                type: (identifier)
                                name: (identifier))))))))
                  (member_access_expression
                    expression: (identifier)
                    name: (identifier)))
                (switch_expression_arm
                  (discard)
                  (null_literal))))))))))

================================================================================
switch expression with trailing comma
================================================================================

void b() {
  var r = operation switch {
      1 => "one",
      2 => "two",
      _ => "more",
  };
}

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_function_statement
      type: (predefined_type)
      name: (identifier)
      parameters: (parameter_list)
      body: (block
        (local_declaration_statement
          (variable_declaration
            type: (implicit_type)
            (variable_declarator
              name: (identifier)
              (switch_expression
                (identifier)
                (switch_expression_arm
                  (constant_pattern
                    (integer_literal))
                  (string_literal
                    (string_literal_content)))
                (switch_expression_arm
                  (constant_pattern
                    (integer_literal))
                  (string_literal
                    (string_literal_content)))
                (switch_expression_arm
                  (discard)
                  (string_literal
                    (string_literal_content)))))))))))

================================================================================
switch expression return
================================================================================

string b(Object operation) =>
  operation switch {
      1 => "one",
      _ => "more",
  };

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_function_statement
      type: (predefined_type)
      name: (identifier)
      parameters: (parameter_list
        (parameter
          type: (identifier)
          name: (identifier)))
      body: (arrow_expression_clause
        (switch_expression
          (identifier)
          (switch_expression_arm
            (constant_pattern
              (integer_literal))
            (string_literal
              (string_literal_content)))
          (switch_expression_arm
            (discard)
            (string_literal
              (string_literal_content))))))))

================================================================================
switch expression with patterns
================================================================================

string b(Object operation) =>
  operation switch {
      Declaration d => "declaration",
      Simple => "simple (constant)",
      { } => "nothing",
      var z => "var",
      null => "constant",
      int => "type"
  };

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_function_statement
      type: (predefined_type)
      name: (identifier)
      parameters: (parameter_list
        (parameter
          type: (identifier)
          name: (identifier)))
      body: (arrow_expression_clause
        (switch_expression
          (identifier)
          (switch_expression_arm
            (declaration_pattern
              type: (identifier)
              name: (identifier))
            (string_literal
              (string_literal_content)))
          (switch_expression_arm
            (constant_pattern
              (identifier))
            (string_literal
              (string_literal_content)))
          (switch_expression_arm
            (recursive_pattern
              (property_pattern_clause))
            (string_literal
              (string_literal_content)))
          (switch_expression_arm
            (declaration_pattern
              type: (implicit_type)
              name: (identifier))
            (string_literal
              (string_literal_content)))
          (switch_expression_arm
            (constant_pattern
              (null_literal))
            (string_literal
              (string_literal_content)))
          (switch_expression_arm
            (type_pattern
              type: (predefined_type))
            (string_literal
              (string_literal_content))))))))

================================================================================
await Expression
================================================================================

class Foo {
  void Test() {
    await x;
  }
}

--------------------------------------------------------------------------------

(compilation_unit
  (class_declaration
    name: (identifier)
    body: (declaration_list
      (method_declaration
        returns: (predefined_type)
        name: (identifier)
        parameters: (parameter_list)
        body: (block
          (expression_statement
            (await_expression
              (identifier))))))))

================================================================================
throw expression
================================================================================

class Foo {
  void Test() {
    x = x ?? throw y;
  }
}

--------------------------------------------------------------------------------

(compilation_unit
  (class_declaration
    name: (identifier)
    body: (declaration_list
      (method_declaration
        returns: (predefined_type)
        name: (identifier)
        parameters: (parameter_list)
        body: (block
          (expression_statement
            (assignment_expression
              left: (identifier)
              right: (binary_expression
                left: (identifier)
                right: (throw_expression
                  (identifier))))))))))

================================================================================
Pecedence with OR and XOR
================================================================================

b = 4 | 5 ^ 6;

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (expression_statement
      (assignment_expression
        left: (identifier)
        right: (binary_expression
          left: (integer_literal)
          right: (binary_expression
            left: (integer_literal)
            right: (integer_literal)))))))

================================================================================
range expressions full
================================================================================

class Foo {
  void Test() {
    var a = b[1..4];
    var c = 1..^4;
  }
}

--------------------------------------------------------------------------------

(compilation_unit
  (class_declaration
    name: (identifier)
    body: (declaration_list
      (method_declaration
        returns: (predefined_type)
        name: (identifier)
        parameters: (parameter_list)
        body: (block
          (local_declaration_statement
            (variable_declaration
              type: (implicit_type)
              (variable_declarator
                name: (identifier)
                (element_access_expression
                  expression: (identifier)
                  subscript: (bracketed_argument_list
                    (argument
                      (range_expression
                        (integer_literal)
                        (integer_literal))))))))
          (local_declaration_statement
            (variable_declaration
              type: (implicit_type)
              (variable_declarator
                name: (identifier)
                (range_expression
                  (integer_literal)
                  (prefix_unary_expression
                    (integer_literal)))))))))))

================================================================================
range expressions partial
================================================================================

class Foo {
  void Test() {
    var a = b[..4];
    var c = ^1..;
    var d = b[..];
  }
}

--------------------------------------------------------------------------------

(compilation_unit
  (class_declaration
    name: (identifier)
    body: (declaration_list
      (method_declaration
        returns: (predefined_type)
        name: (identifier)
        parameters: (parameter_list)
        body: (block
          (local_declaration_statement
            (variable_declaration
              type: (implicit_type)
              (variable_declarator
                name: (identifier)
                (element_access_expression
                  expression: (identifier)
                  subscript: (bracketed_argument_list
                    (argument
                      (range_expression
                        (integer_literal))))))))
          (local_declaration_statement
            (variable_declaration
              type: (implicit_type)
              (variable_declarator
                name: (identifier)
                (range_expression
                  (prefix_unary_expression
                    (integer_literal))))))
          (local_declaration_statement
            (variable_declaration
              type: (implicit_type)
              (variable_declarator
                name: (identifier)
                (element_access_expression
                  expression: (identifier)
                  subscript: (bracketed_argument_list
                    (argument
                      (range_expression))))))))))))

================================================================================
cast expression
================================================================================

class Foo {
  void Test() {
    x = (int) y;
      }
}

--------------------------------------------------------------------------------

(compilation_unit
  (class_declaration
    name: (identifier)
    body: (declaration_list
      (method_declaration
        returns: (predefined_type)
        name: (identifier)
        parameters: (parameter_list)
        body: (block
          (expression_statement
            (assignment_expression
              left: (identifier)
              right: (cast_expression
                type: (predefined_type)
                value: (identifier)))))))))

================================================================================
Generic type name no type args
================================================================================

var d = typeof(Dictionary<,>);
var t = typeof(Tuple<,,,>);

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (typeof_expression
            type: (generic_name
              (identifier)
              (type_argument_list)))))))
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (typeof_expression
            type: (generic_name
              (identifier)
              (type_argument_list))))))))

================================================================================
default expression
================================================================================

var a = default(int);
int b = default;

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (default_expression
            type: (predefined_type))))))
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (predefined_type)
        (variable_declarator
          name: (identifier)
          (default_expression))))))

================================================================================
Ref local declaration and ref expression
================================================================================

ref VeryLargeStruct reflocal = ref veryLargeStruct;
ref var elementRef = ref arr[0];

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (ref_type
          type: (identifier))
        (variable_declarator
          name: (identifier)
          (ref_expression
            (identifier))))))
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (ref_type
          type: (implicit_type))
        (variable_declarator
          name: (identifier)
          (ref_expression
            (element_access_expression
              expression: (identifier)
              subscript: (bracketed_argument_list
                (argument
                  (integer_literal))))))))))

================================================================================
Element binding expression
================================================================================

var x = new Dictionary<string,int> { ["a"] = 65 };

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (object_creation_expression
            type: (generic_name
              (identifier)
              (type_argument_list
                (predefined_type)
                (predefined_type)))
            initializer: (initializer_expression
              (assignment_expression
                left: (element_binding_expression
                  (argument
                    (string_literal
                      (string_literal_content))))
                right: (integer_literal)))))))))

================================================================================
Member access expression (methods)
================================================================================

void Test(int value) {
  value.ToString();
  double.IsInfinity(value);
}

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_function_statement
      type: (predefined_type)
      name: (identifier)
      parameters: (parameter_list
        (parameter
          type: (predefined_type)
          name: (identifier)))
      body: (block
        (expression_statement
          (invocation_expression
            function: (member_access_expression
              expression: (identifier)
              name: (identifier))
            arguments: (argument_list)))
        (expression_statement
          (invocation_expression
            function: (member_access_expression
              expression: (predefined_type)
              name: (identifier))
            arguments: (argument_list
              (argument
                (identifier)))))))))

================================================================================
Member access expression (properties)
================================================================================

void Test(int value) {
  var x = string.Empty;
  var z = B<int>.Something;
}

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_function_statement
      type: (predefined_type)
      name: (identifier)
      parameters: (parameter_list
        (parameter
          type: (predefined_type)
          name: (identifier)))
      body: (block
        (local_declaration_statement
          (variable_declaration
            type: (implicit_type)
            (variable_declarator
              name: (identifier)
              (member_access_expression
                expression: (predefined_type)
                name: (identifier)))))
        (local_declaration_statement
          (variable_declaration
            type: (implicit_type)
            (variable_declarator
              name: (identifier)
              (member_access_expression
                expression: (generic_name
                  (identifier)
                  (type_argument_list
                    (predefined_type)))
                name: (identifier)))))))))

================================================================================
is expression
================================================================================

var b = s is string;

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (is_expression
            left: (identifier)
            right: (predefined_type)))))))

================================================================================
is pattern
================================================================================

var b = s is string s2;
var c = s is "test";
var a = 1 is int.MaxValue;
var d = a is nameof(a);
var e = a is (int)b;
var f = b is A { E: C(S.C) bb } ? bb : null;

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (is_pattern_expression
            expression: (identifier)
            pattern: (declaration_pattern
              type: (predefined_type)
              name: (identifier)))))))
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (is_pattern_expression
            expression: (identifier)
            pattern: (constant_pattern
              (string_literal
                (string_literal_content))))))))
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (is_pattern_expression
            expression: (integer_literal)
            pattern: (constant_pattern
              (member_access_expression
                expression: (predefined_type)
                name: (identifier))))))))
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (is_pattern_expression
            expression: (identifier)
            pattern: (constant_pattern
              (invocation_expression
                function: (identifier)
                arguments: (argument_list
                  (argument
                    (identifier))))))))))
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (is_pattern_expression
            expression: (identifier)
            pattern: (constant_pattern
              (cast_expression
                type: (predefined_type)
                value: (identifier))))))))
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (conditional_expression
            condition: (is_pattern_expression
              expression: (identifier)
              pattern: (recursive_pattern
                type: (identifier)
                (property_pattern_clause
                  (subpattern
                    (identifier)
                    (recursive_pattern
                      type: (identifier)
                      (positional_pattern_clause
                        (subpattern
                          (type_pattern
                            type: (qualified_name
                              qualifier: (identifier)
                              name: (identifier)))))
                      name: (identifier))))))
            consequence: (identifier)
            alternative: (null_literal)))))))

================================================================================
Precedence between is operator and conditional_expression
================================================================================

int a = 1 is Object ? 1 : 2;

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (predefined_type)
        (variable_declarator
          name: (identifier)
          (conditional_expression
            condition: (is_pattern_expression
              expression: (integer_literal)
              pattern: (constant_pattern
                (identifier)))
            consequence: (integer_literal)
            alternative: (integer_literal)))))))

================================================================================
Precedence between is operator and as operator
================================================================================

//var a = new object() is null as Object == false; // this parses with wrong precedence
var a = new object() is null as Object;
var b = true == 1 as int? is int;

--------------------------------------------------------------------------------

(compilation_unit
  (comment)
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (as_expression
            left: (is_pattern_expression
              expression: (object_creation_expression
                type: (predefined_type)
                arguments: (argument_list))
              pattern: (constant_pattern
                (null_literal)))
            right: (identifier))))))
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (binary_expression
            left: (boolean_literal)
            right: (is_expression
              left: (as_expression
                left: (integer_literal)
                right: (nullable_type
                  type: (predefined_type)))
              right: (predefined_type))))))))

================================================================================
Discard pattern
================================================================================

void Do() {
  DateTime.TryParse(dateString, out _);
}

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_function_statement
      type: (predefined_type)
      name: (identifier)
      parameters: (parameter_list)
      body: (block
        (expression_statement
          (invocation_expression
            function: (member_access_expression
              expression: (identifier)
              name: (identifier))
            arguments: (argument_list
              (argument
                (identifier))
              (argument
                (identifier)))))))))

================================================================================
Null-forgiving operator
================================================================================

var x = name!.Length;

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (member_access_expression
            expression: (postfix_unary_expression
              (identifier))
            name: (identifier)))))))

================================================================================
Negated pattern
================================================================================

var x = name is not null;
if (a is not B { E: C(S.E) x }) {}

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (is_pattern_expression
            expression: (identifier)
            pattern: (negated_pattern
              (constant_pattern
                (null_literal))))))))
  (global_statement
    (if_statement
      condition: (is_pattern_expression
        expression: (identifier)
        pattern: (negated_pattern
          (recursive_pattern
            type: (identifier)
            (property_pattern_clause
              (subpattern
                (identifier)
                (recursive_pattern
                  type: (identifier)
                  (positional_pattern_clause
                    (subpattern
                      (type_pattern
                        type: (qualified_name
                          qualifier: (identifier)
                          name: (identifier)))))
                  name: (identifier)))))))
      consequence: (block))))

================================================================================
Parenthesized pattern
================================================================================

var x = name is (var a);

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (is_pattern_expression
            expression: (identifier)
            pattern: (parenthesized_pattern
              (declaration_pattern
                type: (implicit_type)
                name: (identifier)))))))))

================================================================================
Pattern Combinators and relational pattern
================================================================================

var x = c is < '0' or >= 'A' and <= 'Z';

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (is_pattern_expression
            expression: (identifier)
            pattern: (or_pattern
              left: (relational_pattern
                (character_literal
                  (character_literal_content)))
              right: (and_pattern
                left: (relational_pattern
                  (character_literal
                    (character_literal_content)))
                right: (relational_pattern
                  (character_literal
                    (character_literal_content)))))))))))

================================================================================
Precedence of prefix_unary_expression and invocation_expression
================================================================================

var x = !this.Call();

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (prefix_unary_expression
            (invocation_expression
              function: (member_access_expression
                name: (identifier))
              arguments: (argument_list))))))))

================================================================================
Property patterns
================================================================================

var x = operand is ILiteralOperation { ConstantValue: { HasValue: true, Value: null } };
var x = operand is ILiteralOperation { ConstantValue.HasValue: true, ConstantValue.Value: null};

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (is_pattern_expression
            expression: (identifier)
            pattern: (recursive_pattern
              type: (identifier)
              (property_pattern_clause
                (subpattern
                  (identifier)
                  (recursive_pattern
                    (property_pattern_clause
                      (subpattern
                        (identifier)
                        (constant_pattern
                          (boolean_literal)))
                      (subpattern
                        (identifier)
                        (constant_pattern
                          (null_literal)))))))))))))
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (is_pattern_expression
            expression: (identifier)
            pattern: (recursive_pattern
              type: (identifier)
              (property_pattern_clause
                (subpattern
                  (member_access_expression
                    expression: (identifier)
                    name: (identifier))
                  (constant_pattern
                    (boolean_literal)))
                (subpattern
                  (member_access_expression
                    expression: (identifier)
                    name: (identifier))
                  (constant_pattern
                    (null_literal)))))))))))

================================================================================
Positional patterns
================================================================================

var a = p is var (x, y);
var c = p is (var x, var y) { x: 0 };

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (invocation_expression
            function: (is_expression
              left: (identifier)
              right: (implicit_type))
            arguments: (argument_list
              (argument
                (identifier))
              (argument
                (identifier))))))))
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (is_pattern_expression
            expression: (identifier)
            pattern: (recursive_pattern
              (positional_pattern_clause
                (subpattern
                  (declaration_pattern
                    type: (implicit_type)
                    name: (identifier)))
                (subpattern
                  (declaration_pattern
                    type: (implicit_type)
                    name: (identifier))))
              (property_pattern_clause
                (subpattern
                  (identifier)
                  (constant_pattern
                    (integer_literal)))))))))))

================================================================================
Recursive patterns with variable designation (issue #282)
================================================================================

var x = expr is R(E.A) v0;
var y = expr is R(E.A or E.B) v1;
var z = expr is (E.A or E.B) v2;

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (is_pattern_expression
            expression: (identifier)
            pattern: (recursive_pattern
              type: (identifier)
              (positional_pattern_clause
                (subpattern
                  (type_pattern
                    type: (qualified_name
                      qualifier: (identifier)
                      name: (identifier)))))
              name: (identifier)))))))
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (is_pattern_expression
            expression: (identifier)
            pattern: (recursive_pattern
              type: (identifier)
              (positional_pattern_clause
                (subpattern
                  (or_pattern
                    left: (type_pattern
                      type: (qualified_name
                        qualifier: (identifier)
                        name: (identifier)))
                    right: (constant_pattern
                      (member_access_expression
                        expression: (identifier)
                        name: (identifier))))))
              name: (identifier)))))))
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (is_pattern_expression
            expression: (identifier)
            pattern: (recursive_pattern
              (or_pattern
                left: (constant_pattern
                  (member_access_expression
                    expression: (identifier)
                    name: (identifier)))
                right: (constant_pattern
                  (member_access_expression
                    expression: (identifier)
                    name: (identifier))))
              name: (identifier))))))))

================================================================================
Type patterns
================================================================================

var b = o is int or string; //is_pattern_expression with type_pattern
var c = o is int; //is_expression with type

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (is_pattern_expression
            expression: (identifier)
            pattern: (or_pattern
              left: (type_pattern
                type: (predefined_type))
              right: (type_pattern
                type: (predefined_type))))))))
  (comment)
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (is_expression
            left: (identifier)
            right: (predefined_type))))))
  (comment))

================================================================================
List patterns
================================================================================

var a = p is [1,2,x,] and [] or [2,..];
if (aa is [(name: A.B), ..]) { }

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (is_pattern_expression
            expression: (identifier)
            pattern: (or_pattern
              left: (and_pattern
                left: (list_pattern
                  (constant_pattern
                    (integer_literal))
                  (constant_pattern
                    (integer_literal))
                  (constant_pattern
                    (identifier)))
                right: (list_pattern))
              right: (list_pattern
                (constant_pattern
                  (integer_literal)))))))))
  (global_statement
    (if_statement
      condition: (is_pattern_expression
        expression: (identifier)
        pattern: (list_pattern
          (recursive_pattern
            (positional_pattern_clause
              (subpattern
                (identifier)
                (constant_pattern
                  (member_access_expression
                    expression: (identifier)
                    name: (identifier))))))))
      consequence: (block))))

================================================================================
Conditional expression with member accesses
================================================================================

var a = b ? c.A + d.A : e.A + f.A;

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (conditional_expression
            condition: (identifier)
            consequence: (binary_expression
              left: (member_access_expression
                expression: (identifier)
                name: (identifier))
              right: (member_access_expression
                expression: (identifier)
                name: (identifier)))
            alternative: (binary_expression
              left: (member_access_expression
                expression: (identifier)
                name: (identifier))
              right: (member_access_expression
                expression: (identifier)
                name: (identifier)))))))))

================================================================================
Conditional access expression
================================================================================

var a = b?.Something;

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (conditional_access_expression
            condition: (identifier)
            (member_binding_expression
              name: (identifier))))))))

================================================================================
Conditional access to element (should be implicit_element_access)
================================================================================

var x = dict?["a"];

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (conditional_access_expression
            condition: (identifier)
            (element_binding_expression
              (argument
                (string_literal
                  (string_literal_content))))))))))

================================================================================
Conditional access expression with member binding
================================================================================

if (a?.B != 1) { }

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (if_statement
      condition: (binary_expression
        left: (conditional_access_expression
          condition: (identifier)
          (member_binding_expression
            name: (identifier)))
        right: (integer_literal))
      consequence: (block))))

================================================================================
Conditional access expression with simple member access
================================================================================

if ((p as Person[])?[0]._Age != 1) { }

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (if_statement
      condition: (binary_expression
        left: (member_access_expression
          expression: (conditional_access_expression
            condition: (parenthesized_expression
              (as_expression
                left: (identifier)
                right: (array_type
                  type: (identifier)
                  rank: (array_rank_specifier))))
            (element_binding_expression
              (argument
                (integer_literal))))
          name: (identifier))
        right: (integer_literal))
      consequence: (block))))

================================================================================
Null-coalescing operator is right-associative
================================================================================

var a = b ?? c ?? d;

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (binary_expression
            left: (identifier)
            right: (binary_expression
              left: (identifier)
              right: (identifier))))))))

================================================================================
Precedence between null-coalescing operator and conditional OR
================================================================================

var a = b ?? c || d ?? e;

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (binary_expression
            left: (identifier)
            right: (binary_expression
              left: (binary_expression
                left: (identifier)
                right: (identifier))
              right: (identifier))))))))

================================================================================
Precedence between null-coalescing operator and conditional operator
================================================================================

var a = b ?? c ? d ?? e : f ?? g;

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (conditional_expression
            condition: (binary_expression
              left: (identifier)
              right: (identifier))
            consequence: (binary_expression
              left: (identifier)
              right: (identifier))
            alternative: (binary_expression
              left: (identifier)
              right: (identifier))))))))

================================================================================
Precedence between range and switch
================================================================================

var a = 3..4 switch
{
    _ => true
};

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (switch_expression
            (range_expression
              (integer_literal)
              (integer_literal))
            (switch_expression_arm
              (discard)
              (boolean_literal))))))))

================================================================================
Precedence between unary and switch
================================================================================

var a = -3 switch
{
    _ => true
};

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (switch_expression
            (prefix_unary_expression
              (integer_literal))
            (switch_expression_arm
              (discard)
              (boolean_literal))))))))

================================================================================
Precedence between range and as operator
================================================================================

var a = 3..4 as Range;

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (as_expression
            left: (range_expression
              (integer_literal)
              (integer_literal))
            right: (identifier)))))))

================================================================================
Precedence between is and comparison operators
================================================================================

var allowedValuesList = someObj is null
    ? default
    : new object();

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (conditional_expression
            condition: (is_pattern_expression
              expression: (identifier)
              pattern: (constant_pattern
                (null_literal)))
            consequence: (default_expression)
            alternative: (object_creation_expression
              type: (predefined_type)
              arguments: (argument_list))))))))

================================================================================
Nameof expressions
================================================================================

var x = nameof(A);
var x = nameof(A<B>);
var x = nameof(A.B);

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (invocation_expression
            function: (identifier)
            arguments: (argument_list
              (argument
                (identifier))))))))
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (invocation_expression
            function: (identifier)
            arguments: (argument_list
              (argument
                (generic_name
                  (identifier)
                  (type_argument_list
                    (identifier))))))))))
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (invocation_expression
            function: (identifier)
            arguments: (argument_list
              (argument
                (member_access_expression
                  expression: (identifier)
                  name: (identifier))))))))))

================================================================================
Generic invocation expression
================================================================================

MyFunction<A,B>(1);

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (expression_statement
      (invocation_expression
        function: (generic_name
          (identifier)
          (type_argument_list
            (identifier)
            (identifier)))
        arguments: (argument_list
          (argument
            (integer_literal)))))))

================================================================================
Dereference versus logical and
================================================================================

bool c = (a) && b;

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (predefined_type)
        (variable_declarator
          name: (identifier)
          (cast_expression
            type: (identifier)
            value: (prefix_unary_expression
              (prefix_unary_expression
                (identifier)))))))))

================================================================================
With expression typical basic form
================================================================================

void A() {
  var newFriend = friend with { LastName = "Edwards" };
}

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_function_statement
      type: (predefined_type)
      name: (identifier)
      parameters: (parameter_list)
      body: (block
        (local_declaration_statement
          (variable_declaration
            type: (implicit_type)
            (variable_declarator
              name: (identifier)
              (with_expression
                (identifier)
                (with_initializer
                  (identifier)
                  (string_literal
                    (string_literal_content)))))))))))

================================================================================
With expression using expressions
================================================================================

void A() {
  var friend = GetAFriend() with {
      ForeName = RandomFirstName(),
      LastName = RandomLastName()
  };
}

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_function_statement
      type: (predefined_type)
      name: (identifier)
      parameters: (parameter_list)
      body: (block
        (local_declaration_statement
          (variable_declaration
            type: (implicit_type)
            (variable_declarator
              name: (identifier)
              (with_expression
                (invocation_expression
                  function: (identifier)
                  arguments: (argument_list))
                (with_initializer
                  (identifier)
                  (invocation_expression
                    function: (identifier)
                    arguments: (argument_list)))
                (with_initializer
                  (identifier)
                  (invocation_expression
                    function: (identifier)
                    arguments: (argument_list)))))))))))

================================================================================
Precedence between with and cast
================================================================================

var x = (Point) p1 with {X = 3};

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (with_expression
            (cast_expression
              type: (identifier)
              value: (identifier))
            (with_initializer
              (identifier)
              (integer_literal))))))))

================================================================================
Precedence between with and switch
================================================================================

var x = p1 with {X = 3} switch { _ => 3 };

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (switch_expression
            (with_expression
              (identifier)
              (with_initializer
                (identifier)
                (integer_literal)))
            (switch_expression_arm
              (discard)
              (integer_literal))))))))

================================================================================
Precedence between with and equals
================================================================================

var x = p1 with {X = 3} == p1 with {X = 4};

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (binary_expression
            left: (with_expression
              (identifier)
              (with_initializer
                (identifier)
                (integer_literal)))
            right: (with_expression
              (identifier)
              (with_initializer
                (identifier)
                (integer_literal)))))))))

================================================================================
Associativity of with expression
================================================================================

var x = p1 with {X = 3} with {X = 4} with {X = 5};

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (with_expression
            (with_expression
              (with_expression
                (identifier)
                (with_initializer
                  (identifier)
                  (integer_literal)))
              (with_initializer
                (identifier)
                (integer_literal)))
            (with_initializer
              (identifier)
              (integer_literal))))))))

================================================================================
Array with trailing comma
================================================================================

var x = [ y, ];

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_declaration_statement
      (variable_declaration
        (implicit_type)
        (variable_declarator
          (identifier)
          (collection_expression
            (collection_element
              (expression_element
                (identifier)))))))))

================================================================================
Empty collection expression
================================================================================

var empty = [];

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (collection_expression))))))

================================================================================
Collection expression with elements
================================================================================

var numbers = [1, 2, 3];

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (collection_expression
            (collection_element
              (expression_element
                (integer_literal)))
            (collection_element
              (expression_element
                (integer_literal)))
            (collection_element
              (expression_element
                (integer_literal)))))))))

================================================================================
Collection expression with spreads
================================================================================

var combined = [..first, ..second];

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (collection_expression
            (collection_element
              (spread_element
                (identifier)))
            (collection_element
              (spread_element
                (identifier)))))))))

================================================================================
Mixed elements with trailing comma
================================================================================

var mixed = [1, ..others, 2,];

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (collection_expression
            (collection_element
              (expression_element
                (integer_literal)))
            (collection_element
              (spread_element
                (identifier)))
            (collection_element
              (expression_element
                (integer_literal)))))))))

================================================================================
Nested collection expressions
================================================================================

var nested = [[1], [2]];

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (collection_expression
            (collection_element
              (expression_element
                (collection_expression
                  (collection_element
                    (expression_element
                      (integer_literal))))))
            (collection_element
              (expression_element
                (collection_expression
                  (collection_element
                    (expression_element
                      (integer_literal))))))))))))

================================================================================
Collection expression in argument
================================================================================

SomeMethod([1, 2]);

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (expression_statement
      (invocation_expression
        function: (identifier)
        arguments: (argument_list
          (argument
            (collection_expression
              (collection_element
                (expression_element
                  (integer_literal)))
              (collection_element
                (expression_element
                  (integer_literal))))))))))

================================================================================
Empty collection expression in argument
================================================================================

SomeMethod([]);

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (expression_statement
      (invocation_expression
        function: (identifier)
        arguments: (argument_list
          (argument
            (collection_expression)))))))

================================================================================
Collection expression in coalescing expression
================================================================================

var fallback = items ?? [];

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (binary_expression
            left: (identifier)
            right: (collection_expression)))))))

================================================================================
Collection expression - nested
================================================================================

int[][] x = [[1, 2], [3, 4]];

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_declaration_statement
      (variable_declaration
        (array_type
          (array_type
            (predefined_type)
            (array_rank_specifier))
          (array_rank_specifier))
        (variable_declarator
          (identifier)
          (collection_expression
            (collection_element
              (expression_element
                (collection_expression
                  (collection_element
                    (expression_element
                      (integer_literal)))
                  (collection_element
                    (expression_element
                      (integer_literal))))))
            (collection_element
              (expression_element
                (collection_expression
                  (collection_element
                    (expression_element
                      (integer_literal)))
                  (collection_element
                    (expression_element
                      (integer_literal))))))))))))

================================================================================
Collection expression - cast with qualified member access
================================================================================

class C {
    void M() {
        foreach (var id in (int[])[
            Constants.Region.US,
            Constants.Region.EU,
            Constants.Region.AP,
        ])
        {
            Invalidate(key, id);
        }
    }
}

--------------------------------------------------------------------------------

(compilation_unit
  (class_declaration
    name: (identifier)
    body: (declaration_list
      (method_declaration
        returns: (predefined_type)
        name: (identifier)
        parameters: (parameter_list)
        body: (block
          (foreach_statement
            type: (implicit_type)
            left: (identifier)
            right: (cast_expression
              type: (array_type
                type: (predefined_type)
                rank: (array_rank_specifier))
              value: (collection_expression
                (collection_element
                  (expression_element
                    (member_access_expression
                      expression: (member_access_expression
                        expression: (identifier)
                        name: (identifier))
                      name: (identifier))))
                (collection_element
                  (expression_element
                    (member_access_expression
                      expression: (member_access_expression
                        expression: (identifier)
                        name: (identifier))
                      name: (identifier))))
                (collection_element
                  (expression_element
                    (member_access_expression
                      expression: (member_access_expression
                        expression: (identifier)
                        name: (identifier))
                      name: (identifier))))))
            body: (block
              (expression_statement
                (invocation_expression
                  function: (identifier)
                  arguments: (argument_list
                    (argument
                      (identifier))
                    (argument
                      (identifier))))))))))))
