================================================================================
const expression
================================================================================

do 4

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

(file
  (declaration_expression
    (do
      (const
        (int)))))

================================================================================
const 2 sequence expression
================================================================================

do 4 3

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

(file
  (declaration_expression
    (do
      (application_expression
        (const
          (int))
        (const
          (int))))))

================================================================================
const 3 application expression
================================================================================

do 4 3 3

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

(file
  (declaration_expression
    (do
      (application_expression
        (application_expression
          (const
            (int))
          (const
            (int)))
        (const
          (int))))))

================================================================================
const identifier expression
================================================================================

do test

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

(file
  (declaration_expression
    (do
      (long_identifier_or_op
        (long_identifier
          (identifier))))))

================================================================================
const begin/end expression
================================================================================

do begin test end

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

(file
  (declaration_expression
    (do
      (begin_end_expression
        (long_identifier_or_op
          (identifier))))))

================================================================================
const begin/end sequence expression
================================================================================

do begin 2 1 end

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

(file
  (declaration_expression
    (do
      (begin_end_expression
        (application_expression
          (const
            (int))
          (const
            (int)))))))

================================================================================
null expression
================================================================================

do null

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

(file
  (declaration_expression
    (do)))

================================================================================
unit expression
================================================================================

do ()

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

(file
  (declaration_expression
    (do
      (const
        (unit)))))

================================================================================
empty typed expression
================================================================================

do
  Array.empty<>

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

(file
  (declaration_expression
    (do
      (typed_expression
        (long_identifier_or_op
          (long_identifier
            (identifier)
            (identifier)))))))

================================================================================
typed expression
================================================================================

do
  Array.empty<int>

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

(file
  (declaration_expression
    (do
      (typed_expression
        (long_identifier_or_op
          (long_identifier
            (identifier)
            (identifier)))
        (types
          (simple_type
            (long_identifier
              (identifier))))))))

================================================================================
paren expression
================================================================================

do (4)

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

(file
  (declaration_expression
    (do
      (paren_expression
        (const
          (int))))))

================================================================================
sequential expression in paren expression
================================================================================

do
  (4
   3)

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

(file
  (declaration_expression
    (do
      (paren_expression
        (sequential_expression
          (const
            (int))
          (const
            (int)))))))

================================================================================
let decl in paren expression
================================================================================

do
  (let f = id
   4)

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

(file
  (declaration_expression
    (do
      (paren_expression
        (declaration_expression
          (function_or_value_defn
            (value_declaration_left
              (identifier_pattern
                (long_identifier_or_op
                  (identifier))))
            (long_identifier_or_op
              (identifier)))
          (const
            (int)))))))

================================================================================
paren expression in application expression
================================================================================

do test (4)

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

(file
  (declaration_expression
    (do
      (application_expression
        (long_identifier_or_op
          (identifier))
        (paren_expression
          (const
            (int)))))))

================================================================================
application expression aligned to first line
================================================================================

do
  (+) 1
      2

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

(file
  (declaration_expression
    (do
      (application_expression
        (application_expression
          (long_identifier_or_op
            (op_identifier))
          (const
            (int)))
        (const
          (int))))))

================================================================================
dot expression
================================================================================

do (A[1]).B

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

(file
  (declaration_expression
    (do
      (dot_expression
        (paren_expression
          (application_expression
            (long_identifier_or_op
              (identifier))
            (list_expression
              (const
                (int)))))
        (long_identifier_or_op
          (long_identifier
            (identifier)))))))

================================================================================
index dot expression
================================================================================

do test.[test]

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

(file
  (declaration_expression
    (do
      (index_expression
        (long_identifier_or_op
          (identifier))
        (long_identifier_or_op
          (identifier))))))

================================================================================
index expression
================================================================================

do test[test]

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

(file
  (declaration_expression
    (do
      (application_expression
        (long_identifier_or_op
          (identifier))
        (list_expression
          (long_identifier_or_op
            (identifier)))))))

================================================================================
mutate expression
================================================================================

do test <- 2

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

(file
  (declaration_expression
    (do
      (mutate_expression
        (long_identifier_or_op
          (identifier))
        (const
          (int))))))

================================================================================
chain mutate expression
================================================================================

do test <- other <- 4

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

(file
  (declaration_expression
    (do
      (mutate_expression
        (long_identifier_or_op
          (identifier))
        (mutate_expression
          (long_identifier_or_op
            (identifier))
          (const
            (int)))))))

================================================================================
upcast expression
================================================================================

do upcast 2

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

(file
  (declaration_expression
    (do
      (prefixed_expression
        (const
          (int))))))

================================================================================
downcast expression
================================================================================

do downcast 2

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

(file
  (declaration_expression
    (do
      (prefixed_expression
        (const
          (int))))))

================================================================================
typecast expressions
================================================================================

do
  x :> int

  x
  :> int

  x :?> int

  x
  :?> int

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

(file
  (declaration_expression
    (do
      (sequential_expression
        (typecast_expression
          (long_identifier_or_op
            (identifier))
          (simple_type
            (long_identifier
              (identifier))))
        (sequential_expression
          (typecast_expression
            (long_identifier_or_op
              (identifier))
            (simple_type
              (long_identifier
                (identifier))))
          (sequential_expression
            (typecast_expression
              (long_identifier_or_op
                (identifier))
              (simple_type
                (long_identifier
                  (identifier))))
            (typecast_expression
              (long_identifier_or_op
                (identifier))
              (simple_type
                (long_identifier
                  (identifier))))))))))

================================================================================
comma separated expressions
================================================================================

do 2, 3, 4

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

(file
  (declaration_expression
    (do
      (tuple_expression
        (const
          (int))
        (tuple_expression
          (const
            (int))
          (const
            (int)))))))

================================================================================
list expressions
================================================================================

do [2; 3; 4]

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

(file
  (declaration_expression
    (do
      (list_expression
        (const
          (int))
        (const
          (int))
        (const
          (int))))))

================================================================================
list expression with trailing semicolon
================================================================================

do [2; 3; 4;]

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

(file
  (declaration_expression
    (do
      (list_expression
        (const
          (int))
        (const
          (int))
        (const
          (int))))))

================================================================================
array expression with trailing semicolon
================================================================================

do [|2; 3; 4;|]

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

(file
  (declaration_expression
    (do
      (array_expression
        (const
          (int))
        (const
          (int))
        (const
          (int))))))

================================================================================
index list expressions
================================================================================

do [2; 3; 4][1]

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

(file
  (declaration_expression
    (do
      (application_expression
        (list_expression
          (const
            (int))
          (const
            (int))
          (const
            (int)))
        (list_expression
          (const
            (int)))))))

================================================================================
index single list expressions
================================================================================

do [2][1]

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

(file
  (declaration_expression
    (do
      (application_expression
        (list_expression
          (const
            (int)))
        (list_expression
          (const
            (int)))))))

================================================================================
two single list expressions
================================================================================

do [2] [1]

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

(file
  (declaration_expression
    (do
      (application_expression
        (list_expression
          (const
            (int)))
        (list_expression
          (const
            (int)))))))

================================================================================
array expressions
================================================================================

do [|2; 3; 4|]

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

(file
  (declaration_expression
    (do
      (array_expression
        (const
          (int))
        (const
          (int))
        (const
          (int))))))

================================================================================
array list expressions
================================================================================

do [|2; 3; 4|][1]

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

(file
  (declaration_expression
    (do
      (application_expression
        (array_expression
          (const
            (int))
          (const
            (int))
          (const
            (int)))
        (list_expression
          (const
            (int)))))))

================================================================================
array single list expressions
================================================================================

do [|2|][1]

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

(file
  (declaration_expression
    (do
      (application_expression
        (array_expression
          (const
            (int)))
        (list_expression
          (const
            (int)))))))

================================================================================
two single array expressions
================================================================================

do [|2|] [|1|]

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

(file
  (declaration_expression
    (do
      (application_expression
        (array_expression
          (const
            (int)))
        (array_expression
          (const
            (int)))))))

================================================================================
function-align expressions
================================================================================

do
  let name x = 4
  5

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

(file
  (declaration_expression
    (do
      (declaration_expression
        (function_or_value_defn
          (function_declaration_left
            (identifier)
            (argument_patterns
              (long_identifier
                (identifier))))
          (const
            (int)))
        (const
          (int))))))

================================================================================
function-align expressions 2
================================================================================

do
  let name x =
    4
  5

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

(file
  (declaration_expression
    (do
      (declaration_expression
        (function_or_value_defn
          (function_declaration_left
            (identifier)
            (argument_patterns
              (long_identifier
                (identifier))))
          (const
            (int)))
        (const
          (int))))))

================================================================================
function-align expressions 3
================================================================================

do
  let name x =
    1
    2
  5

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

(file
  (declaration_expression
    (do
      (declaration_expression
        (function_or_value_defn
          (function_declaration_left
            (identifier)
            (argument_patterns
              (long_identifier
                (identifier))))
          (sequential_expression
            (const
              (int))
            (const
              (int))))
        (const
          (int))))))

================================================================================
Parenthesised expressions 1
================================================================================

module T
let x a = (a)
let y = Choice1Of2 ("hi")
let z = ()

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

(file
  (named_module
    (long_identifier
      (identifier))
    (declaration_expression
      (function_or_value_defn
        (function_declaration_left
          (identifier)
          (argument_patterns
            (long_identifier
              (identifier))))
        (paren_expression
          (long_identifier_or_op
            (identifier)))))
    (declaration_expression
      (function_or_value_defn
        (value_declaration_left
          (identifier_pattern
            (long_identifier_or_op
              (identifier))))
        (application_expression
          (long_identifier_or_op
            (identifier))
          (paren_expression
            (const
              (string))))))
    (declaration_expression
      (function_or_value_defn
        (value_declaration_left
          (identifier_pattern
            (long_identifier_or_op
              (identifier))))
        (const
          (unit))))))

================================================================================
pipe expression 1
================================================================================

do
  1 |> id

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

(file
  (declaration_expression
    (do
      (infix_expression
        (const
          (int))
        (infix_op)
        (long_identifier_or_op
          (long_identifier
            (identifier)))))))

