1// Copyright 2012 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 5package a 6 7type T struct{ A, B int } 8 9type A []int 10 11type M map[int]int 12 13func F1() int { 14 if (T{1, 2}) == (T{3, 4}) { 15 return 1 16 } 17 return 0 18} 19 20func F2() int { 21 if (M{1: 2}) == nil { 22 return 1 23 } 24 return 0 25} 26 27func F3() int { 28 if nil == (A{}) { 29 return 1 30 } 31 return 0 32} 33 34func F4() int { 35 if a := (A{}); a == nil { 36 return 1 37 } 38 return 0 39} 40 41func F5() int { 42 for k, v := range (M{1: 2}) { 43 return v - k 44 } 45 return 0 46} 47 48func F6() int { 49 switch a := (T{1, 1}); a == (T{1, 2}) { 50 default: 51 return 1 52 } 53 return 0 54} 55 56func F7() int { 57 for m := (M{}); len(m) < (T{1, 2}).A; m[1] = (A{1})[0] { 58 return 1 59 } 60 return 0 61} 62 63func F8() int { 64 if a := (&T{1, 1}); a != nil { 65 return 1 66 } 67 return 0 68} 69 70func F9() int { 71 var a *T 72 if a = (&T{1, 1}); a != nil { 73 return 1 74 } 75 return 0 76} 77