mirror of
https://github.com/golang/go
synced 2024-11-06 22:36:15 -07:00
b76e30ffa0
Implicit local variables for type switches do not appear in the Uses map and do not have objects associated with them. This change associates all of the different types objects for the same local type switch declaration with one another in the declaration. The identifier for the implicit local variable does not have a type but does have declaration objects. Find references for type switch vars will return references to all the identifiers in all of the case clauses and the declaration. Fixes golang/go#32584 Change-Id: I5563a2a48d31ca615c1e4e73b46eabca0f5dd72a Reviewed-on: https://go-review.googlesource.com/c/tools/+/182462 Reviewed-by: Rebecca Stambler <rstambler@golang.org> Run-TryBot: Rebecca Stambler <rstambler@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
16 lines
298 B
Go
16 lines
298 B
Go
package a
|
|
|
|
import "fmt"
|
|
|
|
func TypeStuff() { //@Stuff
|
|
var x string
|
|
|
|
switch y := interface{}(x).(type) { //@mark(switchY, "y"),mark(switchStringY,"y"),godef("y", switchY)
|
|
case int:
|
|
fmt.Printf("%v", y) //@godef("y", switchY)
|
|
case string:
|
|
fmt.Printf("%v", y) //@godef("y", switchStringY)
|
|
}
|
|
|
|
}
|