================================================================================
pipe expression 2
================================================================================

do
  1
  |> id

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

(file
  (declaration_expression
    (do
      (infix_expression
        (const
          (int))
        (infix_op)
        (long_identifier_or_op
          (long_identifier
            (identifier)))))))

================================================================================
pipe expression 3
================================================================================

do
  fun x ->
    x
  |> id

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

(file
  (declaration_expression
    (do
      (fun_expression
        (argument_patterns
          (long_identifier
            (identifier)))
        (infix_expression
          (long_identifier_or_op
            (identifier))
          (infix_op)
          (long_identifier_or_op
            (long_identifier
              (identifier))))))))

================================================================================
pipe expression 4
================================================================================

do
  A.x
  |> B.y C.z

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

(file
  (declaration_expression
    (do
      (application_expression
        (infix_expression
          (long_identifier_or_op
            (long_identifier
              (identifier)
              (identifier)))
          (infix_op)
          (long_identifier_or_op
            (long_identifier
              (identifier)
              (identifier))))
        (long_identifier_or_op
          (long_identifier
            (identifier)
            (identifier)))))))

================================================================================
ce expression 1
================================================================================

do
  seq { "*.fs" }

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

(file
  (declaration_expression
    (do
      (ce_expression
        (long_identifier_or_op
          (identifier))
        (const
          (string))))))

================================================================================
ce expression 2
================================================================================

do
  async {
    do! Async.sleep 5
    return ()
  }

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

(file
  (declaration_expression
    (do
      (ce_expression
        (long_identifier_or_op
          (identifier))
        (sequential_expression
          (do_expression
            (application_expression
              (long_identifier_or_op
                (long_identifier
                  (identifier)
                  (identifier)))
              (const
                (int))))
          (prefixed_expression
            (const
              (unit))))))))

================================================================================
ce expression 3
================================================================================

let f = async {
    do! Async.sleep 5
    return ()
  }

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (ce_expression
        (long_identifier_or_op
          (identifier))
        (sequential_expression
          (do_expression
            (application_expression
              (long_identifier_or_op
                (long_identifier
                  (identifier)
                  (identifier)))
              (const
                (int))))
          (prefixed_expression
            (const
              (unit))))))))

================================================================================
ce expression 4
================================================================================

let f = async {
          do! Async.sleep 5
          return ()
        }

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (ce_expression
        (long_identifier_or_op
          (identifier))
        (sequential_expression
          (do_expression
            (application_expression
              (long_identifier_or_op
                (long_identifier
                  (identifier)
                  (identifier)))
              (const
                (int))))
          (prefixed_expression
            (const
              (unit))))))))

================================================================================
call function from list of functions
================================================================================

let x =
  let fs = [id]
  fs[0] 0

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (declaration_expression
        (function_or_value_defn
          (value_declaration_left
            (identifier_pattern
              (long_identifier_or_op
                (identifier))))
          (list_expression
            (long_identifier_or_op
              (identifier))))
        (application_expression
          (application_expression
            (long_identifier_or_op
              (identifier))
            (list_expression
              (const
                (int))))
          (const
            (int)))))))

================================================================================
index list with value declaration
================================================================================

let x =
  let ys = [1;2]
  ys[
    let x = 1
    x
  ]

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (declaration_expression
        (function_or_value_defn
          (value_declaration_left
            (identifier_pattern
              (long_identifier_or_op
                (identifier))))
          (list_expression
            (const
              (int))
            (const
              (int))))
        (application_expression
          (long_identifier_or_op
            (identifier))
          (list_expression
            (declaration_expression
              (function_or_value_defn
                (value_declaration_left
                  (identifier_pattern
                    (long_identifier_or_op
                      (identifier))))
                (const
                  (int)))
              (long_identifier_or_op
                (identifier)))))))))

================================================================================
apply value declaration to function
================================================================================

let x =
  id
   (let x = 1
    x)

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (application_expression
        (long_identifier_or_op
          (identifier))
        (paren_expression
          (declaration_expression
            (function_or_value_defn
              (value_declaration_left
                (identifier_pattern
                  (long_identifier_or_op
                    (identifier))))
              (const
                (int)))
            (long_identifier_or_op
              (identifier))))))))

================================================================================
apply value to function declaration
================================================================================

let x =
  (let f = id
   id) 4

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (application_expression
        (paren_expression
          (declaration_expression
            (function_or_value_defn
              (value_declaration_left
                (identifier_pattern
                  (long_identifier_or_op
                    (identifier))))
              (long_identifier_or_op
                (identifier)))
            (long_identifier_or_op
              (identifier))))
        (const
          (int))))))

================================================================================
if-then-else expression 1
================================================================================

do
  if true
    then 1
    else 2

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

(file
  (declaration_expression
    (do
      (if_expression
        (const
          (bool))
        (const
          (int))
        (const
          (int))))))

================================================================================
if-then-else expression 2
================================================================================

do
  if true then 1 else 2

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

(file
  (declaration_expression
    (do
      (if_expression
        (const
          (bool))
        (const
          (int))
        (const
          (int))))))

================================================================================
if-then-else expression
================================================================================

do
  if true then
    1
  else
    2

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

(file
  (declaration_expression
    (do
      (if_expression
        (const
          (bool))
        (const
          (int))
        (const
          (int))))))

================================================================================
if-then expression 1
================================================================================

do
  if true then
    1

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

(file
  (declaration_expression
    (do
      (if_expression
        (const
          (bool))
        (const
          (int))))))

================================================================================
if-then expression 2
================================================================================

do
  if true then 1

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

(file
  (declaration_expression
    (do
      (if_expression
        (const
          (bool))
        (const
          (int))))))

================================================================================
nested if-then expression 1
================================================================================

do
  if true then
    if true then
      1

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

(file
  (declaration_expression
    (do
      (if_expression
        (const
          (bool))
        (if_expression
          (const
            (bool))
          (const
            (int)))))))

================================================================================
nested if-then expression 2
================================================================================

do
  if true then
    if true then 1

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

(file
  (declaration_expression
    (do
      (if_expression
        (const
          (bool))
        (if_expression
          (const
            (bool))
          (const
            (int)))))))

================================================================================
if-then-else expression 3
================================================================================

do
  if true
  then
    1
  else
    2

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

(file
  (declaration_expression
    (do
      (if_expression
        (const
          (bool))
        (const
          (int))
        (const
          (int))))))

================================================================================
nested if-then-elif-else expression 1
================================================================================

do
  if true then
    if true then
      1
    elif true then
      2
    else
      3
  else
    4

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

(file
  (declaration_expression
    (do
      (if_expression
        (const
          (bool))
        (if_expression
          (const
            (bool))
          (const
            (int))
          (elif_expression
            (const
              (bool))
            (const
              (int)))
          (const
            (int)))
        (const
          (int))))))

================================================================================
if-expression with multiline guard
================================================================================

let x =
  if b then ()
  else if
      // comment
      true
  then
      ()

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (if_expression
        (long_identifier_or_op
          (identifier))
        (const
          (unit))
        (elif_expression
          (line_comment)
          (const
            (bool))
          (const
            (unit)))))))

================================================================================
if-then-else expression with nested if
================================================================================

do
  if b then
    if b then
      ()
  else
      ()

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

(file
  (declaration_expression
    (do
      (if_expression
        (long_identifier_or_op
          (identifier))
        (if_expression
          (long_identifier_or_op
            (identifier))
          (const
            (unit)))
        (const
          (unit))))))

================================================================================
cursed nested if-then-else expression with nested if in else-branch
================================================================================

do
  if b then
    ()
  else if
    b
  then
    ()
  else
    ()

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

(file
  (declaration_expression
    (do
      (if_expression
        (long_identifier_or_op
          (identifier))
        (const
          (unit))
        (elif_expression
          (long_identifier_or_op
            (identifier))
          (const
            (unit)))
        (const
          (unit))))))

================================================================================
if-then-elif-else expression with nested if
================================================================================

do
  if b then
    ()
  elif b then
    if b then
      ()
  else
      ()

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

(file
  (declaration_expression
    (do
      (if_expression
        (long_identifier_or_op
          (identifier))
        (const
          (unit))
        (elif_expression
          (long_identifier_or_op
            (identifier))
          (if_expression
            (long_identifier_or_op
              (identifier))
            (const
              (unit))))
        (const
          (unit))))))

================================================================================
anonymous function expression
================================================================================

let exampleNamespace =
    (fun (n,v) -> if n = "namespace" then Some (v :?> string) else None )

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (paren_expression
        (fun_expression
          (argument_patterns
            (repeat_pattern
              (identifier_pattern
                (long_identifier_or_op
                  (identifier)))
              (identifier_pattern
                (long_identifier_or_op
                  (identifier)))))
          (if_expression
            (infix_expression
              (long_identifier_or_op
                (identifier))
              (infix_op)
              (const
                (string)))
            (application_expression
              (long_identifier_or_op
                (identifier))
              (paren_expression
                (typecast_expression
                  (long_identifier_or_op
                    (identifier))
                  (simple_type
                    (long_identifier
                      (identifier))))))
            (long_identifier_or_op
              (identifier))))))))

================================================================================
record update expression
================================================================================

do
  { A with
      Pattern = []
      Expr = B }

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

(file
  (declaration_expression
    (do
      (brace_expression
        (with_field_expression
          (long_identifier_or_op
            (identifier))
          (field_initializers
            (field_initializer
              (long_identifier
                (identifier))
              (list_expression))
            (field_initializer
              (long_identifier
                (identifier))
              (long_identifier_or_op
                (identifier)))))))))

================================================================================
nested record expression
================================================================================

do
  { A = { B = 0
          C = 1 }
    D = 2 }

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

(file
  (declaration_expression
    (do
      (brace_expression
        (field_initializers
          (field_initializer
            (long_identifier
              (identifier))
            (brace_expression
              (field_initializers
                (field_initializer
                  (long_identifier
                    (identifier))
                  (const
                    (int)))
                (field_initializer
                  (long_identifier
                    (identifier))
                  (const
                    (int))))))
          (field_initializer
            (long_identifier
              (identifier))
            (const
              (int))))))))

