================================================================================
basic compiler directive
================================================================================

#nowarn "42"

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

(file
  (compiler_directive_decl
    (string)))

================================================================================
nowarn directive inside namespace
================================================================================

namespace A

#nowarn "22"

do ()

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

(file
  (namespace
    (long_identifier
      (identifier))
    (compiler_directive_decl
      (string))
    (value_declaration
      (do
        (const
          (unit))))))

================================================================================
line compiler directive
================================================================================

#line 1
# 1

#line 1 "test"
# 1 "test"

#line 1 @"test"
# 1 @"test"

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

(file
  (preproc_line
    (int))
  (preproc_line
    (int))
  (preproc_line
    (int)
    (string))
  (preproc_line
    (int)
    (string))
  (preproc_line
    (int)
    (verbatim_string))
  (preproc_line
    (int)
    (verbatim_string)))

================================================================================
line compiler directive in expressions
================================================================================

do
#line 1
  1 + 1
#line 1 "test"
  2 + 2

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

(file
  (value_declaration
    (do
      (preproc_line
        (int))
      (infix_expression
        (application_expression
          (infix_expression
            (const
              (int))
            (infix_op)
            (const
              (int)))
          (preproc_line
            (int)
            (string))
          (const
            (int)))
        (infix_op)
        (const
          (int))))))

================================================================================
preproc_if inside expression block
================================================================================

do
  1 + 1
#if true
  printfn "blah"
#endif
  printfn "bluh"

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

(file
  (value_declaration
    (do
      (sequential_expression
        (infix_expression
          (const
            (int))
          (infix_op)
          (const
            (int)))
        (sequential_expression
          (preproc_if
            (identifier)
            (application_expression
              (long_identifier_or_op
                (identifier))
              (const
                (string))))
          (application_expression
            (long_identifier_or_op
              (identifier))
            (const
              (string))))))))

================================================================================
preproc_if inside expression block with else branch
================================================================================

do
  1 + 1
#if true
  printfn "blah"
#else
  printfn "huh"
#endif
  printfn "bluh"

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

(file
  (value_declaration
    (do
      (sequential_expression
        (infix_expression
          (const
            (int))
          (infix_op)
          (const
            (int)))
        (sequential_expression
          (preproc_if
            (identifier)
            (application_expression
              (long_identifier_or_op
                (identifier))
              (const
                (string)))
            (preproc_else
              (application_expression
                (long_identifier_or_op
                  (identifier))
                (const
                  (string)))))
          (application_expression
            (long_identifier_or_op
              (identifier))
            (const
              (string))))))))

================================================================================
preproc_if inside expression block with seq expression
================================================================================

do
  1 + 1
#if true
  printfn "blah1"
  2 + 2
  printfn "blah2"
#endif
  printfn "bluh"

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

(file
  (value_declaration
    (do
      (sequential_expression
        (infix_expression
          (const
            (int))
          (infix_op)
          (const
            (int)))
        (sequential_expression
          (preproc_if
            (identifier)
            (sequential_expression
              (application_expression
                (long_identifier_or_op
                  (identifier))
                (const
                  (string)))
              (sequential_expression
                (infix_expression
                  (const
                    (int))
                  (infix_op)
                  (const
                    (int)))
                (application_expression
                  (long_identifier_or_op
                    (identifier))
                  (const
                    (string))))))
          (application_expression
            (long_identifier_or_op
              (identifier))
            (const
              (string))))))))

================================================================================
preproc_if top-level
================================================================================

namespace Test

#if A
module A =
  let x = 4
#endif

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

(file
  (namespace
    (long_identifier
      (identifier))
    (preproc_if
      (identifier)
      (module_defn
        (identifier)
        (value_declaration
          (function_or_value_defn
            (value_declaration_left
              (identifier_pattern
                (long_identifier_or_op
                  (identifier))))
            (const
              (int))))))))

================================================================================
preproc_if in class definition
================================================================================

type MyClass() =
#if A
  member _.F(x: int) = x + 1
#endif

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

(file
  (type_definition
    (anon_type_defn
      (type_name
        (identifier))
      (primary_constr_args)
      (preproc_if
        (identifier)
        (member_defn
          (method_or_prop_defn
            (property_or_ident
              (identifier)
              (identifier))
            (paren_pattern
              (typed_pattern
                (identifier_pattern
                  (long_identifier_or_op
                    (identifier)))
                (type
                  (long_identifier
                    (identifier)))))
            (infix_expression
              (long_identifier_or_op
                (identifier))
              (infix_op)
              (const
                (int)))))))))

================================================================================
preproc_if creating dedent
================================================================================

let f =
  if b then x else y

#if B
  1
#endif

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

(file
  (value_declaration
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (sequential_expression
        (if_expression
          (long_identifier_or_op
            (identifier))
          (long_identifier_or_op
            (identifier))
          (long_identifier_or_op
            (identifier)))
        (preproc_if
          (identifier)
          (const
            (int)))))))

================================================================================
preproc_if with comment creating dedent
================================================================================

let f =
  if b then x else y

#if B
  // comment goes here
  1
#endif

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

(file
  (value_declaration
    (function_or_value_defn
      (value_declaration_left
        (identifier_pattern
          (long_identifier_or_op
            (identifier))))
      (sequential_expression
        (if_expression
          (long_identifier_or_op
            (identifier))
          (long_identifier_or_op
            (identifier))
          (long_identifier_or_op
            (identifier)))
        (preproc_if
          (identifier)
          (line_comment)
          (const
            (int)))))))
