From a24d794bb190590e19874cc53f922ddf435a5efd Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Wed, 18 Sep 2013 11:37:26 -0700 Subject: [PATCH] go.tools/pointer: fix pointer tests (fix build partly) R=adonovan CC=golang-dev https://golang.org/cl/13246052 --- pointer/testdata/func.go | 3 ++- pointer/testdata/interfaces.go | 2 +- pointer/testdata/maps.go | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pointer/testdata/func.go b/pointer/testdata/func.go index ec8883ba..7db652d6 100644 --- a/pointer/testdata/func.go +++ b/pointer/testdata/func.go @@ -68,6 +68,7 @@ func swap(x, y *int) (*int, *int) { // @line swap func func4() { a := make([]int, 10) // @line func4make i, j := 123, 456 // @line f4j + _ = i p, q := swap(&a[3], &j) print(p) // @pointsto j@f4j:5 print(q) // @pointsto makeslice[*]@func4make:11 @@ -123,7 +124,7 @@ func func6() { print(f()) // @pointsto main.a } -// @calls main.func6 -> func@120.7 +// @calls main.func6 -> func@121.7 type I interface { f() diff --git a/pointer/testdata/interfaces.go b/pointer/testdata/interfaces.go index ef24c67b..60c238aa 100644 --- a/pointer/testdata/interfaces.go +++ b/pointer/testdata/interfaces.go @@ -78,7 +78,7 @@ func interface3() { // There should be no backflow of concrete types from the type-switch to x. var x interface{} = 0 print(x) // @types int - switch y := x.(type) { + switch x.(type) { case int: case string: } diff --git a/pointer/testdata/maps.go b/pointer/testdata/maps.go index 695b698a..6f3751d7 100644 --- a/pointer/testdata/maps.go +++ b/pointer/testdata/maps.go @@ -31,7 +31,7 @@ func maps1() { // Lookup doesn't create any aliases. print(m2[&c]) // @pointsto main.a - if m2v, ok := m2[&a]; ok { + if _, ok := m2[&a]; ok { print(m2[&c]) // @pointsto main.a } } @@ -39,7 +39,7 @@ func maps1() { func maps2() { m1 := map[*int]*int{&a: &b} 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(m2[nil]) // @pointsto main.c