================================================================================
SeqBlock with line comment
================================================================================

let x =
  let y = 5
  // comment
  y + 1

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (declaration_expression
        (function_or_value_defn
          (value_declaration_left
            (identifier_pattern
              (long_identifier_or_op
                (identifier))))
          (const
            (int))
          (line_comment))
        (infix_expression
          (long_identifier_or_op
            (identifier))
          (infix_op)
          (const
            (int)))))))

================================================================================
SeqBlock with line comment outdented
================================================================================

let x =
  let y = 5
// comment
  y + 1

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (declaration_expression
        (function_or_value_defn
          (value_declaration_left
            (identifier_pattern
              (long_identifier_or_op
                (identifier))))
          (const
            (int))
          (line_comment))
        (infix_expression
          (long_identifier_or_op
            (identifier))
          (infix_op)
          (const
            (int)))))))

================================================================================
SeqBlock with multi-line comment
================================================================================

let x =
  let y = 5
  (*
   * comment
   *)
  y + 1

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (declaration_expression
        (function_or_value_defn
          (value_declaration_left
            (identifier_pattern
              (long_identifier_or_op
                (identifier))))
          (const
            (int)))
        (block_comment
          (block_comment_content))
        (infix_expression
          (long_identifier_or_op
            (identifier))
          (infix_op)
          (const
            (int)))))))

================================================================================
simple for-in-do loop
================================================================================

let x =
  for i in ids do
    ignore i

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (for_expression
        (identifier_pattern
          (long_identifier_or_op
            (identifier)))
        (long_identifier_or_op
          (identifier))
        (application_expression
          (long_identifier_or_op
            (identifier))
          (long_identifier_or_op
            (long_identifier
              (identifier))))))))

================================================================================
simple for-to loop
================================================================================

let x =
  for i = 1 to 10 do
    ignore i

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (for_expression
        (identifier)
        (const
          (int))
        (const
          (int))
        (application_expression
          (long_identifier_or_op
            (identifier))
          (long_identifier_or_op
            (long_identifier
              (identifier))))))))

================================================================================
simple for-downto loop
================================================================================

let x =
  for i = 1 downto 10 do
    ignore i

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (for_expression
        (identifier)
        (const
          (int))
        (const
          (int))
        (application_expression
          (long_identifier_or_op
            (identifier))
          (long_identifier_or_op
            (long_identifier
              (identifier))))))))

================================================================================
application-expression in sequence expression
================================================================================

let test =
  id 1
  ()

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (sequential_expression
        (application_expression
          (long_identifier_or_op
            (identifier))
          (const
            (int)))
        (const
          (unit))))))

================================================================================
application-expression followed by dot-expression
================================================================================

let test f =
  if true then
    f a
  someDictionary.Add(vkey, "foo")

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

(file
  (declaration_expression
    (function_or_value_defn
      (function_declaration_left
        (identifier)
        (argument_patterns
          (long_identifier
            (identifier))))
      (sequential_expression
        (if_expression
          (const
            (bool))
          (application_expression
            (long_identifier_or_op
              (identifier))
            (long_identifier_or_op
              (identifier))))
        (application_expression
          (long_identifier_or_op
            (long_identifier
              (identifier)
              (identifier)))
          (tuple_expression
            (long_identifier_or_op
              (identifier))
            (const
              (string))))))))

================================================================================
if-expression in sequence expression
================================================================================

let test =
  if true then
    2
  1

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (sequential_expression
        (if_expression
          (const
            (bool))
          (const
            (int)))
        (const
          (int))))))

================================================================================
nested if-expressions with sequential_expression in body
================================================================================

do
  if true then
    if true then
      1
      2
    else
      1
      2
  else
    1
    2

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

(file
  (declaration_expression
    (do
      (if_expression
        (const
          (bool))
        (if_expression
          (const
            (bool))
          (sequential_expression
            (const
              (int))
            (const
              (int)))
          (sequential_expression
            (const
              (int))
            (const
              (int))))
        (sequential_expression
          (const
            (int))
          (const
            (int)))))))

================================================================================
try-with expression 1
================================================================================

let test =
  try
    ()
  with e -> ()

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (try_expression
        (const
          (unit))
        (rules
          (rule
            (identifier_pattern
              (long_identifier_or_op
                (identifier)))
            (const
              (unit))))))))

================================================================================
try-with expression 2
================================================================================

let test =
  try
    ()
  with e ->
    ()

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (try_expression
        (const
          (unit))
        (rules
          (rule
            (identifier_pattern
              (long_identifier_or_op
                (identifier)))
            (const
              (unit))))))))

================================================================================
try-with expression with multiple clauses
================================================================================

let test =
  try
    ()
  with
  | :? System.IO.Exception -> ()
  | :? Exception -> ()

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (try_expression
        (const
          (unit))
        (rules
          (rule
            (type_check_pattern
              (atomic_type
                (long_identifier
                  (identifier)
                  (identifier)
                  (identifier))))
            (const
              (unit)))
          (rule
            (type_check_pattern
              (atomic_type
                (long_identifier
                  (identifier))))
            (const
              (unit))))))))

================================================================================
try-with expression single line
================================================================================

do
  (fun _ -> try p.Kill(true) with _ -> ())

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

(file
  (declaration_expression
    (do
      (paren_expression
        (fun_expression
          (argument_patterns)
          (try_expression
            (application_expression
              (long_identifier_or_op
                (long_identifier
                  (identifier)
                  (identifier)))
              (const
                (bool)))
            (rules
              (rule
                (wildcard_pattern)
                (const
                  (unit))))))))))

================================================================================
try-finally expression
================================================================================

let test =
  try
    ()
  finally
    ()

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (try_expression
        (const
          (unit))
        (const
          (unit))))))

================================================================================
match expression multi-line
================================================================================

let test =
  match x with
  | Some x -> x
  | None -> 1

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (match_expression
        (long_identifier_or_op
          (identifier))
        (rules
          (rule
            (identifier_pattern
              (long_identifier_or_op
                (identifier))
              (identifier_pattern
                (long_identifier_or_op
                  (identifier))))
            (long_identifier_or_op
              (identifier)))
          (rule
            (identifier_pattern
              (long_identifier_or_op
                (identifier)))
            (const
              (int))))))))

================================================================================
match expression 3 rules
================================================================================

let a b =
    match a, b with
    | true, true -> sb.Append(basePath[1]) |> ignore
    | false, false -> sb.Append('/').Append(basePath) |> ignore
    | _ -> sb.Append(basePath) |> ignore

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

(file
  (declaration_expression
    (function_or_value_defn
      (function_declaration_left
        (identifier)
        (argument_patterns
          (long_identifier
            (identifier))))
      (match_expression
        (tuple_expression
          (long_identifier_or_op
            (identifier))
          (long_identifier_or_op
            (identifier)))
        (rules
          (rule
            (repeat_pattern
              (const
                (bool))
              (const
                (bool)))
            (infix_expression
              (application_expression
                (long_identifier_or_op
                  (long_identifier
                    (identifier)
                    (identifier)))
                (application_expression
                  (long_identifier_or_op
                    (identifier))
                  (list_expression
                    (const
                      (int)))))
              (infix_op)
              (long_identifier_or_op
                (identifier))))
          (rule
            (repeat_pattern
              (const
                (bool))
              (const
                (bool)))
            (infix_expression
              (application_expression
                (dot_expression
                  (application_expression
                    (long_identifier_or_op
                      (long_identifier
                        (identifier)
                        (identifier)))
                    (const
                      (char)))
                  (long_identifier_or_op
                    (identifier)))
                (long_identifier_or_op
                  (identifier)))
              (infix_op)
              (long_identifier_or_op
                (identifier))))
          (rule
            (wildcard_pattern)
            (infix_expression
              (application_expression
                (long_identifier_or_op
                  (long_identifier
                    (identifier)
                    (identifier)))
                (long_identifier_or_op
                  (identifier)))
              (infix_op)
              (long_identifier_or_op
                (long_identifier
                  (identifier))))))))))

================================================================================
object interface expression
================================================================================

let x =
  { new IBase with
      member _.A() = ()
      member _.B() = () }

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (brace_expression
        (object_expression
          (long_identifier_or_op
            (identifier))
          (member_defn
            (method_or_prop_defn
              (property_or_ident
                (identifier)
                (identifier))
              (const
                (unit))
              (const
                (unit))))
          (member_defn
            (method_or_prop_defn
              (property_or_ident
                (identifier)
                (identifier))
              (const
                (unit))
              (const
                (unit)))))))))

================================================================================
match expression followed by if expression
================================================================================

do
  match x with
  | x -> ()
  if x then () else ()

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

(file
  (declaration_expression
    (do
      (sequential_expression
        (match_expression
          (long_identifier_or_op
            (identifier))
          (rules
            (rule
              (identifier_pattern
                (long_identifier_or_op
                  (identifier)))
              (const
                (unit)))))
        (if_expression
          (long_identifier_or_op
            (identifier))
          (const
            (unit))
          (const
            (unit)))))))

================================================================================
simple function declaration
================================================================================

let f x =
  x + 1

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

(file
  (declaration_expression
    (function_or_value_defn
      (function_declaration_left
        (identifier)
        (argument_patterns
          (long_identifier
            (identifier))))
      (infix_expression
        (long_identifier_or_op
          (identifier))
        (infix_op)
        (const
          (int))))))

================================================================================
multi-line Array.map
================================================================================

let f xs =
    xs
    |> Array.map (fun x ->
        let y = x + 1
        x)

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

(file
  (declaration_expression
    (function_or_value_defn
      (function_declaration_left
        (identifier)
        (argument_patterns
          (long_identifier
            (identifier))))
      (application_expression
        (infix_expression
          (long_identifier_or_op
            (identifier))
          (infix_op)
          (long_identifier_or_op
            (long_identifier
              (identifier)
              (identifier))))
        (paren_expression
          (fun_expression
            (argument_patterns
              (long_identifier
                (identifier)))
            (declaration_expression
              (function_or_value_defn
                (value_declaration_left
                  (identifier_pattern
                    (long_identifier_or_op
                      (identifier))))
                (infix_expression
                  (long_identifier_or_op
                    (identifier))
                  (infix_op)
                  (const
                    (int))))
              (long_identifier_or_op
                (identifier)))))))))

