1// run 2 3// Copyright 2009 The Go Authors. All rights reserved. 4// Use of this source code is governed by a BSD-style 5// license that can be found in the LICENSE file. 6 7// Test that predeclared names can be redeclared by the user. 8 9package main 10 11import "fmt" 12 13func main() { 14 n := 15 append + 16 bool + 17 byte + 18 complex + 19 complex64 + 20 complex128 + 21 cap + 22 close + 23 delete + 24 error + 25 false + 26 float32 + 27 float64 + 28 imag + 29 int + 30 int8 + 31 int16 + 32 int32 + 33 int64 + 34 len + 35 make + 36 new + 37 nil + 38 panic + 39 print + 40 println + 41 real + 42 recover + 43 rune + 44 string + 45 true + 46 uint + 47 uint8 + 48 uint16 + 49 uint32 + 50 uint64 + 51 uintptr + 52 iota 53 if n != NUM*(NUM-1)/2 { 54 fmt.Println("BUG: wrong n", n, NUM*(NUM-1)/2) 55 } 56} 57 58const ( 59 // cannot use iota here, because iota = 38 below 60 append = 1 61 bool = 2 62 byte = 3 63 complex = 4 64 complex64 = 5 65 complex128 = 6 66 cap = 7 67 close = 8 68 delete = 9 69 error = 10 70 false = 11 71 float32 = 12 72 float64 = 13 73 imag = 14 74 int = 15 75 int8 = 16 76 int16 = 17 77 int32 = 18 78 int64 = 19 79 len = 20 80 make = 21 81 new = 22 82 nil = 23 83 panic = 24 84 print = 25 85 println = 26 86 real = 27 87 recover = 28 88 rune = 29 89 string = 30 90 true = 31 91 uint = 32 92 uint8 = 33 93 uint16 = 34 94 uint32 = 35 95 uint64 = 36 96 uintptr = 37 97 iota = 38 98 NUM = 39 99) 100