diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/bench/timing.log | 170 | ||||
| -rw-r--r-- | test/convert.go | 2 | ||||
| -rw-r--r-- | test/fixedbugs/bug177.go | 2 | ||||
| -rw-r--r-- | test/fixedbugs/bug248.dir/bug2.go | 4 | ||||
| -rw-r--r-- | test/fixedbugs/bug324.dir/main.go (renamed from test/bugs/bug324.dir/main.go) | 7 | ||||
| -rw-r--r-- | test/fixedbugs/bug324.dir/p.go (renamed from test/bugs/bug324.dir/p.go) | 0 | ||||
| -rw-r--r-- | test/fixedbugs/bug324.go (renamed from test/bugs/bug324.go) | 2 | ||||
| -rw-r--r-- | test/fixedbugs/bug328.go | 14 | ||||
| -rw-r--r-- | test/fixedbugs/bug329.go | 46 | ||||
| -rw-r--r-- | test/fixedbugs/bug330.go | 13 | ||||
| -rw-r--r-- | test/fixedbugs/bug331.go | 36 | ||||
| -rw-r--r-- | test/fixedbugs/bug332.go | 17 | ||||
| -rw-r--r-- | test/fixedbugs/bug333.go | 19 | ||||
| -rw-r--r-- | test/fixedbugs/bug334.go | 31 | ||||
| -rw-r--r-- | test/fixedbugs/bug335.dir/a.go | 9 | ||||
| -rw-r--r-- | test/fixedbugs/bug335.dir/b.go | 11 | ||||
| -rw-r--r-- | test/fixedbugs/bug335.go | 10 | ||||
| -rw-r--r-- | test/fixedbugs/bug336.go | 86 | ||||
| -rw-r--r-- | test/func7.go | 29 | ||||
| -rw-r--r-- | test/golden.out | 8 | ||||
| -rw-r--r-- | test/interface/fake.go | 2 | ||||
| -rw-r--r-- | test/interface/pointer.go | 1 | ||||
| -rw-r--r-- | test/ken/cplx3.go | 2 | ||||
| -rw-r--r-- | test/method2.go | 10 |
24 files changed, 516 insertions, 15 deletions
diff --git a/test/bench/timing.log b/test/bench/timing.log index a967f27d2..c658fa098 100644 --- a/test/bench/timing.log +++ b/test/bench/timing.log @@ -674,3 +674,173 @@ threadring 50000000 gcc -O2 threadring.c 30.50u 258.05s 325.72r gccgo -O2 threadring.go 92.87u 748.39s 728.46r gc threadring 38.03u 0.01s 38.04r + +# Apr 15, 2011 +# Move to new machine, Intel Xeon E5520@2.27GHz. +# (Was Opteron(tm) Processor 8214 HE) + +fasta -n 25000000 +OLD: + gcc -O2 fasta.c 3.39u 0.04s 3.42r + gccgo -O2 fasta.go 3.52u 0.00s 3.52r + gc fasta 3.63u 0.04s 3.67r + gc_B fasta 3.66u 0.00s 3.66r +NEW: + gcc -O2 fasta.c 1.45u 0.02s 1.47r + gccgo -O2 fasta.go 1.51u 0.01s 1.51r + gc fasta 2.04u 0.00s 2.04r + gc_B fasta 2.05u 0.00s 2.04r + +reverse-complement < output-of-fasta-25000000 +OLD: + gcc -O2 reverse-complement.c 1.87u 1.51s 7.02r + gccgo -O2 reverse-complement.go 1.56u 0.54s 3.37r + gc reverse-complement 1.73u 0.36s 2.08r + gc_B reverse-complement 1.75u 0.37s 2.12r +NEW: + gcc -O2 reverse-complement.c 1.20u 0.47s 12.96r + gccgo -O2 reverse-complement.go 0.88u 0.14s 1.01r + gc reverse-complement 1.13u 0.17s 1.30r + gc_B reverse-complement 1.11u 0.09s 1.20r + +nbody -n 50000000 +OLD: + gcc -O2 -lm nbody.c 21.90u 0.00s 21.92r + gccgo -O2 nbody.go 23.12u 0.03s 23.19r + gc nbody 29.07u 0.00s 29.07r + gc_B nbody 31.84u 0.00s 31.85r +NEW: + gcc -O2 -lm nbody.c 13.01u 0.00s 13.03r + gccgo -O2 nbody.go 13.35u 0.00s 13.37r + gc nbody 21.78u 0.00s 21.82r + gc_B nbody 21.72u 0.00s 21.76r + +binary-tree 15 # too slow to use 20 +OLD: + gcc -O2 binary-tree.c -lm 0.83u 0.02s 0.84r + gccgo -O2 binary-tree.go 2.61u 0.02s 2.62r + gccgo -O2 binary-tree-freelist.go 0.32u 0.01s 0.32r + gc binary-tree 3.93u 0.04s 3.97r + gc binary-tree-freelist 0.47u 0.03s 0.50r +NEW: + gcc -O2 binary-tree.c -lm 0.60u 0.00s 0.59r + gccgo -O2 binary-tree.go 1.53u 0.00s 1.52r + gccgo -O2 binary-tree-freelist.go 0.01u 0.00s 0.00r + gc binary-tree 1.93u 0.02s 1.95r + gc binary-tree-freelist 0.32u 0.01s 0.32r + +fannkuch 12 +OLD: + gcc -O2 fannkuch.c 57.64u 0.00s 57.64r + gccgo -O2 fannkuch.go 65.56u 0.01s 65.65r + gccgo -O2 fannkuch-parallel.go 179.12u 0.00s 49.82r + gc fannkuch 126.39u 0.00s 126.39r + gc fannkuch-parallel 172.49u 0.02s 45.44r + gc_B fannkuch 89.30u 0.00s 89.28r +NEW: + gcc -O2 fannkuch.c 45.17u 0.00s 45.26r + gccgo -O2 fannkuch.go 53.63u 0.00s 53.73r + gccgo -O2 fannkuch-parallel.go 216.72u 0.00s 58.42r + gc fannkuch 108.21u 0.00s 108.44r + gc fannkuch-parallel 227.20u 0.00s 57.27r + gc_B fannkuch 56.14u 0.00s 56.26r + +regex-dna 100000 +OLD: + gcc -O2 regex-dna.c -lpcre 0.77u 0.01s 0.78r + gccgo -O2 regex-dna.go 10.15u 0.02s 10.23r + gccgo -O2 regex-dna-parallel.go 33.81u 3.22s 11.62r + gc regex-dna 6.52u 0.04s 6.56r + gc regex-dna-parallel 6.84u 0.03s 2.70r + gc_B regex-dna 6.83u 0.01s 6.84r +NEW: + gcc -O2 regex-dna.c -lpcre 0.47u 0.00s 0.47r + gccgo -O2 regex-dna.go 6.00u 0.00s 6.00r + gccgo -O2 regex-dna-parallel.go 44.54u 1.57s 6.51r + gc regex-dna 5.41u 0.01s 5.42r + gc regex-dna-parallel 5.62u 0.01s 2.20r + gc_B regex-dna 5.50u 0.00s 5.50r + +spectral-norm 5500 +OLD: + gcc -O2 spectral-norm.c -lm 12.29u 0.00s 12.28r + gccgo -O2 spectral-norm.go 11.56u 0.00s 11.55r + gc spectral-norm 23.98u 0.00s 24.00r + gc_B spectral-norm 24.62u 0.00s 24.65r +NEW: + gcc -O2 spectral-norm.c -lm 15.79u 0.00s 15.82r + gccgo -O2 spectral-norm.go 15.32u 0.00s 15.35r + gc spectral-norm 19.62u 0.01s 19.67r + gc_B spectral-norm 19.62u 0.00s 19.66r + +k-nucleotide 1000000 +OLD: + gcc -O2 k-nucleotide.c 9.82u 0.06s 9.87r + gccgo -O2 k-nucleotide.go 8.30u 0.02s 8.32r + gccgo -O2 k-nucleotide-parallel.go 8.84u 0.05s 3.02r + gc k-nucleotide 15.38u 0.07s 15.44r + gc k-nucleotide-parallel 16.40u 0.03s 5.93r + gc_B k-nucleotide 15.19u 0.05s 15.23r +NEW: + gcc -O2 -k-nucleotide.c 4.88u 0.03s 4.92r + gccgo -O2 k-nucleotide.go 5.94u 0.01s 5.96r + gccgo -O2 k-nucleotide-parallel.go 6.44u 0.03s 1.47r + gc k-nucleotide 9.61u 0.01s 9.63r + gc k-nucleotide-parallel 9.70u 0.00s 3.39r + gc_B k-nucleotide 9.19u 0.03s 9.23r + +mandelbrot 16000 +OLD: + gcc -O2 mandelbrot.c 54.54u 0.00s 54.56r + gccgo -O2 mandelbrot.go 59.63u 0.03s 59.67r + gc mandelbrot 64.82u 0.00s 64.83r + gc_B mandelbrot 64.84u 0.00s 64.91r +NEW: + gcc -O2 mandelbrot.c 36.07u 0.01s 36.15r + gccgo -O2 mandelbrot.go 43.57u 0.00s 43.66r + gc mandelbrot 60.66u 0.00s 60.79r + gc_B mandelbrot 60.90u 0.00s 61.03r + +meteor 2098 +OLD: + gcc -O2 meteor-contest.c 0.11u 0.00s 0.10r + gccgo -O2 meteor-contest.go 0.10u 0.01s 0.10r + gc meteor-contest 0.18u 0.00s 0.17r + gc_B meteor-contest 0.17u 0.00s 0.16r +NEW: + gcc -O2 meteor-contest.c 0.10u 0.00s 0.09r + gccgo -O2 meteor-contest.go 0.10u 0.00s 0.09r + gc meteor-contest 0.14u 0.00s 0.14r + gc_B meteor-contest 0.13u 0.00s 0.13r + +pidigits 10000 +OLD: + gcc -O2 pidigits.c -lgmp 2.22u 0.00s 2.21r + gccgo -O2 pidigits.go 13.39u 0.00s 13.40r + gc pidigits 6.42u 0.04s 6.45r + gc_B pidigits 6.45u 0.02s 6.47r +NEW: + gcc -O2 pidigits.c -lgmp 2.27u 0.00s 2.29r + gccgo -O2 pidigits.go 9.21u 0.00s 9.22r + gc pidigits 3.60u 0.00s 3.60r + gc_B pidigits 3.56u 0.02s 3.58r + +threadring 50000000 +OLD: + gcc -O2 threadring.c -lpthread 34.51u 267.95s 336.12r + gccgo -O2 threadring.go 103.51u 588.57s 627.16r + gc threadring 54.68u 0.00s 54.73r +NEW: + gcc -O2 threadring.c 32.00u 259.39s 369.74r + gccgo -O2 threadring.go 133.06u 546.02s 595.33r + gc threadring 16.75u 0.02s 16.80r + +chameneos 6000000 +OLD: + gcc -O2 chameneosredux.c -lpthread 12.65u 31.02s 13.33r + gccgo -O2 chameneosredux.go 47.04u 302.84s 252.29r + gc chameneosredux 14.14u 0.00s 14.14r +NEW: + gcc -O2 chameneosredux.c -lpthread 8.05u 63.43s 11.16r + gccgo -O2 chameneosredux.go 82.95u 304.37s 207.64r + gc chameneosredux 9.42u 0.00s 9.43r diff --git a/test/convert.go b/test/convert.go index e7361aa87..0a75663d0 100644 --- a/test/convert.go +++ b/test/convert.go @@ -8,7 +8,7 @@ package main import "reflect" -func typeof(x interface{}) string { return reflect.Typeof(x).String() } +func typeof(x interface{}) string { return reflect.TypeOf(x).String() } func f() int { return 0 } diff --git a/test/fixedbugs/bug177.go b/test/fixedbugs/bug177.go index aec382388..a120ad0ab 100644 --- a/test/fixedbugs/bug177.go +++ b/test/fixedbugs/bug177.go @@ -12,7 +12,7 @@ type S1 struct{ i int } type S2 struct{ S1 } func main() { - typ := reflect.Typeof(S2{}) + typ := reflect.TypeOf(S2{}) f := typ.Field(0) if f.Name != "S1" || f.Anonymous != true { println("BUG: ", f.Name, f.Anonymous) diff --git a/test/fixedbugs/bug248.dir/bug2.go b/test/fixedbugs/bug248.dir/bug2.go index 4ea187a4b..b6c816a5c 100644 --- a/test/fixedbugs/bug248.dir/bug2.go +++ b/test/fixedbugs/bug248.dir/bug2.go @@ -38,11 +38,11 @@ func main() { // meaning that reflect data for v0, v1 didn't get confused. // path is full (rooted) path name. check suffix for gc, prefix for gccgo - if s := reflect.Typeof(v0).PkgPath(); !strings.HasSuffix(s, "/bug0") && !strings.HasPrefix(s, "bug0") { + if s := reflect.TypeOf(v0).PkgPath(); !strings.HasSuffix(s, "/bug0") && !strings.HasPrefix(s, "bug0") { println("bad v0 path", len(s), s) panic("fail") } - if s := reflect.Typeof(v1).PkgPath(); !strings.HasSuffix(s, "/bug1") && !strings.HasPrefix(s, "bug1") { + if s := reflect.TypeOf(v1).PkgPath(); !strings.HasSuffix(s, "/bug1") && !strings.HasPrefix(s, "bug1") { println("bad v1 path", s) panic("fail") } diff --git a/test/bugs/bug324.dir/main.go b/test/fixedbugs/bug324.dir/main.go index 4c1a18d9c..3ab61f3eb 100644 --- a/test/bugs/bug324.dir/main.go +++ b/test/fixedbugs/bug324.dir/main.go @@ -14,7 +14,7 @@ type Exported interface { type Implementation struct{} -func (p *Implementation) private() { println("main.Implementation.private()") } +func (p *Implementation) private() {} func main() { @@ -40,7 +40,12 @@ func main() { // x = px // this assignment unexpectedly compiles and then executes + defer func() { + recover() + }() x = px.(Exported) + + println("should not get this far") // this is a legitimate call, but because of the previous assignment, // it invokes the method private in p! diff --git a/test/bugs/bug324.dir/p.go b/test/fixedbugs/bug324.dir/p.go index d1e3b991a..d1e3b991a 100644 --- a/test/bugs/bug324.dir/p.go +++ b/test/fixedbugs/bug324.dir/p.go diff --git a/test/bugs/bug324.go b/test/fixedbugs/bug324.go index e188515d7..3da75630a 100644 --- a/test/bugs/bug324.go +++ b/test/fixedbugs/bug324.go @@ -1,4 +1,4 @@ -// $G $D/$F.dir/p.go && $G $D/$F.dir/main.go && $L main.$A && ! ./$A.out || echo BUG: should fail +// $G $D/$F.dir/p.go && $G $D/$F.dir/main.go && $L main.$A && ./$A.out // Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style diff --git a/test/fixedbugs/bug328.go b/test/fixedbugs/bug328.go new file mode 100644 index 000000000..64041f412 --- /dev/null +++ b/test/fixedbugs/bug328.go @@ -0,0 +1,14 @@ +// $G $D/$F.go && $L $F.$A && ./$A.out + +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package main + +import "unsafe" + +func main() { + var p unsafe.Pointer + println(p) +} diff --git a/test/fixedbugs/bug329.go b/test/fixedbugs/bug329.go new file mode 100644 index 000000000..0b7074d62 --- /dev/null +++ b/test/fixedbugs/bug329.go @@ -0,0 +1,46 @@ +// $G $D/$F.go && $L $F.$A && ./$A.out + +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package main + +type Value struct { + X interface{} + Y int +} + +type Struct struct { + X complex128 +} + +const magic = 1 + 2i + +func (Value) Complex(x complex128) { + if x != magic { + println(x) + panic("bad complex magic") + } +} + +func f(x *byte, y, z int) complex128 { + return magic +} + +func (Value) Struct(x Struct) { + if x.X != magic { + println(x.X) + panic("bad struct magic") + } +} + +func f1(x *byte, y, z int) Struct { + return Struct{magic} +} + +func main() { + var v Value + v.Struct(f1(nil, 0, 0)) // ok + v.Complex(f(nil, 0, 0)) // used to fail +} diff --git a/test/fixedbugs/bug330.go b/test/fixedbugs/bug330.go new file mode 100644 index 000000000..cf1d6cc2d --- /dev/null +++ b/test/fixedbugs/bug330.go @@ -0,0 +1,13 @@ +// errchk $G -e $D/$F.go + +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package main + +func main() { + x := "" + x = +"hello" // ERROR "invalid operation.*string" + x = +x // ERROR "invalid operation.*string" +} diff --git a/test/fixedbugs/bug331.go b/test/fixedbugs/bug331.go new file mode 100644 index 000000000..28aee1da0 --- /dev/null +++ b/test/fixedbugs/bug331.go @@ -0,0 +1,36 @@ +// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: bug331 + +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package main + +import "os" + +func f() (_ string, x float64, err os.Error) { + return +} + +func g() (_ string, x float64, err os.Error) { + return "hello", 3.14, os.EOF +} + +var _ func() (string, float64, os.Error) = f +var _ func() (string, float64, os.Error) = g + +func main() { + x, y, z := g() + if x != "hello" || y != 3.14 || z != os.EOF { + println("wrong", x, len(x), y, z) + } +} + +/* +issue 1712 + +bug331.go:12: cannot use "hello" (type string) as type float64 in assignment +bug331.go:12: cannot use 0 (type float64) as type os.Error in assignment: + float64 does not implement os.Error (missing String method) +bug331.go:12: error in shape across RETURN +*/ diff --git a/test/fixedbugs/bug332.go b/test/fixedbugs/bug332.go new file mode 100644 index 000000000..be79286b8 --- /dev/null +++ b/test/fixedbugs/bug332.go @@ -0,0 +1,17 @@ +// errchk $G $D/$F.go + +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package main + +// type T int + +func main() {} + +// issue 1474 + +// important: no newline on end of next line. +// 6g used to print <epoch> instead of bug332.go:111 +func (t *T) F() {} // ERROR "bug332"
\ No newline at end of file diff --git a/test/fixedbugs/bug333.go b/test/fixedbugs/bug333.go new file mode 100644 index 000000000..515c1f3fa --- /dev/null +++ b/test/fixedbugs/bug333.go @@ -0,0 +1,19 @@ +// $G $D/$F.go && $L $F.$A && ./$A.out + +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Issue 1709 + +package main + +func main() { + type Ts string + var ts Ts + _ = []byte(ts) +} + +/* +bug333.go:14: cannot use ts (type Ts) as type string in function argument +*/ diff --git a/test/fixedbugs/bug334.go b/test/fixedbugs/bug334.go new file mode 100644 index 000000000..870c9ae24 --- /dev/null +++ b/test/fixedbugs/bug334.go @@ -0,0 +1,31 @@ +// $G $D/$F.go || echo BUG: bug334 + +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Issue 1716 + +package main + +type ( + cplx64 complex64 + cplx128 complex128 +) + +func (c cplx64) Foo() {} +func (c cplx128) Foo() {} + +func main() { + var c64 cplx128 + var c128 cplx64 + c64.Foo() + c128.Foo() +} + +/* +bug334.go:16: invalid receiver type cplx64 +bug334.go:17: invalid receiver type cplx128 +bug334.go:22: c64.Foo undefined (type cplx128 has no field or method Foo) +bug334.go:23: c128.Foo undefined (type cplx64 has no field or method Foo) +*/ diff --git a/test/fixedbugs/bug335.dir/a.go b/test/fixedbugs/bug335.dir/a.go new file mode 100644 index 000000000..5a8112a9d --- /dev/null +++ b/test/fixedbugs/bug335.dir/a.go @@ -0,0 +1,9 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package a + +import "./b" + +var Bar = b.Foo diff --git a/test/fixedbugs/bug335.dir/b.go b/test/fixedbugs/bug335.dir/b.go new file mode 100644 index 000000000..7428c2a91 --- /dev/null +++ b/test/fixedbugs/bug335.dir/b.go @@ -0,0 +1,11 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package b + +type T interface{} + +func f() T { return nil } + +var Foo T = f() diff --git a/test/fixedbugs/bug335.go b/test/fixedbugs/bug335.go new file mode 100644 index 000000000..915b74657 --- /dev/null +++ b/test/fixedbugs/bug335.go @@ -0,0 +1,10 @@ +// $G $D/$F.dir/b.go && $G $D/$F.dir/a.go +// rm -f a.$A b.$A + +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Issue 1705. + +unused (see script at top of file) diff --git a/test/fixedbugs/bug336.go b/test/fixedbugs/bug336.go new file mode 100644 index 000000000..8de36898f --- /dev/null +++ b/test/fixedbugs/bug336.go @@ -0,0 +1,86 @@ +// $G $D/$F.go && $L $F.$A && ./$A.out + +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package main + +type T1 struct { + Next *T2 +} + +type T2 T1 + +type T3 struct { + Next *T4 +} + +type T4 T5 +type T5 T6 +type T6 T7 +type T7 T8 +type T8 T9 +type T9 T3 + +type T10 struct { + x struct { + y ***struct { + z *struct { + Next *T11 + } + } + } +} + +type T11 T10 + +type T12 struct { + F1 *T15 + F2 *T13 + F3 *T16 +} + +type T13 T14 +type T14 T15 +type T15 T16 +type T16 T17 +type T17 T12 + +// issue 1672 +type T18 *[10]T19 +type T19 T18 + +func main() { + _ = &T1{&T2{}} + _ = &T2{&T2{}} + _ = &T3{&T4{}} + _ = &T4{&T4{}} + _ = &T5{&T4{}} + _ = &T6{&T4{}} + _ = &T7{&T4{}} + _ = &T8{&T4{}} + _ = &T9{&T4{}} + _ = &T12{&T15{}, &T13{}, &T16{}} + + var ( + tn struct{ Next *T11 } + tz struct{ z *struct{ Next *T11 } } + tpz *struct{ z *struct{ Next *T11 } } + tppz **struct{ z *struct{ Next *T11 } } + tpppz ***struct{ z *struct{ Next *T11 } } + ty struct { + y ***struct{ z *struct{ Next *T11 } } + } + ) + tn.Next = &T11{} + tz.z = &tn + tpz = &tz + tppz = &tpz + tpppz = &tppz + ty.y = tpppz + _ = &T10{ty} + + t19s := &[10]T19{} + _ = T18(t19s) +} diff --git a/test/func7.go b/test/func7.go new file mode 100644 index 000000000..e38b008cc --- /dev/null +++ b/test/func7.go @@ -0,0 +1,29 @@ +// $G $D/$F.go && $L $F.$A && ./$A.out + +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package main + +var calledf = false + +func f() int { + calledf = true + return 1 +} + +func g() int { + if !calledf { + println("BUG: func7 - called g before f") + } + return 0 +} + +func main() { + // 6g, 8g, 5g all used to evaluate g() before f(). + if f() < g() { + panic("wrong answer") + } +} + diff --git a/test/golden.out b/test/golden.out index f76db3e50..725e8de44 100644 --- a/test/golden.out +++ b/test/golden.out @@ -157,14 +157,12 @@ panic: interface conversion: interface is int, not int32 panic: interface conversion: interface is main.T, not main.T +=========== fixedbugs/bug328.go +0x0 + == bugs/ =========== bugs/bug322.go bugs/bug322.dir/main.go:19: implicit assignment of unexported field 'x' of lib.T in method receiver bugs/bug322.dir/main.go:32: implicit assignment of unexported field 'x' of lib.T in method receiver BUG: fails incorrectly - -=========== bugs/bug324.go -main.Implementation.private() -p.Implementation.private() -BUG: should fail diff --git a/test/interface/fake.go b/test/interface/fake.go index de8505d8d..bdc5b9072 100644 --- a/test/interface/fake.go +++ b/test/interface/fake.go @@ -52,7 +52,7 @@ func main() { x.z = x.y // check mem and string - v := reflect.NewValue(x) + v := reflect.ValueOf(x) i := v.Field(0) j := v.Field(1) assert(i.Interface() == j.Interface()) diff --git a/test/interface/pointer.go b/test/interface/pointer.go index e628b558e..076469c8d 100644 --- a/test/interface/pointer.go +++ b/test/interface/pointer.go @@ -33,4 +33,5 @@ func main() { print("call addinst\n") var x Inst = AddInst(new(Start)) // ERROR "pointer to interface" print("return from addinst\n") + var x *Inst = new(Start) // ERROR "pointer to interface" } diff --git a/test/ken/cplx3.go b/test/ken/cplx3.go index 979e53f56..fa6ff1d52 100644 --- a/test/ken/cplx3.go +++ b/test/ken/cplx3.go @@ -25,7 +25,7 @@ func main() { println(c) var a interface{} - switch c := reflect.NewValue(a); c.Kind() { + switch c := reflect.ValueOf(a); c.Kind() { case reflect.Complex64, reflect.Complex128: v := c.Complex() _, _ = complex128(v), true diff --git a/test/method2.go b/test/method2.go index a72536e7b..2fdc9fc3c 100644 --- a/test/method2.go +++ b/test/method2.go @@ -12,8 +12,14 @@ type T struct { type P *T type P1 *T -func (p P) val() int { return 1 } // ERROR "receiver" -func (p *P1) val() int { return 1 } // ERROR "receiver" +func (p P) val() int { return 1 } // ERROR "receiver.* pointer" +func (p *P1) val() int { return 1 } // ERROR "receiver.* pointer" + +type I interface{} +type I1 interface{} + +func (p I) val() int { return 1 } // ERROR "receiver.*interface" +func (p *I1) val() int { return 1 } // ERROR "receiver.*interface" type Val interface { val() int |