================================================================================
list index with slice ranges
================================================================================

let f xs =
  xs[..1]
  xs[0..]
  xs[0..1]
  xs[.. 1]
  xs[0 ..]
  xs[0 .. 1]

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

(file
  (declaration_expression
    (function_or_value_defn
      (function_declaration_left
        (identifier)
        (argument_patterns
          (long_identifier
            (identifier))))
      (sequential_expression
        (application_expression
          (long_identifier_or_op
            (identifier))
          (list_expression
            (slice_ranges
              (slice_range
                (const
                  (int))))))
        (sequential_expression
          (application_expression
            (long_identifier_or_op
              (identifier))
            (list_expression
              (slice_ranges
                (slice_range
                  (const
                    (int))))))
          (sequential_expression
            (application_expression
              (long_identifier_or_op
                (identifier))
              (list_expression
                (slice_ranges
                  (slice_range
                    (const
                      (int))
                    (const
                      (int))))))
            (sequential_expression
              (application_expression
                (long_identifier_or_op
                  (identifier))
                (list_expression
                  (slice_ranges
                    (slice_range
                      (const
                        (int))))))
              (sequential_expression
                (application_expression
                  (long_identifier_or_op
                    (identifier))
                  (list_expression
                    (slice_ranges
                      (slice_range
                        (const
                          (int))))))
                (application_expression
                  (long_identifier_or_op
                    (identifier))
                  (list_expression
                    (slice_ranges
                      (slice_range
                        (const
                          (int))
                        (const
                          (int))))))))))))))

================================================================================
array index with slice ranges
================================================================================

let f xs =
  xs[|..1|]
  xs[|0..|]
  xs[|0..1|]
  xs[|.. 1|]
  xs[|0 ..|]
  xs[|0 .. 1|]

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

(file
  (declaration_expression
    (function_or_value_defn
      (function_declaration_left
        (identifier)
        (argument_patterns
          (long_identifier
            (identifier))))
      (sequential_expression
        (application_expression
          (long_identifier_or_op
            (identifier))
          (array_expression
            (slice_ranges
              (slice_range
                (const
                  (int))))))
        (sequential_expression
          (application_expression
            (long_identifier_or_op
              (identifier))
            (array_expression
              (slice_ranges
                (slice_range
                  (const
                    (int))))))
          (sequential_expression
            (application_expression
              (long_identifier_or_op
                (identifier))
              (array_expression
                (slice_ranges
                  (slice_range
                    (const
                      (int))
                    (const
                      (int))))))
            (sequential_expression
              (application_expression
                (long_identifier_or_op
                  (identifier))
                (array_expression
                  (slice_ranges
                    (slice_range
                      (const
                        (int))))))
              (sequential_expression
                (application_expression
                  (long_identifier_or_op
                    (identifier))
                  (array_expression
                    (slice_ranges
                      (slice_range
                        (const
                          (int))))))
                (application_expression
                  (long_identifier_or_op
                    (identifier))
                  (array_expression
                    (slice_ranges
                      (slice_range
                        (const
                          (int))
                        (const
                          (int))))))))))))))

================================================================================
pipe expression into infix op
================================================================================

do
  [] |> List.length > 0

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

(file
  (declaration_expression
    (do
      (infix_expression
        (infix_expression
          (list_expression)
          (infix_op)
          (long_identifier_or_op
            (long_identifier
              (identifier)
              (identifier))))
        (infix_op)
        (const
          (int))))))

================================================================================
object instantiation expression
================================================================================

let disposables = new Disposables.CompositeDisposable()

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (prefixed_expression
        (application_expression
          (long_identifier_or_op
            (long_identifier
              (identifier)
              (identifier)))
          (unit))))))

================================================================================
if expression inside array
================================================================================

let f =
    [| "string"
       if true then
           "stuff" |]

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (array_expression
        (const
          (string))
        (if_expression
          (const
            (bool))
          (const
            (string)))))))

================================================================================
record expression 1
================================================================================

let x = { A = 12; B = "string" }

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (brace_expression
        (field_initializers
          (field_initializer
            (long_identifier
              (identifier))
            (const
              (int)))
          (field_initializer
            (long_identifier
              (identifier))
            (const
              (string))))))))

================================================================================
anon record expression 1
================================================================================

let x = {| A = 12; B = "string"|}

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (anon_record_expression
        (field_initializers
          (field_initializer
            (long_identifier
              (identifier))
            (const
              (int)))
          (field_initializer
            (long_identifier
              (identifier))
            (const
              (string))))))))

================================================================================
anon record expression 2
================================================================================

let x = {|
  A = 12
  B = "string"
|}

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (anon_record_expression
        (field_initializers
          (field_initializer
            (long_identifier
              (identifier))
            (const
              (int)))
          (field_initializer
            (long_identifier
              (identifier))
            (const
              (string))))))))

================================================================================
anon record expression 3
================================================================================

let x =
  {| A = 12
     B = "string" |}

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (anon_record_expression
        (field_initializers
          (field_initializer
            (long_identifier
              (identifier))
            (const
              (int)))
          (field_initializer
            (long_identifier
              (identifier))
            (const
              (string))))))))

================================================================================
while expression in sequential expression
================================================================================

do
    while true do
        true

    match x with
    | true -> 1

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

(file
  (declaration_expression
    (do
      (sequential_expression
        (while_expression
          (const
            (bool))
          (const
            (bool)))
        (match_expression
          (long_identifier_or_op
            (identifier))
          (rules
            (rule
              (const
                (bool))
              (const
                (int)))))))))

================================================================================
prefer application expression + record over CE expression
================================================================================

let f x =
  let b = 1
  return Some { A = 1
                B = 2 }

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

(file
  (declaration_expression
    (function_or_value_defn
      (function_declaration_left
        (identifier)
        (argument_patterns
          (long_identifier
            (identifier))))
      (declaration_expression
        (function_or_value_defn
          (value_declaration_left
            (identifier_pattern
              (long_identifier_or_op
                (identifier))))
          (const
            (int)))
        (prefixed_expression
          (application_expression
            (long_identifier_or_op
              (identifier))
            (brace_expression
              (field_initializers
                (field_initializer
                  (long_identifier
                    (identifier))
                  (const
                    (int)))
                (field_initializer
                  (long_identifier
                    (identifier))
                  (const
                    (int)))))))))))

================================================================================
ce expression inside prefixed expression
================================================================================

let f x =
  return async {
    let! x = 4
    return 4
  }

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

(file
  (declaration_expression
    (function_or_value_defn
      (function_declaration_left
        (identifier)
        (argument_patterns
          (long_identifier
            (identifier))))
      (prefixed_expression
        (ce_expression
          (long_identifier_or_op
            (identifier))
          (declaration_expression
            (function_or_value_defn
              (value_declaration_left
                (identifier_pattern
                  (long_identifier_or_op
                    (identifier))))
              (const
                (int)))
            (prefixed_expression
              (const
                (int)))))))))

================================================================================
prefer application expression + record over CE expression 2
================================================================================

let f = task { return Some { A = 4; B = 5 } }

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (ce_expression
        (long_identifier_or_op
          (identifier))
        (prefixed_expression
          (application_expression
            (long_identifier_or_op
              (identifier))
            (brace_expression
              (field_initializers
                (field_initializer
                  (long_identifier
                    (identifier))
                  (const
                    (int)))
                (field_initializer
                  (long_identifier
                    (identifier))
                  (const
                    (int)))))))))))

================================================================================
tuple expression vs infix expression in object construction
================================================================================

module A

let f cts =
  CommandDefinition(
    """
      test string
      """,
    {| A = 1 |},
    cancellationToken = cts
  )

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

(file
  (named_module
    (long_identifier
      (identifier))
    (declaration_expression
      (function_or_value_defn
        (function_declaration_left
          (identifier)
          (argument_patterns
            (long_identifier
              (identifier))))
        (application_expression
          (long_identifier_or_op
            (identifier))
          (tuple_expression
            (const
              (triple_quoted_string))
            (tuple_expression
              (anon_record_expression
                (field_initializers
                  (field_initializer
                    (long_identifier
                      (identifier))
                    (const
                      (int)))))
              (infix_expression
                (long_identifier_or_op
                  (identifier))
                (infix_op)
                (long_identifier_or_op
                  (identifier))))))))))

================================================================================
function expression with under indentation
================================================================================

module A =
    let x = function
      | C
      | B ->  Some()
      | _ -> None

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

(file
  (module_defn
    (identifier)
    (declaration_expression
      (function_or_value_defn
        (value_declaration_left
          (identifier_pattern
            (long_identifier_or_op
              (identifier))))
        (function_expression
          (rules
            (rule
              (disjunct_pattern
                (identifier_pattern
                  (long_identifier_or_op
                    (identifier)))
                (identifier_pattern
                  (long_identifier_or_op
                    (identifier))))
              (application_expression
                (long_identifier_or_op
                  (identifier))
                (unit)))
            (rule
              (wildcard_pattern)
              (long_identifier_or_op
                (long_identifier
                  (identifier))))))))))

================================================================================
address of expression inside application
================================================================================

let x = f(&y)

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (application_expression
        (long_identifier_or_op
          (identifier))
        (prefixed_expression
          (prefix_op)
          (long_identifier_or_op
            (identifier)))))))

================================================================================
high prec application followed by pipe
================================================================================

let x =
  f(y) |> g

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (infix_expression
        (application_expression
          (long_identifier_or_op
            (identifier))
          (long_identifier_or_op
            (identifier)))
        (infix_op)
        (long_identifier_or_op
          (long_identifier
            (identifier)))))))

================================================================================
call method with named optional parameter
================================================================================

