go.tools/pointer: fix pointer tests (fix build partly)

R=adonovan
CC=golang-dev
https://golang.org/cl/13246052
This commit is contained in:
Robert Griesemer 2013-09-18 11:37:26 -07:00
parent 0e06e5845b
commit a24d794bb1
3 changed files with 5 additions and 4 deletions

View File

@ -68,6 +68,7 @@ func swap(x, y *int) (*int, *int) { // @line swap
func func4() { func func4() {
a := make([]int, 10) // @line func4make a := make([]int, 10) // @line func4make
i, j := 123, 456 // @line f4j i, j := 123, 456 // @line f4j
_ = i
p, q := swap(&a[3], &j) p, q := swap(&a[3], &j)
print(p) // @pointsto j@f4j:5 print(p) // @pointsto j@f4j:5
print(q) // @pointsto makeslice[*]@func4make:11 print(q) // @pointsto makeslice[*]@func4make:11
@ -123,7 +124,7 @@ func func6() {
print(f()) // @pointsto main.a print(f()) // @pointsto main.a
} }
// @calls main.func6 -> func@120.7 // @calls main.func6 -> func@121.7
type I interface { type I interface {
f() f()

View File

@ -78,7 +78,7 @@ func interface3() {
// There should be no backflow of concrete types from the type-switch to x. // There should be no backflow of concrete types from the type-switch to x.
var x interface{} = 0 var x interface{} = 0
print(x) // @types int print(x) // @types int
switch y := x.(type) { switch x.(type) {
case int: case int:
case string: case string:
} }

View File

@ -31,7 +31,7 @@ func maps1() {
// Lookup doesn't create any aliases. // Lookup doesn't create any aliases.
print(m2[&c]) // @pointsto main.a print(m2[&c]) // @pointsto main.a
if m2v, ok := m2[&a]; ok { if _, ok := m2[&a]; ok {
print(m2[&c]) // @pointsto main.a print(m2[&c]) // @pointsto main.a
} }
} }
@ -39,7 +39,7 @@ func maps1() {
func maps2() { func maps2() {
m1 := map[*int]*int{&a: &b} m1 := map[*int]*int{&a: &b}
m2 := map[*int]*int{&b: &c} m2 := map[*int]*int{&b: &c}
m3 := []map[*int]*int{m1, m2} // (no spurious merging of m1, m2) _ = []map[*int]*int{m1, m2} // (no spurious merging of m1, m2)
print(m1[nil]) // @pointsto main.b print(m1[nil]) // @pointsto main.b
print(m2[nil]) // @pointsto main.c print(m2[nil]) // @pointsto main.c