2019-01-31 23:40:03 -07:00
|
|
|
package func_rank
|
|
|
|
|
2019-05-10 10:26:15 -06:00
|
|
|
var stringAVar = "var" //@item(stringAVar, "stringAVar", "string", "var")
|
2019-07-02 16:10:05 -06:00
|
|
|
func stringBFunc() string { return "str" } //@item(stringBFunc, "stringBFunc", "func() string", "func")
|
2019-05-10 10:26:15 -06:00
|
|
|
type stringer struct{} //@item(stringer, "stringer", "struct{...}", "struct")
|
2019-01-31 23:40:03 -07:00
|
|
|
|
|
|
|
func _() stringer //@complete("tr", stringer, stringAVar, stringBFunc)
|
|
|
|
|
|
|
|
func _(val stringer) {} //@complete("tr", stringer, stringAVar, stringBFunc)
|
|
|
|
|
|
|
|
func (stringer) _() {} //@complete("tr", stringer, stringAVar, stringBFunc)
|
|
|
|
|
2019-05-10 10:26:15 -06:00
|
|
|
func _() {
|
|
|
|
var s struct {
|
|
|
|
AA int //@item(rankAA, "AA", "int", "field")
|
|
|
|
AB string //@item(rankAB, "AB", "string", "field")
|
|
|
|
AC int //@item(rankAC, "AC", "int", "field")
|
|
|
|
}
|
|
|
|
fnStr := func(string) {}
|
|
|
|
fnStr(s.A) //@complete(")", rankAB, rankAA, rankAC)
|
|
|
|
fnStr("" + s.A) //@complete(")", rankAB, rankAA, rankAC)
|
|
|
|
|
|
|
|
fnInt := func(int) {}
|
|
|
|
fnInt(-s.A) //@complete(")", rankAA, rankAC, rankAB)
|
|
|
|
|
|
|
|
// no expected type
|
|
|
|
fnInt(func() int { s.A }) //@complete(" }", rankAA, rankAB, rankAC)
|
|
|
|
fnInt(s.A()) //@complete("()", rankAA, rankAB, rankAC)
|
2019-05-15 16:29:19 -06:00
|
|
|
fnInt([]int{}[s.A]) //@complete("])", rankAA, rankAC, rankAB)
|
|
|
|
fnInt([]int{}[:s.A]) //@complete("])", rankAA, rankAC, rankAB)
|
2019-05-10 10:26:15 -06:00
|
|
|
|
2019-12-27 09:57:52 -07:00
|
|
|
fnInt(s.A.(int)) //@complete(".(", rankAA, rankAC, rankAB)
|
2019-05-10 10:26:15 -06:00
|
|
|
|
|
|
|
fnPtr := func(*string) {}
|
|
|
|
fnPtr(&s.A) //@complete(")", rankAB, rankAA, rankAC)
|
|
|
|
|
|
|
|
var aaPtr *string //@item(rankAAPtr, "aaPtr", "*string", "var")
|
|
|
|
var abPtr *int //@item(rankABPtr, "abPtr", "*int", "var")
|
|
|
|
fnInt(*a) //@complete(")", rankABPtr, rankAAPtr)
|
|
|
|
|
|
|
|
_ = func() string {
|
|
|
|
return s.A //@complete(" //", rankAB, rankAA, rankAC)
|
|
|
|
}
|
|
|
|
}
|