let x = Async.AwaitWaitHandle(iar.AsyncWaitHandle, ?millisecondsTimeout = millisecondsTimeout)

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (application_expression
        (long_identifier_or_op
          (long_identifier
            (identifier)
            (identifier)))
        (tuple_expression
          (long_identifier_or_op
            (long_identifier
              (identifier)
              (identifier)))
          (prefixed_expression
            (prefix_op)
            (infix_expression
              (long_identifier_or_op
                (identifier))
              (infix_op)
              (long_identifier_or_op
                (identifier)))))))))

================================================================================
function with flexible type argument
================================================================================

let f (x: #MyType) = ()

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

(file
  (declaration_expression
    (function_or_value_defn
      (function_declaration_left
        (identifier)
        (argument_patterns
          (typed_pattern
            (identifier_pattern
              (long_identifier_or_op
                (identifier)))
            (flexible_type
              (simple_type
                (long_identifier
                  (identifier)))))))
      (const
        (unit)))))

================================================================================
for in slice expression
================================================================================

do
  for x in 0..10 do
    ()

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

(file
  (declaration_expression
    (do
      (for_expression
        (identifier_pattern
          (long_identifier_or_op
            (identifier)))
        (range_expression
          (const
            (int))
          (const
            (int)))
        (const
          (unit))))))

================================================================================
for in slice-skip expression
================================================================================

do
  for x in 0..2..10 do
    ()

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

(file
  (declaration_expression
    (do
      (for_expression
        (identifier_pattern
          (long_identifier_or_op
            (identifier)))
        (range_expression
          (const
            (int))
          (const
            (int))
          (const
            (int)))
        (const
          (unit))))))

================================================================================
for in slice expression complex
================================================================================

do
  for x in n..x + 10 do
    ()

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

(file
  (declaration_expression
    (do
      (for_expression
        (identifier_pattern
          (long_identifier_or_op
            (identifier)))
        (range_expression
          (long_identifier_or_op
            (identifier))
          (infix_expression
            (long_identifier_or_op
              (identifier))
            (infix_op)
            (const
              (int))))
        (const
          (unit))))))

================================================================================
list append infix op
================================================================================

let x
  let x = [1; 2]
  let b = [3; 4]
  a @ b

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

(file
  (declaration_expression
    (function_or_value_defn
      (function_declaration_left
        (identifier)
        (argument_patterns
          (long_identifier
            (identifier))
          (long_identifier
            (identifier))))
      (list_expression
        (const
          (int))
        (const
          (int)))))
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (list_expression
        (const
          (int))
        (const
          (int)))))
  (infix_expression
    (long_identifier_or_op
      (identifier))
    (infix_op)
    (long_identifier_or_op
      (long_identifier
        (identifier)))))

================================================================================
function decl with static parameter
================================================================================

let f (a: seq<'T>) (b: 'T) =
  ()

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

(file
  (declaration_expression
    (function_or_value_defn
      (function_declaration_left
        (identifier)
        (argument_patterns
          (typed_pattern
            (identifier_pattern
              (long_identifier_or_op
                (identifier)))
            (generic_type
              (long_identifier
                (identifier))
              (type_attributes
                (type_attribute
                  (type_argument
                    (identifier))))))
          (typed_pattern
            (identifier_pattern
              (long_identifier_or_op
                (identifier)))
            (type_argument
              (identifier)))))
      (const
        (unit)))))

================================================================================
match inside paren with underindentation
================================================================================

do
  (match x with
  | _ -> id
  | _ -> id) 1

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

(file
  (declaration_expression
    (do
      (application_expression
        (paren_expression
          (match_expression
            (long_identifier_or_op
              (identifier))
            (rules
              (rule
                (wildcard_pattern)
                (long_identifier_or_op
                  (identifier)))
              (rule
                (wildcard_pattern)
                (long_identifier_or_op
                  (identifier))))))
        (const
          (int))))))

================================================================================
infix expression inside paren with underindentation
================================================================================

do
  f (a ||
    b)

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

(file
  (declaration_expression
    (do
      (application_expression
        (long_identifier_or_op
          (identifier))
        (paren_expression
          (infix_expression
            (long_identifier_or_op
              (identifier))
            (infix_op)
            (long_identifier_or_op
              (identifier))))))))

================================================================================
literal expressions inside paren
================================================================================

do
  (<@ (%varExpr).Path @>, convert <@ (%varExpr).JsonOpt @>, <@ (%varExpr).JsonOpt @>)

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

(file
  (declaration_expression
    (do
      (paren_expression
        (tuple_expression
          (literal_expression
            (dot_expression
              (paren_expression
                (prefixed_expression
                  (prefix_op)
                  (long_identifier_or_op
                    (identifier))))
              (long_identifier_or_op
                (identifier))))
          (tuple_expression
            (application_expression
              (long_identifier_or_op
                (identifier))
              (literal_expression
                (dot_expression
                  (paren_expression
                    (prefixed_expression
                      (prefix_op)
                      (long_identifier_or_op
                        (identifier))))
                  (long_identifier_or_op
                    (identifier)))))
            (literal_expression
              (dot_expression
                (paren_expression
                  (prefixed_expression
                    (prefix_op)
                    (long_identifier_or_op
                      (identifier))))
                (long_identifier_or_op
                  (identifier))))))))))

================================================================================
if-then-else follow by identifier starting with 'e'
================================================================================

let f x =
  let a = if b then 0 else 1
  exit b

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

(file
  (declaration_expression
    (function_or_value_defn
      (function_declaration_left
        (identifier)
        (argument_patterns
          (long_identifier
            (identifier))))
      (declaration_expression
        (function_or_value_defn
          (value_declaration_left
            (identifier_pattern
              (long_identifier_or_op
                (identifier))))
          (if_expression
            (long_identifier_or_op
              (identifier))
            (const
              (int))
            (const
              (int))))
        (application_expression
          (long_identifier_or_op
            (identifier))
          (long_identifier_or_op
            (long_identifier
              (identifier))))))))

================================================================================
chained fluent calls
================================================================================

let f services =
  services
    .AddX()
    .AddY()

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

(file
  (declaration_expression
    (function_or_value_defn
      (function_declaration_left
        (identifier)
        (argument_patterns
          (long_identifier
            (identifier))))
      (application_expression
        (dot_expression
          (application_expression
            (long_identifier_or_op
              (long_identifier
                (identifier)
                (identifier)))
            (unit))
          (long_identifier_or_op
            (identifier)))
        (unit)))))

================================================================================
function application with explicit type
================================================================================

f<string>()

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

(file
  (application_expression
    (typed_expression
      (long_identifier_or_op
        (identifier))
      (types
        (simple_type
          (long_identifier
            (identifier)))))
    (unit)))

================================================================================
function application with explicit anonymous type
================================================================================

f<{|x: string|}>()

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

(file
  (application_expression
    (typed_expression
      (long_identifier_or_op
        (identifier))
      (types
        (anon_record_type
          (record_fields
            (record_field
              (identifier)
              (simple_type
                (long_identifier
                  (identifier))))))))
    (unit)))

================================================================================
anonymous record update expression
================================================================================

let x = {| y with A = 1 |}

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (anon_record_expression
        (with_field_expression
          (long_identifier_or_op
            (identifier))
          (field_initializers
            (field_initializer
              (long_identifier
                (identifier))
              (const
                (int)))))))))

================================================================================
Method call with multiline parameters
================================================================================

do
  x.Call(x, true,
    c, 1)

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

(file
  (declaration_expression
    (do
      (application_expression
        (long_identifier_or_op
          (long_identifier
            (identifier)
            (identifier)))
        (tuple_expression
          (long_identifier_or_op
            (identifier))
          (tuple_expression
            (const
              (bool))
            (tuple_expression
              (long_identifier_or_op
                (identifier))
              (const
                (int)))))))))

================================================================================
object expression with multiple overrides
================================================================================

do
  { new C() with
      override _.ToString() = ""
      override _.F() = ()
  }

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

(file
  (declaration_expression
    (do
      (brace_expression
        (object_expression
          (application_expression
            (long_identifier_or_op
              (identifier))
            (unit))
          (member_defn
            (method_or_prop_defn
              (property_or_ident
                (identifier)
                (identifier))
              (const
                (unit))
              (const
                (string))))
          (member_defn
            (method_or_prop_defn
              (property_or_ident
                (identifier)
                (identifier))
              (const
                (unit))
              (const
                (unit)))))))))

================================================================================
object expression with interface base type
================================================================================

do
  { new C with
      override _.ToString() = ""
      override _.F() = ()
  }

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

(file
  (declaration_expression
    (do
      (brace_expression
        (object_expression
          (long_identifier_or_op
            (identifier))
          (member_defn
            (method_or_prop_defn
              (property_or_ident
                (identifier)
                (identifier))
              (const
                (unit))
              (const
                (string))))
          (member_defn
            (method_or_prop_defn
              (property_or_ident
                (identifier)
                (identifier))
              (const
                (unit))
              (const
                (unit)))))))))

================================================================================
object expression with multiple interfaces
================================================================================

let implementer() =
    { new ISecond with
        member this.H() = ()
        member this.J() = ()
      interface IFirst with
        member this.F() = ()
        member this.G() = () }

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

(file
  (declaration_expression
    (function_or_value_defn
      (function_declaration_left
        (identifier)
        (argument_patterns
          (const
            (unit))))
      (brace_expression
        (object_expression
          (long_identifier_or_op
            (identifier))
          (member_defn
            (method_or_prop_defn
              (property_or_ident
                (identifier)
                (identifier))
              (const
                (unit))
              (const
                (unit))))
          (member_defn
            (method_or_prop_defn
              (property_or_ident
                (identifier)
                (identifier))
              (const
                (unit))
              (const
                (unit))))
          (interface_implementation
            (simple_type
              (long_identifier
                (identifier)))
            (member_defn
              (method_or_prop_defn
                (property_or_ident
                  (identifier)
                  (identifier))
                (const
                  (unit))
                (const
                  (unit))))
            (member_defn
              (method_or_prop_defn
                (property_or_ident
                  (identifier)
                  (identifier))
                (const
                  (unit))
                (const
                  (unit))))))))))

================================================================================
object expression generic interface
================================================================================

let implementer() =
    { new IFirst<_,_> with
        member this.H() = ()
        member this.J() = () }

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

