This test checks completion of Go builtins.

-- flags --
-ignore_extra_diags
-filter_builtins=false

-- builtin_args.go --
package builtins

func _() {
	var (
		aSlice    []int          //@item(builtinSlice, "aSlice", "[]int", "var")
		aMap      map[string]int //@item(builtinMap, "aMap", "map[string]int", "var")
		aString   string         //@item(builtinString, "aString", "string", "var")
		aArray    [0]int         //@item(builtinArray, "aArray", "[0]int", "var")
		aArrayPtr *[0]int        //@item(builtinArrayPtr, "aArrayPtr", "*[0]int", "var")
		aChan     chan int       //@item(builtinChan, "aChan", "chan int", "var")
		aPtr      *int           //@item(builtinPtr, "aPtr", "*int", "var")
		aInt      int            //@item(builtinInt, "aInt", "int", "var")
	)

	type (
		aSliceType []int          //@item(builtinSliceType, "aSliceType", "[]int", "type")
		aChanType  chan int       //@item(builtinChanType, "aChanType", "chan int", "type")
		aMapType   map[string]int //@item(builtinMapType, "aMapType", "map[string]int", "type")
	)

	close() //@rank(")", builtinChan, builtinSlice)

	append() //@rank(")", builtinSlice, builtinChan)

	var _ []byte = append([]byte(nil), ""...) //@rank(") //")

	copy()           //@rank(")", builtinSlice, builtinChan)
	copy(aSlice, aS) //@rank(")", builtinSlice, builtinString)
	copy(aS, aSlice) //@rank(",", builtinSlice, builtinString)

	delete()         //@rank(")", builtinMap, builtinChan)
	delete(aMap, aS) //@rank(")", builtinString, builtinSlice)

	aMapFunc := func() map[int]int { //@item(builtinMapFunc, "aMapFunc", "func() map[int]int", "var")
		return nil
	}
	delete() //@rank(")", builtinMapFunc, builtinSlice)

	len() //@rank(")", builtinSlice, builtinInt),rank(")", builtinMap, builtinInt),rank(")", builtinString, builtinInt),rank(")", builtinArray, builtinInt),rank(")", builtinArrayPtr, builtinPtr),rank(")", builtinChan, builtinInt)

	cap() //@rank(")", builtinSlice, builtinMap),rank(")", builtinArray, builtinString),rank(")", builtinArrayPtr, builtinPtr),rank(")", builtinChan, builtinInt)

	make()              //@rank(")", builtinMapType, int),rank(")", builtinChanType, int),rank(")", builtinSliceType, int),rank(")", builtinMapType, int)
	make(aSliceType, a) //@rank(")", builtinInt, builtinSlice)

	type myInt int
	var mi myInt        //@item(builtinMyInt, "mi", "myInt", "var")
	make(aSliceType, m) //@snippet(")", builtinMyInt, "mi")

	var _ []int = make() //@rank(")", builtinSliceType, builtinMapType)

	type myStruct struct{}  //@item(builtinStructType, "myStruct", "struct{...}", "struct")
	var _ *myStruct = new() //@rank(")", builtinStructType, int)

	for k := range a { //@rank(" {", builtinSlice, builtinInt),rank(" {", builtinString, builtinInt),rank(" {", builtinChan, builtinInt),rank(" {", builtinArray, builtinInt),rank(" {", builtinArrayPtr, builtinInt),rank(" {", builtinMap, builtinInt),
	}

	for k, v := range a { //@rank(" {", builtinSlice, builtinChan)
	}

	<-a //@rank(" //", builtinChan, builtinInt)
}

-- builtin_types.go --
package builtins

func _() {
	var _ []bool //@item(builtinBoolSliceType, "[]bool", "[]bool", "type")

	var _ []bool = make() //@rank(")", builtinBoolSliceType, int)

	var _ []bool = make([], 0) //@rank(",", bool, int)

	var _ [][]bool = make([][], 0) //@rank(",", bool, int)
}

-- builtins.go --
package builtins

// Definitions of builtin completion items that are still used in tests.

/* bool */ //@item(bool, "bool", "", "type")
/* complex(r float64, i float64) */ //@item(complex, "complex", "func(r float64, i float64) complex128", "func")
/* float32 */ //@item(float32, "float32", "", "type")
/* float64 */ //@item(float64, "float64", "", "type")
/* imag(c complex128) float64 */ //@item(imag, "imag", "func(c complex128) float64", "func")
/* int */ //@item(int, "int", "", "type")
/* iota */ //@item(iota, "iota", "", "const")
/* string */ //@item(string, "string", "", "type")
/* true */ //@item(_true, "true", "", "const")

-- constants.go --
package builtins

func _() {
	const (
		foo = iota //@complete(" //", iota)
	)

	iota //@complete(" //")

	var iota int //@item(iotaVar, "iota", "int", "var")

	iota //@complete(" //", iotaVar)
}

func _() {
	var twoRedUpEnd bool //@item(TRUEVar, "twoRedUpEnd", "bool", "var")

	var _ bool = true //@rank(" //", _true, TRUEVar)
}
