============================================
Single const declarations without types
============================================

package main

const zero = 0
const one, two = 1, 2
const three, four, five = 3, 4, 5

----

(source_file
  (package_clause (package_identifier))
  (const_declaration (const_spec
    (identifier)
    (expression_list (int_literal))))
  (const_declaration (const_spec
    (identifier)
    (identifier)
    (expression_list (int_literal) (int_literal))))
  (const_declaration (const_spec
    (identifier)
    (identifier)
    (identifier)
    (expression_list (int_literal) (int_literal) (int_literal)))))

============================================
Single const declarations with types
============================================

package main

const zero int = 0
const one, two uint64 = 1, 2

----

(source_file
  (package_clause (package_identifier))
  (const_declaration (const_spec
    (identifier)
    (type_identifier)
    (expression_list (int_literal))))
  (const_declaration (const_spec
    (identifier)
    (identifier)
    (type_identifier)
    (expression_list (int_literal) (int_literal)))))

============================================
Grouped const declarations
============================================

package main

const (
  zero = 0
  one = 1
)

----

(source_file
  (package_clause (package_identifier))
  (const_declaration
    (const_spec
      (identifier)
      (expression_list (int_literal)))
    (const_spec
      (identifier)
      (expression_list (int_literal)))))

============================================
Const declarations with implicit values
============================================

package main

const (
  zero = iota
  one
  two
)

----

(source_file
  (package_clause (package_identifier))
  (const_declaration
    (const_spec
      (identifier)
      (expression_list (identifier)))
    (const_spec
      (identifier))
    (const_spec
      (identifier))))

============================================
Var declarations without types
============================================

package main

var zero = 0
var one, two = 1, 2
var three, four, five = 3, 4, 5

----

(source_file
  (package_clause (package_identifier))
  (var_declaration (var_spec
    (identifier)
    (expression_list (int_literal))))
  (var_declaration (var_spec
    (identifier)
    (identifier)
    (expression_list (int_literal) (int_literal))))
  (var_declaration (var_spec
    (identifier)
    (identifier)
    (identifier)
    (expression_list (int_literal) (int_literal) (int_literal)))))

============================================
Var declarations with types
============================================

package main

var zero int = 0
var one, two uint64 = 1, 2

----

(source_file
  (package_clause (package_identifier))
  (var_declaration (var_spec
    (identifier)
    (type_identifier)
    (expression_list (int_literal))))
  (var_declaration (var_spec
    (identifier)
    (identifier)
    (type_identifier)
    (expression_list (int_literal) (int_literal)))))

============================================
Var declarations with no expressions
============================================

package main

var zero int
var one, two uint64

----

(source_file
  (package_clause (package_identifier))
  (var_declaration (var_spec
    (identifier)
    (type_identifier)))
  (var_declaration (var_spec
    (identifier)
    (identifier)
    (type_identifier))))

============================================
Grouped var declarations
============================================

package main

var (
  zero = 0
  one = 1
)

----

(source_file
  (package_clause (package_identifier))
  (var_declaration
    (var_spec
      (identifier)
      (expression_list (int_literal)))
    (var_spec
      (identifier)
      (expression_list (int_literal)))))

============================================
Function declarations
============================================

package main

func f1() {}
func f2(a File, b, c, d Thing) int {}
func f2() (File, Thing) {}
func f2() (result int, err error) {}

---

(source_file
  (package_clause (package_identifier))
  (function_declaration
    (identifier)
    (parameter_list)
    (block))
  (function_declaration
    (identifier)
    (parameter_list
      (parameter_declaration
        (identifier)
        (type_identifier))
      (parameter_declaration
        (identifier)
        (identifier)
        (identifier)
        (type_identifier)))
    (type_identifier)
    (block))
  (function_declaration
    (identifier)
    (parameter_list)
    (parameter_list
      (parameter_declaration (type_identifier))
      (parameter_declaration (type_identifier)))
    (block))
  (function_declaration
    (identifier)
    (parameter_list)
    (parameter_list
      (parameter_declaration (identifier) (type_identifier))
      (parameter_declaration (identifier) (type_identifier)))
    (block)))

============================================
Single-line function declarations
============================================

package main

func f1() { a() }
func f2() { a(); b() }
func f3() { a(); b(); }

---

(source_file
  (package_clause (package_identifier))
  (function_declaration
    (identifier)
    (parameter_list)
    (block
      (call_expression (identifier) (argument_list))))
  (function_declaration
    (identifier)
    (parameter_list)
    (block
      (call_expression (identifier) (argument_list))
      (call_expression (identifier) (argument_list))))
  (function_declaration
    (identifier)
    (parameter_list)
    (block
      (call_expression (identifier) (argument_list))
      (call_expression (identifier) (argument_list)))))

============================================
Variadic function declarations
============================================

package main

func f1(a ...*int) {}
func f2(a int, b ...int) {}
func f3(...bool) {}

---

(source_file
  (package_clause (package_identifier))
  (function_declaration
    (identifier)
    (parameter_list
      (variadic_parameter_declaration
        (identifier)
        (pointer_type (type_identifier))))
    (block))
  (function_declaration
    (identifier)
    (parameter_list
      (parameter_declaration
        (identifier)
        (type_identifier))
      (variadic_parameter_declaration
        (identifier)
        (type_identifier)))
    (block))
  (function_declaration
    (identifier)
    (parameter_list
      (variadic_parameter_declaration (type_identifier)))
    (block)))

============================================
Method declarations
============================================

package main

func (self Person) Equals(other Person) bool {}
func (v *Value) ObjxMap(optionalDefault ...(Map)) Map {}

---

(source_file
  (package_clause (package_identifier))
  (method_declaration
    (parameter_list
      (parameter_declaration (identifier) (type_identifier)))
    (field_identifier)
    (parameter_list
      (parameter_declaration (identifier) (type_identifier)))
    (type_identifier)
    (block))
  (method_declaration
    (parameter_list
      (parameter_declaration (identifier) (pointer_type (type_identifier))))
    (field_identifier)
    (parameter_list
      (variadic_parameter_declaration
        (identifier)
        (parenthesized_type (type_identifier))))
    (type_identifier)
    (block)))

============================================
Type declarations
============================================

package main

type a b
type (
  a b
  c d
)

---

(source_file
  (package_clause (package_identifier))
  (type_declaration
    (type_spec (type_identifier) (type_identifier)))
  (type_declaration
    (type_spec (type_identifier) (type_identifier))
    (type_spec (type_identifier) (type_identifier))))
