aboutsummaryrefslogtreecommitdiff
path: root/gopls/internal/lsp/testdata/semantic/a.go
blob: 54d6c8a62fad186e2827b3eb94a7dc5d19f460c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package semantictokens //@ semantic("")

import (
	_ "encoding/utf8"
	utf "encoding/utf8"
	"fmt" //@ semantic("fmt")
	. "fmt"
	"unicode/utf8"
)

var (
	a           = fmt.Print
	b  []string = []string{"foo"}
	c1 chan int
	c2 <-chan int
	c3 = make([]chan<- int)
	b  = A{X: 23}
	m  map[bool][3]*float64
)

const (
	xx F = iota
	yy   = xx + 3
	zz   = ""
	ww   = "not " + zz
)

type A struct {
	X int `foof`
}
type B interface {
	A
	sad(int) bool
}

type F int

func (a *A) f() bool {
	var z string
	x := "foo"
	a(x)
	y := "bar" + x
	switch z {
	case "xx":
	default:
	}
	select {
	case z := <-c3[0]:
	default:
	}
	for k, v := range m {
		return (!k) && v[0] == nil
	}
	c2 <- A.X
	w := b[4:]
	j := len(x)
	j--
	q := []interface{}{j, 23i, &y}
	g(q...)
	return true
}

func g(vv ...interface{}) {
	ff := func() {}
	defer ff()
	go utf.RuneCount("")
	go utf8.RuneCount(vv.(string))
	if true {
	} else {
	}
Never:
	for i := 0; i < 10; {
		break Never
	}
	_, ok := vv[0].(A)
	if !ok {
		switch x := vv[0].(type) {
		}
		goto Never
	}
}