blob: 83f184b74dcbd77c84948543a6b6ab60706d7834 [file] [log] [blame]
Russ Cox57eb06f2012-02-16 23:51:04 -05001// run
Russ Coxe780fa82009-09-09 01:01:39 -07002
Emmanuel Odeke53fd5222016-04-10 14:32:26 -07003// Copyright 2009 The Go Authors. All rights reserved.
Russ Coxe780fa82009-09-09 01:01:39 -07004// Use of this source code is governed by a BSD-style
5// license that can be found in the LICENSE file.
6
Rob Pike19bab1d2012-02-24 10:30:39 +11007// Test that predeclared names can be redeclared by the user.
8
Russ Coxe780fa82009-09-09 01:01:39 -07009package main
10
Alan Donovan052c9422013-02-12 13:17:49 -050011import (
12 "fmt"
13 "runtime"
14)
Russ Coxe780fa82009-09-09 01:01:39 -070015
16func main() {
17 n :=
Rob Pike19bab1d2012-02-24 10:30:39 +110018 append +
19 bool +
Rob Pike325cf8e2010-03-24 16:46:53 -070020 byte +
Rob Pike19bab1d2012-02-24 10:30:39 +110021 complex +
22 complex64 +
23 complex128 +
24 cap +
25 close +
26 delete +
27 error +
28 false +
Rob Pike325cf8e2010-03-24 16:46:53 -070029 float32 +
30 float64 +
Rob Pike19bab1d2012-02-24 10:30:39 +110031 imag +
Rob Pike325cf8e2010-03-24 16:46:53 -070032 int +
33 int8 +
34 int16 +
35 int32 +
36 int64 +
Rob Pike19bab1d2012-02-24 10:30:39 +110037 len +
38 make +
39 new +
40 nil +
41 panic +
42 print +
43 println +
44 real +
45 recover +
46 rune +
47 string +
48 true +
Rob Pike325cf8e2010-03-24 16:46:53 -070049 uint +
50 uint8 +
51 uint16 +
52 uint32 +
53 uint64 +
54 uintptr +
Rob Pike19bab1d2012-02-24 10:30:39 +110055 iota
56 if n != NUM*(NUM-1)/2 {
57 fmt.Println("BUG: wrong n", n, NUM*(NUM-1)/2)
Alan Donovan052c9422013-02-12 13:17:49 -050058 runtime.Breakpoint() // panic is inaccessible
Russ Coxe780fa82009-09-09 01:01:39 -070059 }
60}
61
62const (
Rob Piked45ee4c2012-02-24 15:06:32 +110063 // cannot use iota here, because iota = 38 below
64 append = 1
65 bool = 2
66 byte = 3
67 complex = 4
68 complex64 = 5
69 complex128 = 6
70 cap = 7
71 close = 8
72 delete = 9
73 error = 10
74 false = 11
75 float32 = 12
76 float64 = 13
77 imag = 14
78 int = 15
79 int8 = 16
80 int16 = 17
81 int32 = 18
82 int64 = 19
83 len = 20
84 make = 21
85 new = 22
86 nil = 23
87 panic = 24
88 print = 25
89 println = 26
90 real = 27
91 recover = 28
92 rune = 29
93 string = 30
94 true = 31
95 uint = 32
96 uint8 = 33
97 uint16 = 34
98 uint32 = 35
99 uint64 = 36
100 uintptr = 37
101 iota = 38
102 NUM = 39
Russ Coxe780fa82009-09-09 01:01:39 -0700103)