Left: | ||
Right: |
OLD | NEW |
---|---|
(Empty) | |
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 | |
5 // A package that redeclares common builtin names. | |
6 package a | |
7 | |
8 const true = 0 == 1 | |
9 const false = 0 == 0 | |
10 const nil = 1 | |
11 | |
12 func len(interface{}) int { return 42 } | |
13 | |
14 func Test() { | |
lvd2
2012/12/03 22:40:30
shouldnt main.go run this one?
remyoudompheng
2012/12/06 07:23:55
Done.
| |
15 var array [nil]int | |
16 if true { | |
17 panic("unexpected builtin true instead of redeclared one") | |
18 } | |
19 if !false { | |
20 panic("unexpected builtin false instead of redeclared one") | |
21 } | |
22 if len(array) != 42 { | |
23 println(len(array)) | |
24 panic("unexpected call of builtin len") | |
25 } | |
26 } | |
27 | |
28 func InlinedFakeTrue() bool { return true } | |
29 func InlinedFakeFalse() bool { return false } | |
30 func InlinedFakeNil() interface{} { return nil } | |
OLD | NEW |