(file
  (declaration_expression
    (function_or_value_defn
      (function_declaration_left
        (identifier)
        (argument_patterns
          (const
            (unit))))
      (brace_expression
        (object_expression
          (typed_expression
            (long_identifier_or_op
              (identifier))
            (types
              (type_argument)
              (type_argument)))
          (member_defn
            (method_or_prop_defn
              (property_or_ident
                (identifier)
                (identifier))
              (const
                (unit))
              (const
                (unit))))
          (member_defn
            (method_or_prop_defn
              (property_or_ident
                (identifier)
                (identifier))
              (const
                (unit))
              (const
                (unit)))))))))

================================================================================
object expression generic base class
================================================================================

let implementer() =
    { new C<_,_>() with
        member this.H() = ()
        member this.J() = () }

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

(file
  (declaration_expression
    (function_or_value_defn
      (function_declaration_left
        (identifier)
        (argument_patterns
          (const
            (unit))))
      (brace_expression
        (object_expression
          (application_expression
            (typed_expression
              (long_identifier_or_op
                (identifier))
              (types
                (type_argument)
                (type_argument)))
            (unit))
          (member_defn
            (method_or_prop_defn
              (property_or_ident
                (identifier)
                (identifier))
              (const
                (unit))
              (const
                (unit))))
          (member_defn
            (method_or_prop_defn
              (property_or_ident
                (identifier)
                (identifier))
              (const
                (unit))
              (const
                (unit)))))))))

================================================================================
scoping issues with end indentifier
================================================================================

let f x =
    x
    |> List.map (fun endpoint ->
        match endpoint with
        | A -> f endpoints)
    |> g

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

(file
  (declaration_expression
    (function_or_value_defn
      (function_declaration_left
        (identifier)
        (argument_patterns
          (long_identifier
            (identifier))))
      (infix_expression
        (application_expression
          (infix_expression
            (long_identifier_or_op
              (identifier))
            (infix_op)
            (long_identifier_or_op
              (long_identifier
                (identifier)
                (identifier))))
          (paren_expression
            (fun_expression
              (argument_patterns
                (long_identifier
                  (identifier)))
              (match_expression
                (long_identifier_or_op
                  (identifier))
                (rules
                  (rule
                    (identifier_pattern
                      (long_identifier_or_op
                        (identifier)))
                    (application_expression
                      (long_identifier_or_op
                        (identifier))
                      (long_identifier_or_op
                        (identifier)))))))))
        (infix_op)
        (long_identifier_or_op
          (long_identifier
            (identifier)))))))

================================================================================
multiple disjunction patterns with parameters
================================================================================

do
  match x with
  | Key(_,_,_)
  | Key(_,_,_)
  | Key -> 1

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

(file
  (declaration_expression
    (do
      (match_expression
        (long_identifier_or_op
          (identifier))
        (rules
          (rule
            (disjunct_pattern
              (disjunct_pattern
                (identifier_pattern
                  (long_identifier_or_op
                    (identifier))
                  (paren_pattern
                    (repeat_pattern
                      (wildcard_pattern)
                      (wildcard_pattern)
                      (wildcard_pattern))))
                (identifier_pattern
                  (long_identifier_or_op
                    (identifier))
                  (paren_pattern
                    (repeat_pattern
                      (wildcard_pattern)
                      (wildcard_pattern)
                      (wildcard_pattern)))))
              (identifier_pattern
                (long_identifier_or_op
                  (identifier))))
            (const
              (int))))))))

================================================================================
function definition vs value definition regression 1
================================================================================

let setDefaultColors fg bg sp =
    setHighlight {
        id = 0
    }
    (*trace "setDefaultColors: %A %A %A" fg bg sp*)

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

(file
  (declaration_expression
    (function_or_value_defn
      (function_declaration_left
        (identifier)
        (argument_patterns
          (long_identifier
            (identifier))
          (long_identifier
            (identifier))
          (long_identifier
            (identifier))))
      (application_expression
        (long_identifier_or_op
          (identifier))
        (brace_expression
          (field_initializers
            (field_initializer
              (long_identifier
                (identifier))
              (const
                (int))))))
      (block_comment
        (block_comment_content)))))

================================================================================
pipeline with lambda and comparison operators
================================================================================

let result = items |> List.filter (fun p -> p.Age >= minAge && p.Age <= maxAge)

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (application_expression
        (infix_expression
          (long_identifier_or_op
            (identifier))
          (infix_op)
          (long_identifier_or_op
            (long_identifier
              (identifier)
              (identifier))))
        (paren_expression
          (fun_expression
            (argument_patterns
              (long_identifier
                (identifier)))
            (infix_expression
              (infix_expression
                (long_identifier_or_op
                  (long_identifier
                    (identifier)
                    (identifier)))
                (infix_op)
                (long_identifier_or_op
                  (identifier)))
              (infix_op)
              (infix_expression
                (long_identifier_or_op
                  (long_identifier
                    (identifier)
                    (identifier)))
                (infix_op)
                (long_identifier_or_op
                  (identifier))))))))))

================================================================================
query expression with where and select
================================================================================

let results =
  query {
    for student in db.Student do
    where (student.Age > 18)
    select student
  }

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (ce_expression
        (long_identifier_or_op
          (identifier))
        (for_expression
          (identifier_pattern
            (long_identifier_or_op
              (identifier)))
          (long_identifier_or_op
            (long_identifier
              (identifier)
              (identifier)))
          (sequential_expression
            (application_expression
              (long_identifier_or_op
                (identifier))
              (paren_expression
                (infix_expression
                  (long_identifier_or_op
                    (long_identifier
                      (identifier)
                      (identifier)))
                  (infix_op)
                  (const
                    (int)))))
            (application_expression
              (long_identifier_or_op
                (identifier))
              (long_identifier_or_op
                (identifier)))))))))

================================================================================
query expression with sortBy and thenBy
================================================================================

let x =
    query {
        for student in db.Student do
        sortBy student.Name
        thenBy student.Age
        select student
    }

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (ce_expression
        (long_identifier_or_op
          (identifier))
        (for_expression
          (identifier_pattern
            (long_identifier_or_op
              (identifier)))
          (long_identifier_or_op
            (long_identifier
              (identifier)
              (identifier)))
          (sequential_expression
            (application_expression
              (long_identifier_or_op
                (identifier))
              (long_identifier_or_op
                (long_identifier
                  (identifier)
                  (identifier))))
            (sequential_expression
              (application_expression
                (long_identifier_or_op
                  (identifier))
                (long_identifier_or_op
                  (long_identifier
                    (identifier)
                    (identifier))))
              (application_expression
                (long_identifier_or_op
                  (identifier))
                (long_identifier_or_op
                  (identifier))))))))))

================================================================================
query expression with groupBy into
================================================================================

let x =
  query {
    for student in db.Student do
    groupBy student.Age into g
    select g
  }

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (ce_expression
        (long_identifier_or_op
          (identifier))
        (for_expression
          (identifier_pattern
            (long_identifier_or_op
              (identifier)))
          (long_identifier_or_op
            (long_identifier
              (identifier)
              (identifier)))
          (sequential_expression
            (application_expression
              (application_expression
                (application_expression
                  (long_identifier_or_op
                    (identifier))
                  (long_identifier_or_op
                    (long_identifier
                      (identifier)
                      (identifier))))
                (long_identifier_or_op
                  (identifier)))
              (long_identifier_or_op
                (identifier)))
            (application_expression
              (long_identifier_or_op
                (identifier))
              (long_identifier_or_op
                (identifier)))))))))

================================================================================
query expression with join on
================================================================================

let x =
  query {
    for student in db.Student do
    join course in db.Course on (student.CourseId = course.Id)
    select (student, course)
  }

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (ce_expression
        (long_identifier_or_op
          (identifier))
        (for_expression
          (identifier_pattern
            (long_identifier_or_op
              (identifier)))
          (long_identifier_or_op
            (long_identifier
              (identifier)
              (identifier)))
          (sequential_expression
            (application_expression
              (application_expression
                (application_expression
                  (application_expression
                    (application_expression
                      (long_identifier_or_op
                        (identifier))
                      (long_identifier_or_op
                        (identifier)))
                    (long_identifier_or_op
                      (identifier)))
                  (long_identifier_or_op
                    (long_identifier
                      (identifier)
                      (identifier))))
                (long_identifier_or_op
                  (identifier)))
              (paren_expression
                (infix_expression
                  (long_identifier_or_op
                    (long_identifier
                      (identifier)
                      (identifier)))
                  (infix_op)
                  (long_identifier_or_op
                    (long_identifier
                      (identifier)
                      (identifier))))))
            (application_expression
              (long_identifier_or_op
                (identifier))
              (paren_expression
                (tuple_expression
                  (long_identifier_or_op
                    (identifier))
                  (long_identifier_or_op
                    (identifier)))))))))))

================================================================================
query expression with additional custom operations
================================================================================

let q =
  query {
    for student in db.Student do
    distinct
    sortByDescending student.Name
    thenByDescending student.Age
    skip 10
    take 5
    select student
  }

let c =
  query {
    for student in db.Student do
    contains student
  }

let h =
  query {
    for student in db.Student do
    headOrDefault
  }

