Debian Codegraph @

gopls/internal/analysis/fillswitch/testdata/src/a/a.go

raw symbols SCIP
1 // Copyright 2020 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 package fillswitch
6
7 import altb "b"
8
9 type typeA int
10
11 const (
12 typeAOne typeA = iota
13 typeATwo
14 typeAThree
15 )
16
17 func doSwitch() {
18 var a typeA
19 switch a { // want `Add cases for typeA`
20 }
21
22 switch a { // want `Add cases for typeA`
23 case typeAOne:
24 }
25
26 switch a {
27 case typeAOne:
28 default:
29 }
30
31 switch a {
32 case typeAOne:
33 case typeATwo:
34 case typeAThree:
35 }
36
37 var b altb.TypeB
38 switch b { // want `Add cases for b.TypeB`
39 case altb.TypeBOne:
40 }
41 }
42
43 type notification interface {
44 isNotification()
45 }
46
47 type notificationOne struct{}
48
49 func (notificationOne) isNotification() {}
50
51 type notificationTwo struct{}
52
53 func (notificationTwo) isNotification() {}
54
55 func doTypeSwitch() {
56 var not notification
57 switch not.(type) { // want `Add cases for notification`
58 }
59
60 switch not.(type) { // want `Add cases for notification`
61 case notificationOne:
62 }
63
64 switch not.(type) {
65 case notificationOne:
66 case notificationTwo:
67 }
68
69 switch not.(type) {
70 default:
71 }
72
73 var t data.ExportedInterface
74 switch t {
75 }
76 }