Russ Cox | 57eb06f | 2012-02-16 23:51:04 -0500 | [diff] [blame] | 1 | // run |
Russ Cox | e780fa8 | 2009-09-09 01:01:39 -0700 | [diff] [blame] | 2 | |
Emmanuel Odeke | 53fd522 | 2016-04-10 14:32:26 -0700 | [diff] [blame] | 3 | // Copyright 2009 The Go Authors. All rights reserved. |
Russ Cox | e780fa8 | 2009-09-09 01:01:39 -0700 | [diff] [blame] | 4 | // Use of this source code is governed by a BSD-style |
| 5 | // license that can be found in the LICENSE file. |
| 6 | |
Rob Pike | 19bab1d | 2012-02-24 10:30:39 +1100 | [diff] [blame] | 7 | // Test that predeclared names can be redeclared by the user. |
| 8 | |
Russ Cox | e780fa8 | 2009-09-09 01:01:39 -0700 | [diff] [blame] | 9 | package main |
| 10 | |
Alan Donovan | 052c942 | 2013-02-12 13:17:49 -0500 | [diff] [blame] | 11 | import ( |
| 12 | "fmt" |
| 13 | "runtime" |
| 14 | ) |
Russ Cox | e780fa8 | 2009-09-09 01:01:39 -0700 | [diff] [blame] | 15 | |
| 16 | func main() { |
| 17 | n := |
Rob Pike | 19bab1d | 2012-02-24 10:30:39 +1100 | [diff] [blame] | 18 | append + |
| 19 | bool + |
Rob Pike | 325cf8e | 2010-03-24 16:46:53 -0700 | [diff] [blame] | 20 | byte + |
Rob Pike | 19bab1d | 2012-02-24 10:30:39 +1100 | [diff] [blame] | 21 | complex + |
| 22 | complex64 + |
| 23 | complex128 + |
| 24 | cap + |
| 25 | close + |
| 26 | delete + |
| 27 | error + |
| 28 | false + |
Rob Pike | 325cf8e | 2010-03-24 16:46:53 -0700 | [diff] [blame] | 29 | float32 + |
| 30 | float64 + |
Rob Pike | 19bab1d | 2012-02-24 10:30:39 +1100 | [diff] [blame] | 31 | imag + |
Rob Pike | 325cf8e | 2010-03-24 16:46:53 -0700 | [diff] [blame] | 32 | int + |
| 33 | int8 + |
| 34 | int16 + |
| 35 | int32 + |
| 36 | int64 + |
Rob Pike | 19bab1d | 2012-02-24 10:30:39 +1100 | [diff] [blame] | 37 | len + |
| 38 | make + |
| 39 | new + |
| 40 | nil + |
| 41 | panic + |
| 42 | print + |
| 43 | println + |
| 44 | real + |
| 45 | recover + |
| 46 | rune + |
| 47 | string + |
| 48 | true + |
Rob Pike | 325cf8e | 2010-03-24 16:46:53 -0700 | [diff] [blame] | 49 | uint + |
| 50 | uint8 + |
| 51 | uint16 + |
| 52 | uint32 + |
| 53 | uint64 + |
| 54 | uintptr + |
Rob Pike | 19bab1d | 2012-02-24 10:30:39 +1100 | [diff] [blame] | 55 | iota |
| 56 | if n != NUM*(NUM-1)/2 { |
| 57 | fmt.Println("BUG: wrong n", n, NUM*(NUM-1)/2) |
Alan Donovan | 052c942 | 2013-02-12 13:17:49 -0500 | [diff] [blame] | 58 | runtime.Breakpoint() // panic is inaccessible |
Russ Cox | e780fa8 | 2009-09-09 01:01:39 -0700 | [diff] [blame] | 59 | } |
| 60 | } |
| 61 | |
| 62 | const ( |
Rob Pike | d45ee4c | 2012-02-24 15:06:32 +1100 | [diff] [blame] | 63 | // 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 Cox | e780fa8 | 2009-09-09 01:01:39 -0700 | [diff] [blame] | 103 | ) |