let n =
  query {
    for student in db.Student do
    nth 3
  }

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (ce_expression
        (long_identifier_or_op
          (identifier))
        (for_expression
          (identifier_pattern
            (long_identifier_or_op
              (identifier)))
          (long_identifier_or_op
            (long_identifier
              (identifier)
              (identifier)))
          (sequential_expression
            (long_identifier_or_op
              (identifier))
            (sequential_expression
              (application_expression
                (long_identifier_or_op
                  (identifier))
                (long_identifier_or_op
                  (long_identifier
                    (identifier)
                    (identifier))))
              (sequential_expression
                (application_expression
                  (long_identifier_or_op
                    (identifier))
                  (long_identifier_or_op
                    (long_identifier
                      (identifier)
                      (identifier))))
                (sequential_expression
                  (application_expression
                    (long_identifier_or_op
                      (identifier))
                    (const
                      (int)))
                  (sequential_expression
                    (application_expression
                      (long_identifier_or_op
                        (identifier))
                      (const
                        (int)))
                    (application_expression
                      (long_identifier_or_op
                        (identifier))
                      (long_identifier_or_op
                        (identifier))))))))))))
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (ce_expression
        (long_identifier_or_op
          (identifier))
        (for_expression
          (identifier_pattern
            (long_identifier_or_op
              (identifier)))
          (long_identifier_or_op
            (long_identifier
              (identifier)
              (identifier)))
          (application_expression
            (long_identifier_or_op
              (identifier))
            (long_identifier_or_op
              (identifier)))))))
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (ce_expression
        (long_identifier_or_op
          (identifier))
        (for_expression
          (identifier_pattern
            (long_identifier_or_op
              (identifier)))
          (long_identifier_or_op
            (long_identifier
              (identifier)
              (identifier)))
          (long_identifier_or_op
            (identifier))))))
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (ce_expression
        (long_identifier_or_op
          (identifier))
        (for_expression
          (identifier_pattern
            (long_identifier_or_op
              (identifier)))
          (long_identifier_or_op
            (long_identifier
              (identifier)
              (identifier)))
          (application_expression
            (long_identifier_or_op
              (identifier))
            (const
              (int))))))))

================================================================================
query expression with groupJoin into and leftOuterJoin into
================================================================================

let q1 =
  query {
    for student in db.Student do
    groupJoin course in db.Course on (student.CourseId = course.Id) into matches
    select matches
  }

let q2 =
  query {
    for student in db.Student do
    leftOuterJoin course in db.Course on (student.CourseId = course.Id) into matches
    select matches
  }

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (ce_expression
        (long_identifier_or_op
          (identifier))
        (for_expression
          (identifier_pattern
            (long_identifier_or_op
              (identifier)))
          (long_identifier_or_op
            (long_identifier
              (identifier)
              (identifier)))
          (sequential_expression
            (application_expression
              (application_expression
                (application_expression
                  (application_expression
                    (application_expression
                      (application_expression
                        (application_expression
                          (long_identifier_or_op
                            (identifier))
                          (long_identifier_or_op
                            (identifier)))
                        (long_identifier_or_op
                          (identifier)))
                      (long_identifier_or_op
                        (long_identifier
                          (identifier)
                          (identifier))))
                    (long_identifier_or_op
                      (identifier)))
                  (paren_expression
                    (infix_expression
                      (long_identifier_or_op
                        (long_identifier
                          (identifier)
                          (identifier)))
                      (infix_op)
                      (long_identifier_or_op
                        (long_identifier
                          (identifier)
                          (identifier))))))
                (long_identifier_or_op
                  (identifier)))
              (long_identifier_or_op
                (identifier)))
            (application_expression
              (long_identifier_or_op
                (identifier))
              (long_identifier_or_op
                (identifier))))))))
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (ce_expression
        (long_identifier_or_op
          (identifier))
        (for_expression
          (identifier_pattern
            (long_identifier_or_op
              (identifier)))
          (long_identifier_or_op
            (long_identifier
              (identifier)
              (identifier)))
          (sequential_expression
            (application_expression
              (application_expression
                (application_expression
                  (application_expression
                    (application_expression
                      (application_expression
                        (application_expression
                          (long_identifier_or_op
                            (identifier))
                          (long_identifier_or_op
                            (identifier)))
                        (long_identifier_or_op
                          (identifier)))
                      (long_identifier_or_op
                        (long_identifier
                          (identifier)
                          (identifier))))
                    (long_identifier_or_op
                      (identifier)))
                  (paren_expression
                    (infix_expression
                      (long_identifier_or_op
                        (long_identifier
                          (identifier)
                          (identifier)))
                      (infix_op)
                      (long_identifier_or_op
                        (long_identifier
                          (identifier)
                          (identifier))))))
                (long_identifier_or_op
                  (identifier)))
              (long_identifier_or_op
                (identifier)))
            (application_expression
              (long_identifier_or_op
                (identifier))
              (long_identifier_or_op
                (identifier)))))))))

================================================================================
trait call expression with member
================================================================================

let inline f x = (^a : (member Name : string) x)

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

(file
  (declaration_expression
    (function_or_value_defn
      (function_declaration_left
        (identifier)
        (argument_patterns
          (long_identifier
            (identifier))))
      (paren_expression
        (srtp_call_expression
          (type_argument
            (identifier))
          (trait_member_constraint
            (identifier)
            (simple_type
              (long_identifier
                (identifier))))
          (long_identifier_or_op
            (identifier)))))))

================================================================================
trait call expression with static member
================================================================================

let inline f (x: ^a) = (^a : (static member Zero : ^a) ())

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

(file
  (declaration_expression
    (function_or_value_defn
      (function_declaration_left
        (identifier)
        (argument_patterns
          (typed_pattern
            (identifier_pattern
              (long_identifier_or_op
                (identifier)))
            (type_argument
              (identifier)))))
      (paren_expression
        (srtp_call_expression
          (type_argument
            (identifier))
          (trait_member_constraint
            (identifier)
            (type_argument
              (identifier)))
          (const
            (unit)))))))

================================================================================
fixed expression
================================================================================

let x = fixed &buf

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (prefixed_expression
        (prefixed_expression
          (prefix_op)
          (long_identifier_or_op
            (long_identifier
              (identifier))))))))

================================================================================
quotation splicing with %%
================================================================================

let x = <@@ %%expr @@>

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (literal_expression
        (prefixed_expression
          (prefix_op)
          (long_identifier_or_op
            (identifier)))))))

================================================================================
quotation with lambda
================================================================================

let x = <@ fun y -> y @>

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (literal_expression
        (fun_expression
          (argument_patterns
            (long_identifier
              (identifier)))
          (long_identifier_or_op
            (identifier)))))))

================================================================================
range expression in computation expression
================================================================================

let x = seq { 1..10 }

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (ce_expression
        (long_identifier_or_op
          (identifier))
        (range_expression
          (const
            (int))
          (const
            (int)))))))

================================================================================
range expression with step in computation expression
================================================================================

let x = seq { 1..2..10 }

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (ce_expression
        (long_identifier_or_op
          (identifier))
        (range_expression
          (const
            (int))
          (const
            (int))
          (const
            (int)))))))

================================================================================
short for expression in computation expression
================================================================================

let x =
    seq {
        for key in vars.Keys -> string key, string vars[key]
    }

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (ce_expression
        (long_identifier_or_op
          (identifier))
        (short_comp_expression
          (identifier_pattern
            (long_identifier_or_op
              (identifier)))
          (long_identifier_or_op
            (long_identifier
              (identifier)
              (identifier)))
          (tuple_expression
            (application_expression
              (long_identifier_or_op
                (identifier))
              (long_identifier_or_op
                (identifier)))
              (application_expression
                (application_expression
                  (long_identifier_or_op
                    (identifier))
                  (long_identifier_or_op
                    (identifier)))
                (list_expression
                  (long_identifier_or_op
                    (identifier))))))))))

================================================================================
let then short for expression in computation expression
================================================================================

let x =
    seq {
        let vars = Environment.GetEnvironmentVariables()
        for key in vars.Keys -> string key, string vars[key]
    }

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      body: (ce_expression
        (long_identifier_or_op
          (identifier))
        block: (declaration_expression
          (function_or_value_defn
            (value_declaration_left
              (identifier_pattern
                (long_identifier_or_op
                  (identifier))))
            body: (application_expression
              (long_identifier_or_op
                (long_identifier
                  (identifier)
                  (identifier)))
              (unit)))
          in: (short_comp_expression
            (identifier_pattern
              (long_identifier_or_op
                (identifier)))
            (long_identifier_or_op
              (long_identifier
                (identifier)
                (identifier)))
            (tuple_expression
              (application_expression
                (long_identifier_or_op
                  (identifier))
                (long_identifier_or_op
                  (identifier)))
              (application_expression
                (application_expression
                  (long_identifier_or_op
                    (identifier))
                  (long_identifier_or_op
                    (identifier)))
                (list_expression
                  (long_identifier_or_op
                    (identifier)))))))))))

================================================================================
extern declaration
================================================================================

[<DllImport("kernel32.dll")>]
extern bool CloseHandle(nativeint handle)

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

(file
  (extern_binding
    (attributes
      (attribute
        (simple_type
          (long_identifier
            (identifier)))
        (paren_expression
          (const
            (string)))))
    (simple_type
      (long_identifier
        (identifier)))
    (identifier)
    (extern_param
      (simple_type
        (long_identifier
          (identifier)))
      (identifier))))

================================================================================
extern declaration with multiple parameters
================================================================================

[<DllImport("user32.dll")>]
extern int SendMessage(nativeint hWnd, int msg, nativeint wParam, nativeint lParam)

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

(file
  (extern_binding
    (attributes
      (attribute
        (simple_type
          (long_identifier
            (identifier)))
        (paren_expression
          (const
            (string)))))
    (simple_type
      (long_identifier
        (identifier)))
    (identifier)
    (extern_param
      (simple_type
        (long_identifier
          (identifier)))
      (identifier))
    (extern_param
      (simple_type
        (long_identifier
          (identifier)))
      (identifier))
    (extern_param
      (simple_type
        (long_identifier
          (identifier)))
      (identifier))
    (extern_param
      (simple_type
        (long_identifier
          (identifier)))
      (identifier))))

================================================================================
and! in computation expression
================================================================================

do
  task {
    let! x = getX()
    and! y = getY()
    return x + y
  }

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

(file
  (declaration_expression
    (do
      (ce_expression
        (long_identifier_or_op
          (identifier))
        (declaration_expression
          (function_or_value_defn
            (value_declaration_left
              (identifier_pattern
                (long_identifier_or_op
                  (identifier))))
            (application_expression
              (long_identifier_or_op
                (identifier))
              (unit)))
          (and_bang
            (identifier_pattern
              (long_identifier_or_op
                (identifier)))
            (application_expression
              (long_identifier_or_op
                (identifier))
              (unit)))
          (prefixed_expression
            (infix_expression
              (long_identifier_or_op
                (identifier))
              (infix_op)
              (long_identifier_or_op
                (identifier)))))))))

