codekingpro commited on
Commit
f1869bd
·
verified ·
1 Parent(s): 6a64c34

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. go/test/fixedbugs/bug323.go +20 -0
  2. go/test/fixedbugs/bug324.go +10 -0
  3. go/test/fixedbugs/bug325.go +15 -0
  4. go/test/fixedbugs/bug326.go +39 -0
  5. go/test/fixedbugs/bug327.go +24 -0
  6. go/test/fixedbugs/bug328.go +14 -0
  7. go/test/fixedbugs/bug328.out +1 -0
  8. go/test/fixedbugs/bug329.go +46 -0
  9. go/test/fixedbugs/bug330.go +13 -0
  10. go/test/fixedbugs/bug331.go +36 -0
  11. go/test/fixedbugs/bug332.go +17 -0
  12. go/test/fixedbugs/bug333.go +19 -0
  13. go/test/fixedbugs/bug334.go +31 -0
  14. go/test/fixedbugs/bug335.go +9 -0
  15. go/test/fixedbugs/bug336.go +86 -0
  16. go/test/fixedbugs/bug337.go +19 -0
  17. go/test/fixedbugs/bug338.go +22 -0
  18. go/test/fixedbugs/bug339.go +20 -0
  19. go/test/fixedbugs/bug340.go +18 -0
  20. go/test/fixedbugs/bug341.go +22 -0
  21. go/test/fixedbugs/bug342.go +20 -0
  22. go/test/fixedbugs/bug343.go +33 -0
  23. go/test/fixedbugs/bug344.go +24 -0
  24. go/test/fixedbugs/bug345.go +7 -0
  25. go/test/fixedbugs/bug346.go +36 -0
  26. go/test/fixedbugs/bug347.go +49 -0
  27. go/test/fixedbugs/bug348.go +46 -0
  28. go/test/fixedbugs/bug349.go +13 -0
  29. go/test/fixedbugs/bug350.go +15 -0
  30. go/test/fixedbugs/bug351.go +13 -0
  31. go/test/fixedbugs/bug352.go +19 -0
  32. go/test/fixedbugs/bug353.go +30 -0
  33. go/test/fixedbugs/bug354.go +22 -0
  34. go/test/fixedbugs/bug355.go +18 -0
  35. go/test/fixedbugs/bug356.go +41 -0
  36. go/test/fixedbugs/bug357.go +26 -0
  37. go/test/fixedbugs/bug358.go +27 -0
  38. go/test/fixedbugs/bug361.go +15 -0
  39. go/test/fixedbugs/bug362.go +16 -0
  40. go/test/fixedbugs/bug363.go +21 -0
  41. go/test/fixedbugs/bug364.go +31 -0
  42. go/test/fixedbugs/bug365.go +22 -0
  43. go/test/fixedbugs/bug366.go +37 -0
  44. go/test/fixedbugs/bug367.go +10 -0
  45. go/test/fixedbugs/bug368.go +26 -0
  46. go/test/fixedbugs/bug369.go +62 -0
  47. go/test/fixedbugs/bug370.go +18 -0
  48. go/test/fixedbugs/bug371.go +24 -0
  49. go/test/fixedbugs/bug372.go +28 -0
  50. go/test/fixedbugs/bug373.go +32 -0
go/test/fixedbugs/bug323.go ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // errorcheck
2
+
3
+ // Copyright 2011 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
+ package main
8
+
9
+ type T struct{}
10
+ type P *T
11
+
12
+ func (t *T) Meth() {}
13
+ func (t T) Meth2() {}
14
+
15
+ func main() {
16
+ t := &T{}
17
+ p := P(t)
18
+ p.Meth() // ERROR "undefined"
19
+ p.Meth2() // ERROR "undefined"
20
+ }
go/test/fixedbugs/bug324.go ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ // rundir
2
+
3
+ // Copyright 2011 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 case for issue 1550: a type cannot implement an interface
8
+ // from another package with a private method, and type assertions
9
+ // should fail.
10
+ package ignored
go/test/fixedbugs/bug325.go ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // errorcheck
2
+
3
+ // Copyright 2011 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
+ package main
8
+
9
+ import "unsafe"
10
+
11
+ func main() {
12
+ var x unsafe.Pointer
13
+ println(*x) // ERROR "invalid indirect.*unsafe.Pointer|cannot indirect"
14
+ var _ = (unsafe.Pointer)(nil).foo // ERROR "foo"
15
+ }
go/test/fixedbugs/bug326.go ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // errorcheck
2
+
3
+ // Copyright 2011 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
+ package p
8
+
9
+ func f() (_ int, err error) {
10
+ return
11
+ }
12
+
13
+ func g() (x int, _ error) {
14
+ return
15
+ }
16
+
17
+ func h() (_ int, _ error) {
18
+ return
19
+ }
20
+
21
+ func i() (int, error) {
22
+ return // ERROR "not enough return values|not enough arguments to return"
23
+ }
24
+
25
+ func f1() (_ int, err error) {
26
+ return 1, nil
27
+ }
28
+
29
+ func g1() (x int, _ error) {
30
+ return 1, nil
31
+ }
32
+
33
+ func h1() (_ int, _ error) {
34
+ return 1, nil
35
+ }
36
+
37
+ func ii() (int, error) {
38
+ return 1, nil
39
+ }
go/test/fixedbugs/bug327.go ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // run
2
+
3
+ // Copyright 2011 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
+ // Conversion between identical interfaces.
8
+ // Issue 1647.
9
+
10
+ // The compiler used to not realize this was a no-op,
11
+ // so it generated a call to the non-existent function runtime.convE2E.
12
+
13
+ package main
14
+
15
+ type (
16
+ a interface{}
17
+ b interface{}
18
+ )
19
+
20
+ func main() {
21
+ x := a(1)
22
+ z := b(x)
23
+ _ = z
24
+ }
go/test/fixedbugs/bug328.go ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // run
2
+
3
+ // Copyright 2011 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
+ package main
8
+
9
+ import "unsafe"
10
+
11
+ func main() {
12
+ var p unsafe.Pointer
13
+ println(p)
14
+ }
go/test/fixedbugs/bug328.out ADDED
@@ -0,0 +1 @@
 
 
1
+ 0x0
go/test/fixedbugs/bug329.go ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // run
2
+
3
+ // Copyright 2011 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
+ package main
8
+
9
+ type Value struct {
10
+ X interface{}
11
+ Y int
12
+ }
13
+
14
+ type Struct struct {
15
+ X complex128
16
+ }
17
+
18
+ const magic = 1 + 2i
19
+
20
+ func (Value) Complex(x complex128) {
21
+ if x != magic {
22
+ println(x)
23
+ panic("bad complex magic")
24
+ }
25
+ }
26
+
27
+ func f(x *byte, y, z int) complex128 {
28
+ return magic
29
+ }
30
+
31
+ func (Value) Struct(x Struct) {
32
+ if x.X != magic {
33
+ println(x.X)
34
+ panic("bad struct magic")
35
+ }
36
+ }
37
+
38
+ func f1(x *byte, y, z int) Struct {
39
+ return Struct{magic}
40
+ }
41
+
42
+ func main() {
43
+ var v Value
44
+ v.Struct(f1(nil, 0, 0)) // ok
45
+ v.Complex(f(nil, 0, 0)) // used to fail
46
+ }
go/test/fixedbugs/bug330.go ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // errorcheck
2
+
3
+ // Copyright 2011 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
+ package main
8
+
9
+ func main() {
10
+ x := ""
11
+ x = +"hello" // ERROR "invalid operation.*string|expected numeric"
12
+ x = +x // ERROR "invalid operation.*string|expected numeric"
13
+ }
go/test/fixedbugs/bug331.go ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // run
2
+
3
+ // Copyright 2011 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
+ package main
8
+
9
+ import "io"
10
+
11
+ func f() (_ string, x float64, err error) {
12
+ return
13
+ }
14
+
15
+ func g() (_ string, x float64, err error) {
16
+ return "hello", 3.14, io.EOF
17
+ }
18
+
19
+ var _ func() (string, float64, error) = f
20
+ var _ func() (string, float64, error) = g
21
+
22
+ func main() {
23
+ x, y, z := g()
24
+ if x != "hello" || y != 3.14 || z != io.EOF {
25
+ println("wrong", x, len(x), y, z)
26
+ }
27
+ }
28
+
29
+ /*
30
+ issue 1712
31
+
32
+ bug331.go:12: cannot use "hello" (type string) as type float64 in assignment
33
+ bug331.go:12: cannot use 0 (type float64) as type os.Error in assignment:
34
+ float64 does not implement os.Error (missing String method)
35
+ bug331.go:12: error in shape across RETURN
36
+ */
go/test/fixedbugs/bug332.go ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // errorcheck
2
+
3
+ // Copyright 2011 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
+ package main
8
+
9
+ // type T int
10
+
11
+ func main() {}
12
+
13
+ // issue 1474
14
+
15
+ // important: no newline on end of next line.
16
+ // 6g used to print <epoch> instead of bug332.go:111
17
+ func (t *T) F() {} // ERROR "undefined.*T"
go/test/fixedbugs/bug333.go ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // run
2
+
3
+ // Copyright 2011 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
+ // Issue 1709
8
+
9
+ package main
10
+
11
+ func main() {
12
+ type Ts string
13
+ var ts Ts
14
+ _ = []byte(ts)
15
+ }
16
+
17
+ /*
18
+ bug333.go:14: cannot use ts (type Ts) as type string in function argument
19
+ */
go/test/fixedbugs/bug334.go ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // compile
2
+
3
+ // Copyright 2011 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
+ // Issue 1716
8
+
9
+ package main
10
+
11
+ type (
12
+ cplx64 complex64
13
+ cplx128 complex128
14
+ )
15
+
16
+ func (c cplx64) Foo() {}
17
+ func (c cplx128) Foo() {}
18
+
19
+ func main() {
20
+ var c64 cplx128
21
+ var c128 cplx64
22
+ c64.Foo()
23
+ c128.Foo()
24
+ }
25
+
26
+ /*
27
+ bug334.go:16: invalid receiver type cplx64
28
+ bug334.go:17: invalid receiver type cplx128
29
+ bug334.go:22: c64.Foo undefined (type cplx128 has no field or method Foo)
30
+ bug334.go:23: c128.Foo undefined (type cplx64 has no field or method Foo)
31
+ */
go/test/fixedbugs/bug335.go ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ // compiledir
2
+
3
+ // Copyright 2011 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
+ // Issue 1705.
8
+
9
+ package ignored
go/test/fixedbugs/bug336.go ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // run
2
+
3
+ // Copyright 2011 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
+ package main
8
+
9
+ type T1 struct {
10
+ Next *T2
11
+ }
12
+
13
+ type T2 T1
14
+
15
+ type T3 struct {
16
+ Next *T4
17
+ }
18
+
19
+ type T4 T5
20
+ type T5 T6
21
+ type T6 T7
22
+ type T7 T8
23
+ type T8 T9
24
+ type T9 T3
25
+
26
+ type T10 struct {
27
+ x struct {
28
+ y ***struct {
29
+ z *struct {
30
+ Next *T11
31
+ }
32
+ }
33
+ }
34
+ }
35
+
36
+ type T11 T10
37
+
38
+ type T12 struct {
39
+ F1 *T15
40
+ F2 *T13
41
+ F3 *T16
42
+ }
43
+
44
+ type T13 T14
45
+ type T14 T15
46
+ type T15 T16
47
+ type T16 T17
48
+ type T17 T12
49
+
50
+ // issue 1672
51
+ type T18 *[10]T19
52
+ type T19 T18
53
+
54
+ func main() {
55
+ _ = &T1{&T2{}}
56
+ _ = &T2{&T2{}}
57
+ _ = &T3{&T4{}}
58
+ _ = &T4{&T4{}}
59
+ _ = &T5{&T4{}}
60
+ _ = &T6{&T4{}}
61
+ _ = &T7{&T4{}}
62
+ _ = &T8{&T4{}}
63
+ _ = &T9{&T4{}}
64
+ _ = &T12{&T15{}, &T13{}, &T16{}}
65
+
66
+ var (
67
+ tn struct{ Next *T11 }
68
+ tz struct{ z *struct{ Next *T11 } }
69
+ tpz *struct{ z *struct{ Next *T11 } }
70
+ tppz **struct{ z *struct{ Next *T11 } }
71
+ tpppz ***struct{ z *struct{ Next *T11 } }
72
+ ty struct {
73
+ y ***struct{ z *struct{ Next *T11 } }
74
+ }
75
+ )
76
+ tn.Next = &T11{}
77
+ tz.z = &tn
78
+ tpz = &tz
79
+ tppz = &tpz
80
+ tpppz = &tppz
81
+ ty.y = tpppz
82
+ _ = &T10{ty}
83
+
84
+ t19s := &[10]T19{}
85
+ _ = T18(t19s)
86
+ }
go/test/fixedbugs/bug337.go ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // errorcheck
2
+
3
+ // Copyright 2011 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
+ // Issue 1722.
8
+
9
+ // Check that the error messages says
10
+ // bug337.go:16: len("foo") not used
11
+ // and not
12
+ // bug337.go:16: 3 not used
13
+
14
+ package main
15
+
16
+ func main() {
17
+ len("foo") // ERROR "len|value computed is not used"
18
+ }
19
+
go/test/fixedbugs/bug338.go ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // compile
2
+
3
+ // Copyright 2011 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
+ // Issue 1787.
8
+
9
+ package main
10
+
11
+ import "unsafe"
12
+
13
+ const x = unsafe.Sizeof([8]byte{})
14
+
15
+ func main() {
16
+ var b [x]int
17
+ _ = b
18
+ }
19
+
20
+ /*
21
+ bug338.go:14: array bound must be non-negative
22
+ */
go/test/fixedbugs/bug339.go ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // run
2
+
3
+ // Copyright 2011 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
+ // Issue 1608.
8
+ // Size used to be -1000000000.
9
+
10
+ package main
11
+
12
+ import "unsafe"
13
+
14
+ func main() {
15
+ var a interface{} = 0
16
+ size := unsafe.Sizeof(a)
17
+ if size != 2*unsafe.Sizeof((*int)(nil)) {
18
+ println("wrong size: ", size)
19
+ }
20
+ }
go/test/fixedbugs/bug340.go ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // errorcheck
2
+
3
+ // Copyright 2011 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
+ // Issue 1606.
8
+
9
+ package main
10
+
11
+ func main() {
12
+ var x interface{}
13
+ switch t := x.(type) {
14
+ case 0: // ERROR "type"
15
+ t.x = 1
16
+ x.x = 1 // ERROR "type interface \{\}|reference to undefined field or method|interface with no methods|undefined"
17
+ }
18
+ }
go/test/fixedbugs/bug341.go ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // run
2
+
3
+ // Copyright 2011 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
+ // Used to panic because 8g was generating incorrect
8
+ // code for converting a negative float to a uint64.
9
+
10
+ package main
11
+
12
+ func main() {
13
+ var x float32 = -2.5
14
+
15
+ _ = uint64(x)
16
+ _ = float32(0)
17
+ }
18
+ /*
19
+ panic: runtime error: floating point error
20
+
21
+ [signal 0x8 code=0x6 addr=0x8048c64 pc=0x8048c64]
22
+ */
go/test/fixedbugs/bug342.go ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // errorcheck
2
+
3
+ // Copyright 2011 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
+ // Issue 1871.
8
+
9
+ package p
10
+
11
+ type a interface {
12
+ foo(x int) (x int) // ERROR "duplicate argument|redefinition|redeclared"
13
+ }
14
+
15
+ /*
16
+ Previously:
17
+
18
+ bug.go:1 x redclared in this block
19
+ previous declaration at bug.go:1
20
+ */
go/test/fixedbugs/bug343.go ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // run
2
+
3
+ // Copyright 2011 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
+ // issue 1900
8
+
9
+ package main
10
+
11
+ func getArgs(data map[string]interface{}, keys ...string) map[string]string {
12
+ ret := map[string]string{}
13
+ var ok bool
14
+ for _, k := range keys {
15
+ ret[k], ok = data[k].(string)
16
+ if !ok {}
17
+ }
18
+ return ret
19
+ }
20
+
21
+ func main() {
22
+ x := getArgs(map[string]interface{}{"x":"y"}, "x")
23
+ if x["x"] != "y" {
24
+ println("BUG bug343", x)
25
+ }
26
+ }
27
+
28
+
29
+ /*
30
+ typecheck [1008592b0]
31
+ . INDREG a(1) l(15) x(24) tc(2) runtime.ret G0 string
32
+ bug343.go:15: internal compiler error: typecheck INDREG
33
+ */
go/test/fixedbugs/bug344.go ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // errorcheck
2
+
3
+ // Copyright 2011 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
+ package main
8
+
9
+ import "fmt"
10
+
11
+ func main() {
12
+ // invalid use of goto.
13
+ // do whatever you like, just don't crash.
14
+ i := 42
15
+ a := []*int{&i, &i, &i, &i}
16
+ x := a[0]
17
+ goto start // ERROR "jumps into block"
18
+ z := 1
19
+ _ = z
20
+ for _, x = range a { // GCCGO_ERROR "block"
21
+ start:
22
+ fmt.Sprint(*x)
23
+ }
24
+ }
go/test/fixedbugs/bug345.go ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ // errorcheckdir
2
+
3
+ // Copyright 2011 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
+ package ignored
go/test/fixedbugs/bug346.go ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // run
2
+
3
+ // Copyright 2011 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
+ package main
8
+
9
+ import "os"
10
+
11
+ func main() {
12
+ // Test unclosed closure.
13
+ {
14
+ x := 4
15
+ a, b, c, d := func(i int) (p int, q int, r int, s int) { return 1, i, 3, x }(2)
16
+
17
+ if a != 1 || b != 2 || c != 3 || d != 4 {
18
+ println("1# abcd: expected 1 2 3 4 got", a, b, c, d)
19
+ os.Exit(1)
20
+ }
21
+ }
22
+ // Test real closure.
23
+ {
24
+ x := 4
25
+ gf = func(i int) (p int, q int, r int, s int) { return 1, i, 3, x }
26
+
27
+ a, b, c, d := gf(2)
28
+
29
+ if a != 1 || b != 2 || c != 3 || d != 4 {
30
+ println("2# abcd: expected 1 2 3 4 got", a, b, c, d)
31
+ os.Exit(1)
32
+ }
33
+ }
34
+ }
35
+
36
+ var gf func(int) (int, int, int, int)
go/test/fixedbugs/bug347.go ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // run
2
+
3
+ // Copyright 2011 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
+ package main
8
+
9
+ import (
10
+ "runtime"
11
+ "strings"
12
+ )
13
+
14
+ var t *struct {
15
+ c chan int
16
+ }
17
+
18
+ var c chan int
19
+
20
+ func f() {
21
+ select {
22
+ case <-t.c: // THIS IS LINE 22
23
+ break
24
+ case <-c:
25
+ break
26
+ }
27
+ }
28
+
29
+ func main() {
30
+ defer func() {
31
+ recover()
32
+ for i := 0;; i++ {
33
+ pc, file, line, ok := runtime.Caller(i)
34
+ if !ok {
35
+ print("BUG: bug347: cannot find caller\n")
36
+ return
37
+ }
38
+ if !strings.Contains(file, "bug347.go") || runtime.FuncForPC(pc).Name() != "main.f" {
39
+ // walk past runtime frames
40
+ continue
41
+ }
42
+ if line != 22 {
43
+ print("BUG: bug347: panic at ", file, ":", line, " in ", runtime.FuncForPC(pc).Name(), "\n")
44
+ }
45
+ return
46
+ }
47
+ }()
48
+ f()
49
+ }
go/test/fixedbugs/bug348.go ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // run
2
+
3
+ // Copyright 2011 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
+ package main
8
+
9
+ import (
10
+ "runtime"
11
+ "strings"
12
+ )
13
+
14
+ func f() {
15
+ var x *string
16
+
17
+ for _, i := range *x { // THIS IS LINE 17
18
+ println(i)
19
+ }
20
+ }
21
+
22
+ func g() {
23
+ }
24
+
25
+ func main() {
26
+ defer func() {
27
+ for i := 0;; i++ {
28
+ pc, file, line, ok := runtime.Caller(i)
29
+ if !ok {
30
+ print("BUG: bug348: cannot find caller\n")
31
+ return
32
+ }
33
+ if !strings.Contains(file, "bug348.go") || runtime.FuncForPC(pc).Name() != "main.f" {
34
+ // walk past runtime frames
35
+ continue
36
+ }
37
+ if line != 17 {
38
+ print("BUG: bug348: panic at ", file, ":", line, " in ", runtime.FuncForPC(pc).Name(), "\n")
39
+ return
40
+ }
41
+ recover()
42
+ return
43
+ }
44
+ }()
45
+ f()
46
+ }
go/test/fixedbugs/bug349.go ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // errorcheck
2
+
3
+ // Copyright 2011 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
+ // issue 1192 - detail in error
8
+
9
+ package main
10
+
11
+ func foo() (a, b, c int) {
12
+ return 0, 1 2.01 // ERROR "unexpected literal 2.01|expected ';' or '}' or newline|not enough arguments to return"
13
+ }
go/test/fixedbugs/bug350.go ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // errorcheck
2
+
3
+ // Copyright 2011 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
+ package main
8
+
9
+ type T int
10
+
11
+ func (T) m() {} // GCCGO_ERROR "previous"
12
+ func (T) m() {} // ERROR "T\.m already declared|redefinition"
13
+
14
+ func (*T) p() {} // GCCGO_ERROR "previous"
15
+ func (*T) p() {} // ERROR "T\.p already declared|redefinition"
go/test/fixedbugs/bug351.go ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // errorcheck
2
+
3
+ // Copyright 2011 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
+ package main
8
+
9
+ var x int
10
+
11
+ func main() {
12
+ (x) := 0 // ERROR "non-name [(]x[)]|non-name on left side"
13
+ }
go/test/fixedbugs/bug352.go ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // run
2
+
3
+ // Copyright 2011 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
+ package main
8
+
9
+ var x [10][0]byte
10
+ var y = make([]struct{}, 10)
11
+
12
+ func main() {
13
+ if &x[1] != &x[2] {
14
+ println("BUG: bug352 [0]byte")
15
+ }
16
+ if &y[1] != &y[2] {
17
+ println("BUG: bug352 struct{}")
18
+ }
19
+ }
go/test/fixedbugs/bug353.go ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // errorcheck
2
+
3
+ // Copyright 2011 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
+ // issue 2089 - internal compiler error
8
+
9
+ package main
10
+
11
+ import (
12
+ "io"
13
+ "os"
14
+ )
15
+
16
+ func echo(fd io.ReadWriterCloser) { // ERROR "undefined.*io.ReadWriterCloser"
17
+ var buf [1024]byte
18
+ for {
19
+ n, err := fd.Read(buf)
20
+ if err != nil {
21
+ break
22
+ }
23
+ fd.Write(buf[0:n])
24
+ }
25
+ }
26
+
27
+ func main() {
28
+ fd, _ := os.Open("a.txt")
29
+ echo(fd)
30
+ }
go/test/fixedbugs/bug354.go ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // compile
2
+
3
+ // Copyright 2011 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
+ // issue 2086
8
+ // was calling makeclosure twice on the closure
9
+
10
+ package bug354
11
+
12
+ type Inner struct {
13
+ F func() error
14
+ }
15
+
16
+ type Outer struct {
17
+ Inners []Inner
18
+ }
19
+
20
+ // calls makeclosure twice on same closure
21
+
22
+ var Foo = Outer{[]Inner{Inner{func() error { return nil }}}}
go/test/fixedbugs/bug355.go ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // run
2
+
3
+ // Copyright 2011 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
+ package main
8
+
9
+ var f = func() int {
10
+ type S int
11
+ return 42
12
+ }
13
+
14
+ func main() {
15
+ if f() != 42 {
16
+ panic("BUG: bug355")
17
+ }
18
+ }
go/test/fixedbugs/bug356.go ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // run
2
+
3
+ // Copyright 2011 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
+ // issue 1808
8
+
9
+ package main
10
+
11
+ func main() {
12
+ var i uint64
13
+ var x int = 12345
14
+
15
+ if y := x << (i&5); y != 12345<<0 {
16
+ println("BUG bug344", y)
17
+ return
18
+ }
19
+
20
+ i++
21
+ if y := x << (i&5); y != 12345<<1 {
22
+ println("BUG bug344a", y)
23
+ }
24
+
25
+ i = 70
26
+ if y := x << i; y != 0 {
27
+ println("BUG bug344b", y)
28
+ }
29
+
30
+ i = 1<<32
31
+ if y := x << i; y != 0 {
32
+ println("BUG bug344c", y)
33
+ }
34
+ }
35
+
36
+
37
+ /*
38
+ typecheck [1008592b0]
39
+ . INDREG a(1) l(15) x(24) tc(2) runtime.ret G0 string
40
+ bug343.go:15: internal compiler error: typecheck INDREG
41
+ */
go/test/fixedbugs/bug357.go ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // errorcheck
2
+
3
+ // Copyright 2011 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
+ // issue 1993.
8
+ // error used to have last line number in file
9
+
10
+ package main
11
+
12
+ func bla1() bool {
13
+ return false
14
+ }
15
+
16
+ func bla5() bool {
17
+ _ = 1
18
+ false // ERROR "false evaluated but not used|value computed is not used|is not used"
19
+ _ = 2
20
+ return false
21
+ }
22
+
23
+ func main() {
24
+ x := bla1()
25
+ _ = x
26
+ }
go/test/fixedbugs/bug358.go ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // errorcheck -d=panic
2
+
3
+ // Copyright 2011 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
+ // issue 1979
8
+ // used to get internal compiler error too
9
+
10
+ package main
11
+
12
+ import (
13
+ // avoid imported and not used errors
14
+ // "io/ioutil"
15
+ "net/http"
16
+ // "os"
17
+ )
18
+
19
+ func makeHandler(fn func(http.ResponseWriter, *http.Request, string)) http.HandlerFunc {
20
+ return func(w http.ResponseWriter, r *http.Request) // ERROR "syntax error|not an expression|invalid use of type"
21
+ }
22
+
23
+ type Page struct {
24
+ Title string
25
+ Body []byte
26
+ }
27
+
go/test/fixedbugs/bug361.go ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // compile
2
+
3
+ // Copyright 2011 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
+ // issue 1908
8
+ // unreasonable width used to be internal fatal error
9
+
10
+ package test
11
+
12
+ func main() {
13
+ buf := [1<<30]byte{}
14
+ _ = buf[:]
15
+ }
go/test/fixedbugs/bug362.go ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // errorcheck
2
+
3
+ // Copyright 2011 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
+ // issue 1662
8
+ // iota inside var
9
+
10
+ package main
11
+
12
+ var (
13
+ a = iota // ERROR "undefined: iota|iota is only defined in const|cannot use iota outside constant declaration"
14
+ b = iota // ERROR "undefined: iota|iota is only defined in const|cannot use iota outside constant declaration"
15
+ c = iota // ERROR "undefined: iota|iota is only defined in const|cannot use iota outside constant declaration"
16
+ )
go/test/fixedbugs/bug363.go ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // errorcheck
2
+
3
+ // Copyright 2011 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
+ // issue 1664
8
+
9
+ package main
10
+
11
+ func main() {
12
+ var i uint = 33
13
+ var a = (1<<i) + 4.5 // ERROR "shift of type float64|invalid.*shift"
14
+ println(a)
15
+
16
+ var b = (1<<i) + 4.0 // ERROR "shift of type float64|invalid.*shift"
17
+ println(b)
18
+
19
+ var c int64 = (1<<i) + 4.0 // ok - it's all int64
20
+ println(c)
21
+ }
go/test/fixedbugs/bug364.go ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // run
2
+
3
+ // Copyright 2011 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
+ package main
8
+
9
+ import "fmt"
10
+
11
+ var s string
12
+
13
+ func accum(args ...interface{}) {
14
+ s += fmt.Sprintln(args...)
15
+ }
16
+
17
+ func f(){
18
+ v := 0.0
19
+ for i := 0; i < 3; i++ {
20
+ v += 0.1
21
+ defer accum(v)
22
+ }
23
+ }
24
+
25
+ func main() {
26
+ f()
27
+ if s != "0.30000000000000004\n0.2\n0.1\n" {
28
+ println("BUG: defer")
29
+ print(s)
30
+ }
31
+ }
go/test/fixedbugs/bug365.go ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // errorcheck
2
+
3
+ // Copyright 2011 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
+ // check that compiler doesn't stop reading struct def
8
+ // after first unknown type.
9
+
10
+ // Fixes issue 2110.
11
+
12
+ package main
13
+
14
+ type S struct {
15
+ err foo.Bar // ERROR "undefined|expected package"
16
+ Num int
17
+ }
18
+
19
+ func main() {
20
+ s := S{}
21
+ _ = s.Num // no error here please
22
+ }
go/test/fixedbugs/bug366.go ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // run
2
+
3
+ // Copyright 2011 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
+ // Issue 2206. Incorrect sign extension of div arguments.
8
+
9
+ package main
10
+
11
+ func five(x int64) {
12
+ if x != 5 {
13
+ panic(x)
14
+ }
15
+ }
16
+
17
+ func main() {
18
+ // 5
19
+ five(int64(5 / (5 / 3)))
20
+
21
+ // 5
22
+ five(int64(byte(5) / (byte(5) / byte(3))))
23
+
24
+ // 5
25
+ var a, b byte = 5, 3
26
+ five(int64(a / (a / b)))
27
+
28
+ // integer divide by zero in golang.org sandbox
29
+ // 0 on windows/amd64
30
+ x := [3]byte{2, 3, 5}
31
+ five(int64(x[2] / (x[2] / x[1])))
32
+
33
+ // integer divide by zero in golang.org sandbox
34
+ // crash on windows/amd64
35
+ y := x[1:3]
36
+ five(int64(y[1] / (y[1] / y[0])))
37
+ }
go/test/fixedbugs/bug367.go ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ // rundir
2
+
3
+ // Copyright 2011 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
+ // Issue 1536: bug when handling imported interfaces with
8
+ // private methods.
9
+
10
+ package ignored
go/test/fixedbugs/bug368.go ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // run
2
+
3
+ // Copyright 2011 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
+ package main
8
+
9
+ // 5g bug used to set up the 0 for -f() before calling f,
10
+ // and the call to f smashed the register.
11
+
12
+ func f(n int) int {
13
+ s := 0
14
+ for i := 0; i < n; i++ {
15
+ s += i>>1
16
+ }
17
+ return s
18
+ }
19
+
20
+ func main() {
21
+ x := -f(100)
22
+ if x != -2450 {
23
+ println(x)
24
+ panic("broken")
25
+ }
26
+ }
go/test/fixedbugs/bug369.go ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // run
2
+
3
+ //go:build !nacl && !js && !wasip1 && gc
4
+
5
+ // Copyright 2011 The Go Authors. All rights reserved.
6
+ // Use of this source code is governed by a BSD-style
7
+ // license that can be found in the LICENSE file.
8
+
9
+ // Test that compiling with optimization turned on produces faster code.
10
+
11
+ package main
12
+
13
+ import (
14
+ "fmt"
15
+ "io/ioutil"
16
+ "os"
17
+ "os/exec"
18
+ "path/filepath"
19
+ )
20
+
21
+ func main() {
22
+ err := os.Chdir(filepath.Join(".", "fixedbugs", "bug369.dir"))
23
+ check(err)
24
+
25
+ tmpDir, err := ioutil.TempDir("", "bug369")
26
+ check(err)
27
+ defer os.RemoveAll(tmpDir)
28
+
29
+ tmp := func(name string) string {
30
+ return filepath.Join(tmpDir, name)
31
+ }
32
+
33
+ check(os.Mkdir(tmp("test"), 0777))
34
+
35
+ stdlibimportcfg, err := os.ReadFile(os.Getenv("STDLIB_IMPORTCFG"))
36
+ check(err)
37
+ importcfg := string(stdlibimportcfg) + "\npackagefile test/slow=" + tmp("test/slow.o") + "\npackagefile test/fast=" + tmp("test/fast.o")
38
+ os.WriteFile(tmp("importcfg"), []byte(importcfg), 0644)
39
+
40
+ run("go", "tool", "compile", "-importcfg="+tmp("importcfg"), "-p=test/slow", "-N", "-o", tmp("test/slow.o"), "pkg.go")
41
+ run("go", "tool", "compile", "-importcfg="+tmp("importcfg"), "-p=test/fast", "-o", tmp("test/fast.o"), "pkg.go")
42
+ run("go", "tool", "compile", "-importcfg="+tmp("importcfg"), "-p=main", "-D", "test", "-o", tmp("main.o"), "main.go")
43
+ run("go", "tool", "link", "-importcfg="+tmp("importcfg"), "-o", tmp("a.exe"), tmp("main.o"))
44
+ run(tmp("a.exe"))
45
+ }
46
+
47
+ func run(name string, args ...string) {
48
+ cmd := exec.Command(name, args...)
49
+ out, err := cmd.CombinedOutput()
50
+ if err != nil {
51
+ fmt.Println(string(out))
52
+ fmt.Println(err)
53
+ os.Exit(1)
54
+ }
55
+ }
56
+
57
+ func check(err error) {
58
+ if err != nil {
59
+ fmt.Println(err)
60
+ os.Exit(1)
61
+ }
62
+ }
go/test/fixedbugs/bug370.go ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // run
2
+
3
+ // Copyright 2011 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
+ package main
8
+
9
+ // issue 2337
10
+ // The program deadlocked.
11
+
12
+ import "runtime"
13
+
14
+ func main() {
15
+ runtime.GOMAXPROCS(2)
16
+ runtime.GC()
17
+ runtime.GOMAXPROCS(1)
18
+ }
go/test/fixedbugs/bug371.go ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // errorcheck
2
+
3
+ // Copyright 2011 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
+ // issue 2343
8
+
9
+ package main
10
+
11
+ type T struct{}
12
+
13
+ func (t *T) pm() {}
14
+ func (t T) m() {}
15
+
16
+ func main() {
17
+ p := &T{}
18
+ p.pm()
19
+ p.m()
20
+
21
+ q := &p
22
+ q.m() // ERROR "requires explicit dereference|undefined"
23
+ q.pm() // ERROR "requires explicit dereference|undefined"
24
+ }
go/test/fixedbugs/bug372.go ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // run
2
+
3
+ // Copyright 2011 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
+ // Issue 2355
8
+ package main
9
+
10
+ type T struct {}
11
+ func (T) m() string { return "T" }
12
+
13
+ type TT struct {
14
+ T
15
+ m func() string
16
+ }
17
+
18
+
19
+ func ff() string { return "ff" }
20
+
21
+ func main() {
22
+ var tt TT
23
+ tt.m = ff
24
+
25
+ if tt.m() != "ff" {
26
+ println(tt.m(), "!= \"ff\"")
27
+ }
28
+ }
go/test/fixedbugs/bug373.go ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // errorcheck
2
+
3
+ // Copyright 2011 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
+ // Issue 873, 2162
8
+
9
+ package foo
10
+
11
+ func f(x interface{}) {
12
+ switch t := x.(type) { // ERROR "declared and not used"
13
+ case int:
14
+ }
15
+ }
16
+
17
+ func g(x interface{}) {
18
+ switch t := x.(type) {
19
+ case int:
20
+ case float32:
21
+ println(t)
22
+ }
23
+ }
24
+
25
+ func h(x interface{}) {
26
+ switch t := x.(type) {
27
+ case int:
28
+ case float32:
29
+ default:
30
+ println(t)
31
+ }
32
+ }