================================================================================
struct tuple type annotation
================================================================================

let f (x: struct (int * int)) = x

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

(file
  (declaration_expression
    (function_or_value_defn
      (function_declaration_left
        (identifier)
        (argument_patterns
          (typed_pattern
            (identifier_pattern
              (long_identifier_or_op
                (identifier)))
            (struct_type
              (paren_type
                (compound_type
                  (simple_type
                    (long_identifier
                      (identifier)))
                   (simple_type
                    (long_identifier
                      (identifier)))))))))
      (long_identifier_or_op
        (long_identifier
          (identifier))))))

================================================================================
struct anonymous record type annotation
================================================================================

let f (x: struct {| Name: string |}) = x

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

(file
  (declaration_expression
    (function_or_value_defn
      (function_declaration_left
        (identifier)
        (argument_patterns
          (typed_pattern
            (identifier_pattern
              (long_identifier_or_op
                (identifier)))
            (anon_record_type
              (record_fields
                (record_field
                  (identifier)
                  (simple_type
                    (long_identifier
                      (identifier)))))))))
      (long_identifier_or_op
        (long_identifier
          (identifier))))))

================================================================================
while expression with boolean infix condition
================================================================================

while a && b do
    ()

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

(file
  (while_expression
    (infix_expression
      (long_identifier_or_op
        (identifier))
      (infix_op)
      (long_identifier_or_op
        (identifier)))
    (const
      (unit))))

================================================================================
for expression with boolean infix enumerable
================================================================================

for x in a && b do
    ()

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

(file
  (for_expression
    (identifier_pattern
      (long_identifier_or_op
        (identifier)))
    (infix_expression
      (long_identifier_or_op
        (identifier))
      (infix_op)
      (long_identifier_or_op
        (identifier)))
    (const
      (unit))))

================================================================================
pipe into function expression
================================================================================

let a = ps |> function | Card c -> Some c | _ -> None

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (infix_expression
        (long_identifier_or_op
          (identifier))
        (infix_op)
        (function_expression
          (rules
            (rule
              (identifier_pattern
                (long_identifier_or_op
                  (identifier))
                (identifier_pattern
                  (long_identifier_or_op
                    (identifier))))
              (infix_expression
                (infix_expression
                  (application_expression
                    (long_identifier_or_op
                      (identifier))
                    (long_identifier_or_op
                      (identifier)))
                  (infix_op)
                  (long_identifier_or_op
                    (identifier)))
                (infix_op)
                (long_identifier_or_op
                  (long_identifier
                    (identifier)))))))))))

================================================================================
when guard with infix and arrow without space
================================================================================

let f x =
    match x with
    | y when y > 0 || isPfOwned-> 1
    | _ -> 0

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

(file
  (declaration_expression
    (function_or_value_defn
      (function_declaration_left
        (identifier)
        (argument_patterns
          (long_identifier
            (identifier))))
      (match_expression
        (long_identifier_or_op
          (identifier))
        (rules
          (rule
            (identifier_pattern
              (long_identifier_or_op
                (identifier)))
            (infix_expression
              (infix_expression
                (long_identifier_or_op
                  (identifier))
                (infix_op)
                (const
                  (int)))
              (infix_op)
              (long_identifier_or_op
                (identifier)))
            (const
              (int)))
          (rule
            (wildcard_pattern)
            (const
              (int))))))))

================================================================================
leading comma argument continuation
================================================================================

let opts =
    Options(
        ExcludeEnvironment = false
        ,ExcludeCli = true
        ,ExcludeManaged = false
    )

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (application_expression
        (long_identifier_or_op
          (identifier))
        (tuple_expression
          (infix_expression
            (long_identifier_or_op
              (identifier))
            (infix_op)
            (const
              (bool)))
          (tuple_expression
            (infix_expression
              (long_identifier_or_op
                (identifier))
              (infix_op)
              (const
                (bool)))
            (infix_expression
              (long_identifier_or_op
                (identifier))
              (infix_op)
              (const
                (bool)))))))))

================================================================================
under-indented list continuation after semicolon
================================================================================

let dchars = ["a";"b";
     "c";"d"] |> Set.ofList

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (infix_expression
        (list_expression
          (const
            (string))
          (const
            (string))
          (const
            (string))
          (const
            (string)))
        (infix_op)
        (long_identifier_or_op
          (long_identifier
            (identifier)
            (identifier)))))))

================================================================================
operator section as immediate application argument
================================================================================

let r = (a, b) ||> List.fold(Option.fold(+))

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (infix_expression
        (paren_expression
          (tuple_expression
            (long_identifier_or_op
              (identifier))
            (long_identifier_or_op
              (identifier))))
        (infix_op)
        (application_expression
          (long_identifier_or_op
            (long_identifier
              (identifier)
              (identifier)))
          (application_expression
            (long_identifier_or_op
              (long_identifier
                (identifier)
                (identifier)))
            (long_identifier_or_op
              (op_identifier))))))))

================================================================================
nested for comprehension with arrow
================================================================================

let e = [ for l in 0..3 do for h in 0..3 -> (l, h) ]

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (list_expression
        (for_expression
          (identifier_pattern
            (long_identifier_or_op
              (identifier)))
          (range_expression
            (const
              (int))
            (const
              (int)))
          (short_comp_expression
            (identifier_pattern
              (long_identifier_or_op
                (identifier)))
            (range_expression
              (const
                (int))
              (const
                (int)))
            (paren_expression
              (tuple_expression
                (long_identifier_or_op
                  (identifier))
                (long_identifier_or_op
                  (identifier))))))))))

================================================================================
interpolated string after let with if body in lambda
================================================================================

let r =
    values
    |> Array.map(fun v ->
        let req = if v.Required then "" else " option"
        $"{v.Name}{req}"
    )

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (infix_expression
        (long_identifier_or_op
          (identifier))
        (infix_op)
        (application_expression
          (long_identifier_or_op
            (long_identifier
              (identifier)
              (identifier)))
          (fun_expression
            (argument_patterns
              (long_identifier
                (identifier)))
            (declaration_expression
              (function_or_value_defn
                (value_declaration_left
                  (identifier_pattern
                    (long_identifier_or_op
                      (identifier))))
                (if_expression
                  (long_identifier_or_op
                    (long_identifier
                      (identifier)
                      (identifier)))
                  (const
                    (string))
                  (const
                    (string))))
              (const
                (string
                  (format_string
                    (format_string_eval
                      (long_identifier_or_op
                        (long_identifier
                          (identifier)
                          (identifier))))
                    (format_string_eval
                      (long_identifier_or_op
                        (identifier)))))))))))))

================================================================================
if else inside named argument
================================================================================

let f sender =
    let client = new SmtpClient(host, 8080,
                        EnableSsl = true, Credentials =
                            if ok then Cred(sender, b.Replace("a", ""))
                            else Cred(sender)
                    )
    client

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

(file
  (declaration_expression
    (function_or_value_defn
      (function_declaration_left
        (identifier)
        (argument_patterns
          (long_identifier
            (identifier))))
      (declaration_expression
        (function_or_value_defn
          (value_declaration_left
            (identifier_pattern
              (long_identifier_or_op
                (identifier))))
          (prefixed_expression
            (application_expression
              (long_identifier_or_op
                (identifier))
              (tuple_expression
                (long_identifier_or_op
                  (identifier))
                (tuple_expression
                  (const
                    (int))
                  (tuple_expression
                    (infix_expression
                      (long_identifier_or_op
                        (identifier))
                      (infix_op)
                      (const
                        (bool)))
                    (infix_expression
                      (long_identifier_or_op
                        (identifier))
                      (infix_op)
                      (if_expression
                        (long_identifier_or_op
                          (identifier))
                        (application_expression
                          (long_identifier_or_op
                            (identifier))
                          (tuple_expression
                            (long_identifier_or_op
                              (identifier))
                            (application_expression
                              (long_identifier_or_op
                                (long_identifier
                                  (identifier)
                                  (identifier)))
                              (tuple_expression
                                (const
                                  (string))
                                (const
                                  (string))))))
                        (application_expression
                          (long_identifier_or_op
                            (identifier))
                          (long_identifier_or_op
                            (identifier)))))))))))
        (long_identifier_or_op
          (long_identifier
            (identifier)))))))

================================================================================
statement after pipe chain in if branch
================================================================================

let f () =
    let basicCheck =
        if c then
            eventWarn("x")
            |> writeLog
            simpleError "CVC"
        else moreChecks
    basicCheck

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

(file
  (declaration_expression
    (function_or_value_defn
      (function_declaration_left
        (identifier)
        (argument_patterns
          (const
            (unit))))
      (declaration_expression
        (function_or_value_defn
          (value_declaration_left
            (identifier_pattern
              (long_identifier_or_op
                (identifier))))
          (if_expression
            (long_identifier_or_op
              (identifier))
            (sequential_expression
              (infix_expression
                (application_expression
                  (long_identifier_or_op
                    (identifier))
                  (const
                    (string)))
                (infix_op)
                (long_identifier_or_op
                  (identifier)))
              (application_expression
                (long_identifier_or_op
                  (identifier))
                (const
                  (string))))
            (long_identifier_or_op
              (identifier))))
        (long_identifier_or_op
          (long_identifier
            (identifier)))))))

================================================================================
measure literal with backtick-quoted unit
================================================================================

let confidenceLimited =
    if confidence > 0.95m<``Risk %``> then 0.95m
    else confidence/1m<``Risk %``>

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

(file
  (declaration_expression
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (if_expression
        (infix_expression
          (long_identifier_or_op
            (identifier))
          (infix_op)
          (typed_expression
            (const
              (decimal
                (float)))
            (types
              (simple_type
                (long_identifier
                  (identifier))))))
        (const
          (decimal
            (float)))
        (infix_expression
          (long_identifier_or_op
            (identifier))
          (infix_op)
          (typed_expression
            (const
              (decimal
                (int)))
            (types
              (simple_type
                (long_identifier
                  (identifier))))))))))
