diff options
Diffstat (limited to 'test')
45 files changed, 401 insertions, 98 deletions
diff --git a/test/bugs/bug367.dir/main.go b/test/bugs/bug367.dir/main.go new file mode 100644 index 000000000..ab5d1702b --- /dev/null +++ b/test/bugs/bug367.dir/main.go @@ -0,0 +1,12 @@ +package main + +import ( + "./p" +) + +type T struct{ *p.S } + +func main() { + var t T + p.F(t) +} diff --git a/test/bugs/bug367.dir/p.go b/test/bugs/bug367.dir/p.go new file mode 100644 index 000000000..4e27d4e00 --- /dev/null +++ b/test/bugs/bug367.dir/p.go @@ -0,0 +1,16 @@ +package p + +type T struct{ x int } +type S struct{} + +func (p *S) get() T { + return T{0} +} + +type I interface { + get() T +} + +func F(i I) { + _ = i.get() +} diff --git a/test/bugs/bug367.go b/test/bugs/bug367.go new file mode 100644 index 000000000..073e3b180 --- /dev/null +++ b/test/bugs/bug367.go @@ -0,0 +1,7 @@ +// $G $D/$F.dir/p.go && $G $D/$F.dir/main.go && $L main.$A && ./$A.out || echo BUG: should not fail + +// 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. + +ignored diff --git a/test/dwarf/linedirectives.go b/test/dwarf/linedirectives.go new file mode 100755 index 000000000..68434f0ab --- /dev/null +++ b/test/dwarf/linedirectives.go @@ -0,0 +1,83 @@ +// $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. + +//line foo/bar.y:4 +package main +//line foo/bar.y:60 +func main() { +//line foo/bar.y:297 + f, l := 0, 0 +//line yacctab:1 + f, l = 1, 1 +//line yaccpar:1 + f, l = 2, 1 +//line foo/bar.y:82 + f, l = 3, 82 +//line foo/bar.y:90 + f, l = 3, 90 +//line foo/bar.y:92 + f, l = 3, 92 +//line foo/bar.y:100 + f, l = 3, 100 +//line foo/bar.y:104 + l = 104 +//line foo/bar.y:112 + l = 112 +//line foo/bar.y:117 + l = 117 +//line foo/bar.y:121 + l = 121 +//line foo/bar.y:125 + l = 125 +//line foo/bar.y:133 + l = 133 +//line foo/bar.y:146 + l = 146 +//line foo/bar.y:148 +//line foo/bar.y:153 +//line foo/bar.y:155 + l = 155 +//line foo/bar.y:160 + +//line foo/bar.y:164 +//line foo/bar.y:173 + +//line foo/bar.y:178 +//line foo/bar.y:180 +//line foo/bar.y:185 +//line foo/bar.y:195 +//line foo/bar.y:197 +//line foo/bar.y:202 +//line foo/bar.y:204 +//line foo/bar.y:208 +//line foo/bar.y:211 +//line foo/bar.y:213 +//line foo/bar.y:215 +//line foo/bar.y:217 +//line foo/bar.y:221 +//line foo/bar.y:229 +//line foo/bar.y:236 +//line foo/bar.y:238 +//line foo/bar.y:240 +//line foo/bar.y:244 +//line foo/bar.y:249 +//line foo/bar.y:253 +//line foo/bar.y:257 +//line foo/bar.y:262 +//line foo/bar.y:267 +//line foo/bar.y:272 + if l == f { +//line foo/bar.y:277 + panic("aie!") +//line foo/bar.y:281 + } +//line foo/bar.y:285 + return +//line foo/bar.y:288 +//line foo/bar.y:290 +} +//line foo/bar.y:293 +//line foo/bar.y:295 diff --git a/test/dwarf/main.go b/test/dwarf/main.go new file mode 100644 index 000000000..7f2ec4c00 --- /dev/null +++ b/test/dwarf/main.go @@ -0,0 +1,29 @@ +// $G $D/$F.go $D/z*.go && $L $F.$A && ./$A.out + +// Copyright 2009 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() { +F1() +F2() +F3() +F4() +F5() +F6() +F7() +F8() +F9() +F10() +F11() +F12() +F13() +F14() +F15() +F16() +F17() +F18() +F19() +F20() +} diff --git a/test/dwarf/z1.go b/test/dwarf/z1.go new file mode 100644 index 000000000..7f163e9a1 --- /dev/null +++ b/test/dwarf/z1.go @@ -0,0 +1,5 @@ + + +//line x1.go:4 +package main +func F1() {} diff --git a/test/dwarf/z10.go b/test/dwarf/z10.go new file mode 100644 index 000000000..19c70020e --- /dev/null +++ b/test/dwarf/z10.go @@ -0,0 +1,6 @@ + + + +//line x10.go:4 +package main +func F10() {} diff --git a/test/dwarf/z11.go b/test/dwarf/z11.go new file mode 100644 index 000000000..c1d2f9180 --- /dev/null +++ b/test/dwarf/z11.go @@ -0,0 +1,4 @@ + +//line x11.go:4 +package main +func F11() {} diff --git a/test/dwarf/z12.go b/test/dwarf/z12.go new file mode 100644 index 000000000..7455f1894 --- /dev/null +++ b/test/dwarf/z12.go @@ -0,0 +1,4 @@ + +//line x12.go:4 +package main +func F12() {} diff --git a/test/dwarf/z13.go b/test/dwarf/z13.go new file mode 100644 index 000000000..ecb3c4c8c --- /dev/null +++ b/test/dwarf/z13.go @@ -0,0 +1,4 @@ + +//line x13.go:4 +package main +func F13() {} diff --git a/test/dwarf/z14.go b/test/dwarf/z14.go new file mode 100644 index 000000000..134b39b64 --- /dev/null +++ b/test/dwarf/z14.go @@ -0,0 +1,4 @@ + +//line x14.go:4 +package main +func F14() {} diff --git a/test/dwarf/z15.go b/test/dwarf/z15.go new file mode 100644 index 000000000..d73819b44 --- /dev/null +++ b/test/dwarf/z15.go @@ -0,0 +1,4 @@ + +//line x15.go:4 +package main +func F15() {} diff --git a/test/dwarf/z16.go b/test/dwarf/z16.go new file mode 100644 index 000000000..6c31651ba --- /dev/null +++ b/test/dwarf/z16.go @@ -0,0 +1,4 @@ + +//line x16.go:4 +package main +func F16() {} diff --git a/test/dwarf/z17.go b/test/dwarf/z17.go new file mode 100644 index 000000000..b742d1672 --- /dev/null +++ b/test/dwarf/z17.go @@ -0,0 +1,4 @@ + +//line x17.go:4 +package main +func F17() {} diff --git a/test/dwarf/z18.go b/test/dwarf/z18.go new file mode 100644 index 000000000..84150ff0a --- /dev/null +++ b/test/dwarf/z18.go @@ -0,0 +1,5 @@ + + +//line x18.go:4 +package main +func F18() {} diff --git a/test/dwarf/z19.go b/test/dwarf/z19.go new file mode 100644 index 000000000..bb2e29684 --- /dev/null +++ b/test/dwarf/z19.go @@ -0,0 +1,4 @@ + +//line x19.go:4 +package main +func F19() {} diff --git a/test/dwarf/z2.go b/test/dwarf/z2.go new file mode 100644 index 000000000..68bd58257 --- /dev/null +++ b/test/dwarf/z2.go @@ -0,0 +1,4 @@ + +//line x2.go:4 +package main +func F2() {} diff --git a/test/dwarf/z20.go b/test/dwarf/z20.go new file mode 100644 index 000000000..03111e184 --- /dev/null +++ b/test/dwarf/z20.go @@ -0,0 +1,4 @@ + +//line x20.go:4 +package main +func F20() {} diff --git a/test/dwarf/z3.go b/test/dwarf/z3.go new file mode 100644 index 000000000..5e4ad3ae2 --- /dev/null +++ b/test/dwarf/z3.go @@ -0,0 +1,4 @@ + +//line x3.go:4 +package main +func F3() {} diff --git a/test/dwarf/z4.go b/test/dwarf/z4.go new file mode 100644 index 000000000..1f28465c5 --- /dev/null +++ b/test/dwarf/z4.go @@ -0,0 +1,4 @@ + +//line x4.go:4 +package main +func F4() {} diff --git a/test/dwarf/z5.go b/test/dwarf/z5.go new file mode 100644 index 000000000..7f4eeb419 --- /dev/null +++ b/test/dwarf/z5.go @@ -0,0 +1,4 @@ + +//line x5.go:4 +package main +func F5() {} diff --git a/test/dwarf/z6.go b/test/dwarf/z6.go new file mode 100644 index 000000000..241791dff --- /dev/null +++ b/test/dwarf/z6.go @@ -0,0 +1,4 @@ + +//line x6.go:4 +package main +func F6() {} diff --git a/test/dwarf/z7.go b/test/dwarf/z7.go new file mode 100644 index 000000000..68c1ad0c2 --- /dev/null +++ b/test/dwarf/z7.go @@ -0,0 +1,4 @@ + +//line x7.go:4 +package main +func F7() {} diff --git a/test/dwarf/z8.go b/test/dwarf/z8.go new file mode 100644 index 000000000..16eed32a2 --- /dev/null +++ b/test/dwarf/z8.go @@ -0,0 +1,4 @@ + +//line x8.go:4 +package main +func F8() {} diff --git a/test/dwarf/z9.go b/test/dwarf/z9.go new file mode 100644 index 000000000..cbb94b4d2 --- /dev/null +++ b/test/dwarf/z9.go @@ -0,0 +1,4 @@ + +//line x9.go:4 +package main +func F9() {} diff --git a/test/fixedbugs/bug330.go b/test/fixedbugs/bug330.go index cf1d6cc2d..114492aff 100644 --- a/test/fixedbugs/bug330.go +++ b/test/fixedbugs/bug330.go @@ -8,6 +8,6 @@ package main func main() { x := "" - x = +"hello" // ERROR "invalid operation.*string" - x = +x // ERROR "invalid operation.*string" + x = +"hello" // ERROR "invalid operation.*string|expected numeric" + x = +x // ERROR "invalid operation.*string|expected numeric" } diff --git a/test/fixedbugs/bug337.go b/test/fixedbugs/bug337.go index 62e310e72..ca9b4b453 100644 --- a/test/fixedbugs/bug337.go +++ b/test/fixedbugs/bug337.go @@ -14,6 +14,6 @@ package main func main() { - len("foo") // ERROR "len" + len("foo") // ERROR "len|value computed is not used" } diff --git a/test/fixedbugs/bug344.go b/test/fixedbugs/bug344.go index d217b3bd3..ce953f7f2 100644 --- a/test/fixedbugs/bug344.go +++ b/test/fixedbugs/bug344.go @@ -14,10 +14,10 @@ func main() { i := 42 a := []*int{&i, &i, &i, &i} x := a[0] - goto start // ERROR "goto start jumps into block" + goto start // ERROR "jumps into block" z := 1 _ = z - for _, x = range a { + for _, x = range a { // GCCGO_ERROR "block" start: fmt.Sprint(*x) } diff --git a/test/fixedbugs/bug349.go b/test/fixedbugs/bug349.go index 07005973e..e7612edb7 100644 --- a/test/fixedbugs/bug349.go +++ b/test/fixedbugs/bug349.go @@ -9,5 +9,5 @@ package main func foo() (a, b, c int) { - return 0, 1 2.01 // ERROR "unexpected literal 2.01" + return 0, 1 2.01 // ERROR "unexpected literal 2.01|expected ';' or '}' or newline|not enough arguments to return" } diff --git a/test/fixedbugs/bug353.go b/test/fixedbugs/bug353.go index 46f5c36cb..b59d97f33 100644 --- a/test/fixedbugs/bug353.go +++ b/test/fixedbugs/bug353.go @@ -13,7 +13,7 @@ import ( "os" ) -func echo(fd io.ReadWriterCloser) { // ERROR "undefined: io.ReadWriterCloser" +func echo(fd io.ReadWriterCloser) { // ERROR "undefined.*io.ReadWriterCloser" var buf [1024]byte for { n, err := fd.Read(buf) diff --git a/test/fixedbugs/bug357.go b/test/fixedbugs/bug357.go index 2220398d0..448d98263 100644 --- a/test/fixedbugs/bug357.go +++ b/test/fixedbugs/bug357.go @@ -15,8 +15,9 @@ func bla1() bool { func bla5() bool { _ = 1 - false // ERROR "false not used" + false // ERROR "false not used|value computed is not used" _ = 2 + return false } func main() { diff --git a/test/fixedbugs/bug358.go b/test/fixedbugs/bug358.go index cc622c047..f43709b7e 100644 --- a/test/fixedbugs/bug358.go +++ b/test/fixedbugs/bug358.go @@ -11,12 +11,12 @@ package main import ( "http" - "io/ioutil" + "io/ioutil" // GCCGO_ERROR "imported and not used" "os" ) func makeHandler(fn func(http.ResponseWriter, *http.Request, string)) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) // ERROR "syntax error" + return func(w http.ResponseWriter, r *http.Request) // ERROR "syntax error|invalid use of type" } type Page struct { diff --git a/test/fixedbugs/bug359.go b/test/fixedbugs/bug359.go index 7f34672f1..3701499ed 100644 --- a/test/fixedbugs/bug359.go +++ b/test/fixedbugs/bug359.go @@ -16,11 +16,11 @@ type Painting struct { } func (p Painting) Foo() { - for e := p.fragments; e.Front() != nil; { // ERROR "unexported field" + for e := p.fragments; e.Front() != nil; { // ERROR "unexported field|hidden field" } } // from comment 4 of issue 1910 type Foo interface { - Run(a int) (a int) // ERROR "a redeclared" + Run(a int) (a int) // ERROR "a redeclared|redefinition|previous" } diff --git a/test/fixedbugs/bug362.go b/test/fixedbugs/bug362.go index 791209103..f38572c0d 100644 --- a/test/fixedbugs/bug362.go +++ b/test/fixedbugs/bug362.go @@ -10,7 +10,7 @@ package main var ( - a = iota // ERROR "undefined: iota" - b = iota // ERROR "undefined: iota" - c = iota // ERROR "undefined: iota" + a = iota // ERROR "undefined: iota|iota is only defined in const" + b = iota // ERROR "undefined: iota|iota is only defined in const" + c = iota // ERROR "undefined: iota|iota is only defined in const" ) diff --git a/test/fixedbugs/bug363.go b/test/fixedbugs/bug363.go index 7e89749a0..04fcfe1a8 100644 --- a/test/fixedbugs/bug363.go +++ b/test/fixedbugs/bug363.go @@ -10,10 +10,10 @@ package main func main() { var i uint = 33 - var a = (1<<i) + 4.5 // ERROR "shift of type float64" + var a = (1<<i) + 4.5 // ERROR "shift of type float64|invalid.*shift" println(a) - var b = (1<<i) + 4.0 // ERROR "shift of type float64" + var b = (1<<i) + 4.0 // ERROR "shift of type float64|invalid.*shift" println(b) var c int64 = (1<<i) + 4.0 // ok - it's all int64 diff --git a/test/fixedbugs/bug365.go b/test/fixedbugs/bug365.go index 7ec19b0c8..ce6950504 100644 --- a/test/fixedbugs/bug365.go +++ b/test/fixedbugs/bug365.go @@ -12,7 +12,7 @@ package main type S struct { - err os.Error // ERROR "undefined" + err os.Error // ERROR "undefined|expected package" Num int } diff --git a/test/golden.out b/test/golden.out index 624b2119f..fc4b81d3b 100644 --- a/test/golden.out +++ b/test/golden.out @@ -115,6 +115,8 @@ panic: interface conversion: *main.S is not main.I2: missing method Name == syntax/ +== dwarf/ + == fixedbugs/ =========== fixedbugs/bug027.go @@ -153,3 +155,7 @@ panic: interface conversion: interface is main.T, not main.T 0x0 == bugs/ + +=========== bugs/bug367.go +panic: interface conversion: main.T is not p.I: missing method get +BUG: should not fail diff --git a/test/goto.go b/test/goto.go index 0a50938dc..1fccb314c 100644 --- a/test/goto.go +++ b/test/goto.go @@ -36,8 +36,8 @@ L: // goto across declaration not okay func _() { - goto L // ERROR "goto L jumps over declaration of x at LINE+1" - x := 1 + goto L // ERROR "goto L jumps over declaration of x at LINE+1|goto jumps over declaration" + x := 1 // GCCGO_ERROR "defined here" _ = x L: } @@ -54,12 +54,12 @@ L: // goto across declaration after inner scope not okay func _() { - goto L // ERROR "goto L jumps over declaration of x at LINE+5" + goto L // ERROR "goto L jumps over declaration of x at LINE+5|goto jumps over declaration" { x := 1 _ = x } - x := 1 + x := 1 // GCCGO_ERROR "defined here" _ = x L: } @@ -74,8 +74,8 @@ L: // error shows first offending variable func _() { - goto L // ERROR "goto L jumps over declaration of x at LINE+1" - x := 1 + goto L // ERROR "goto L jumps over declaration of x at LINE+1|goto jumps over declaration" + x := 1 // GCCGO_ERROR "defined here" _ = x y := 1 _ = y @@ -84,8 +84,8 @@ L: // goto not okay even if code path is dead func _() { - goto L // ERROR "goto L jumps over declaration of x at LINE+1" - x := 1 + goto L // ERROR "goto L jumps over declaration of x at LINE+1|goto jumps over declaration" + x := 1 // GCCGO_ERROR "defined here" _ = x y := 1 _ = y @@ -111,26 +111,26 @@ L: // goto into inner block not okay func _() { - goto L // ERROR "goto L jumps into block starting at LINE+1" - { + goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block" + { // GCCGO_ERROR "block starts here" L: } } // goto backward into inner block still not okay func _() { - { + { // GCCGO_ERROR "block starts here" L: } - goto L // ERROR "goto L jumps into block starting at LINE-3" + goto L // ERROR "goto L jumps into block starting at LINE-3|goto jumps into block" } // error shows first (outermost) offending block func _() { - goto L // ERROR "goto L jumps into block starting at LINE+1" + goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block" { { - { + { // GCCGO_ERROR "block starts here" L: } } @@ -139,10 +139,10 @@ func _() { // error prefers block diagnostic over declaration diagnostic func _() { - goto L // ERROR "goto L jumps into block starting at LINE+3" + goto L // ERROR "goto L jumps into block starting at LINE+3|goto jumps into block" x := 1 _ = x - { + { // GCCGO_ERROR "block starts here" L: } } @@ -176,56 +176,56 @@ L: } func _() { - goto L // ERROR "goto L jumps into block starting at LINE+1" - if true { + goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block" + if true { // GCCGO_ERROR "block starts here" L: } } func _() { - goto L // ERROR "goto L jumps into block starting at LINE+1" - if true { + goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block" + if true { // GCCGO_ERROR "block starts here" L: } else { } } func _() { - goto L // ERROR "goto L jumps into block starting at LINE+1" + goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block" if true { - } else { + } else { // GCCGO_ERROR "block starts here" L: } } func _() { - if false { + if false { // GCCGO_ERROR "block starts here" L: } else { - goto L // ERROR "goto L jumps into block starting at LINE-3" + goto L // ERROR "goto L jumps into block starting at LINE-3|goto jumps into block" } } func _() { if true { - goto L // ERROR "goto L jumps into block starting at LINE+1" - } else { + goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block" + } else { // GCCGO_ERROR "block starts here" L: } } func _() { if true { - goto L // ERROR "goto L jumps into block starting at LINE+1" - } else if false { + goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block" + } else if false { // GCCGO_ERROR "block starts here" L: } } func _() { if true { - goto L // ERROR "goto L jumps into block starting at LINE+1" - } else if false { + goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block" + } else if false { // GCCGO_ERROR "block starts here" L: } else { } @@ -238,9 +238,9 @@ func _() { // really is LINE+1 (like in the previous test), // even though it looks like it might be LINE+3 instead. if true { - goto L // ERROR "goto L jumps into block starting at LINE+1" + goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block" } else if false { - } else { + } else { // GCCGO_ERROR "block starts here" L: } } @@ -259,10 +259,10 @@ func _() { func _() { // Still not okay. - if true { + if true { //// GCCGO_ERROR "block starts here" L: } else - goto L //// ERROR "goto L jumps into block starting at LINE-3" + goto L //// ERROR "goto L jumps into block starting at LINE-3|goto jumps into block" } */ @@ -284,61 +284,61 @@ func _() { } func _() { - for { + for { // GCCGO_ERROR "block starts here" L: } - goto L // ERROR "goto L jumps into block starting at LINE-3" + goto L // ERROR "goto L jumps into block starting at LINE-3|goto jumps into block" } func _() { - for { + for { // GCCGO_ERROR "block starts here" goto L L1: } L: - goto L1 // ERROR "goto L1 jumps into block starting at LINE-5" + goto L1 // ERROR "goto L1 jumps into block starting at LINE-5|goto jumps into block" } func _() { - for i < n { + for i < n { // GCCGO_ERROR "block starts here" L: } - goto L // ERROR "goto L jumps into block starting at LINE-3" + goto L // ERROR "goto L jumps into block starting at LINE-3|goto jumps into block" } func _() { - for i = 0; i < n; i++ { + for i = 0; i < n; i++ { // GCCGO_ERROR "block starts here" L: } - goto L // ERROR "goto L jumps into block starting at LINE-3" + goto L // ERROR "goto L jumps into block starting at LINE-3|goto jumps into block" } func _() { - for i = range x { + for i = range x { // GCCGO_ERROR "block starts here" L: } - goto L // ERROR "goto L jumps into block starting at LINE-3" + goto L // ERROR "goto L jumps into block starting at LINE-3|goto jumps into block" } func _() { - for i = range c { + for i = range c { // GCCGO_ERROR "block starts here" L: } - goto L // ERROR "goto L jumps into block starting at LINE-3" + goto L // ERROR "goto L jumps into block starting at LINE-3|goto jumps into block" } func _() { - for i = range m { + for i = range m { // GCCGO_ERROR "block starts here" L: } - goto L // ERROR "goto L jumps into block starting at LINE-3" + goto L // ERROR "goto L jumps into block starting at LINE-3|goto jumps into block" } func _() { - for i = range s { + for i = range s { // GCCGO_ERROR "block starts here" L: } - goto L // ERROR "goto L jumps into block starting at LINE-3" + goto L // ERROR "goto L jumps into block starting at LINE-3|goto jumps into block" } // switch @@ -392,48 +392,48 @@ func _() { } func _() { - goto L // ERROR "goto L jumps into block starting at LINE+1" + goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block" switch i { case 0: - L: + L: // GCCGO_ERROR "block starts here" } } func _() { - goto L // ERROR "goto L jumps into block starting at LINE+1" + goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block" switch i { case 0: - L: + L: // GCCGO_ERROR "block starts here" ; default: } } func _() { - goto L // ERROR "goto L jumps into block starting at LINE+1" + goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block" switch i { case 0: default: - L: + L: // GCCGO_ERROR "block starts here" } } func _() { switch i { default: - goto L // ERROR "goto L jumps into block starting at LINE+1" + goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block" case 0: - L: + L: // GCCGO_ERROR "block starts here" } } func _() { switch i { case 0: - L: + L: // GCCGO_ERROR "block starts here" ; default: - goto L // ERROR "goto L jumps into block starting at LINE-4" + goto L // ERROR "goto L jumps into block starting at LINE-4|goto jumps into block" } } @@ -489,47 +489,47 @@ func _() { } func _() { - goto L // ERROR "goto L jumps into block starting at LINE+2" + goto L // ERROR "goto L jumps into block starting at LINE+2|goto jumps into block" select { case c <- 1: - L: + L: // GCCGO_ERROR "block starts here" } } func _() { - goto L // ERROR "goto L jumps into block starting at LINE+2" + goto L // ERROR "goto L jumps into block starting at LINE+2|goto jumps into block" select { case c <- 1: - L: + L: // GCCGO_ERROR "block starts here" ; default: } } func _() { - goto L // ERROR "goto L jumps into block starting at LINE+3" + goto L // ERROR "goto L jumps into block starting at LINE+3|goto jumps into block" select { case <-c: default: - L: + L: // GCCGO_ERROR "block starts here" } } func _() { select { default: - goto L // ERROR "goto L jumps into block starting at LINE+1" + goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block" case <-c: - L: + L: // GCCGO_ERROR "block starts here" } } func _() { select { case <-c: - L: + L: // GCCGO_ERROR "block starts here" ; default: - goto L // ERROR "goto L jumps into block starting at LINE-4" + goto L // ERROR "goto L jumps into block starting at LINE-4|goto jumps into block" } } diff --git a/test/interface/pointer.go b/test/interface/pointer.go index fe4d8e3ef..f1e363cbf 100644 --- a/test/interface/pointer.go +++ b/test/interface/pointer.go @@ -33,5 +33,5 @@ func main() { print("call addinst\n") var x Inst = AddInst(new(Start)) // ERROR "pointer to interface" print("return from addinst\n") - var y *Inst = new(Start) // ERROR "pointer to interface" + var y *Inst = new(Start) // ERROR "pointer to interface|incompatible type" } diff --git a/test/ken/cplx2.go b/test/ken/cplx2.go index b36e93ecd..89f4a0418 100644 --- a/test/ken/cplx2.go +++ b/test/ken/cplx2.go @@ -105,4 +105,16 @@ func main() { println("opcode x", ce, Ce) panic("fail") } + + r32 := real(complex64(ce)) + if r32 != float32(real(Ce)) { + println("real(complex64(ce))", r32, real(Ce)) + panic("fail") + } + + r64 := real(complex128(ce)) + if r64 != real(Ce) { + println("real(complex128(ce))", r64, real(Ce)) + panic("fail") + } } diff --git a/test/map1.go b/test/map1.go new file mode 100644 index 000000000..3a56cf057 --- /dev/null +++ b/test/map1.go @@ -0,0 +1,41 @@ +// 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() {} + +type v bool + +var ( + // valid + _ map[int8]v + _ map[uint8]v + _ map[int16]v + _ map[uint16]v + _ map[int32]v + _ map[uint32]v + _ map[int64]v + _ map[uint64]v + _ map[int]v + _ map[uint]v + _ map[uintptr]v + _ map[float32]v + _ map[float64]v + _ map[complex64]v + _ map[complex128]v + _ map[bool]v + _ map[string]v + _ map[chan int]v + _ map[func()]v + _ map[*int]v + _ map[map[int]int]v + + // invalid + _ map[struct{}]v // ERROR "invalid map key" + _ map[[]int]v // ERROR "invalid map key" + _ map[[10]int]v // ERROR "invalid map key" +) diff --git a/test/method2.go b/test/method2.go index 2fdc9fc3c..039779efb 100644 --- a/test/method2.go +++ b/test/method2.go @@ -12,14 +12,14 @@ type T struct { type P *T type P1 *T -func (p P) val() int { return 1 } // ERROR "receiver.* pointer" -func (p *P1) val() int { return 1 } // ERROR "receiver.* pointer" +func (p P) val() int { return 1 } // ERROR "receiver.* pointer|invalid pointer or interface receiver" +func (p *P1) val() int { return 1 } // ERROR "receiver.* pointer|invalid pointer or interface receiver" 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" +func (p I) val() int { return 1 } // ERROR "receiver.*interface|invalid pointer or interface receiver" +func (p *I1) val() int { return 1 } // ERROR "receiver.*interface|invalid pointer or interface receiver" type Val interface { val() int @@ -53,7 +53,7 @@ filterout() { grep '^'"$2"'$' $1 >/dev/null } -for dir in . ken chan interface nilptr syntax fixedbugs bugs +for dir in . ken chan interface nilptr syntax dwarf fixedbugs bugs do echo echo '==' $dir'/' diff --git a/test/shift1.go b/test/shift1.go index 6a8e26e5e..c197eef66 100644 --- a/test/shift1.go +++ b/test/shift1.go @@ -15,14 +15,14 @@ func h(x float64) int { return 0 } // from the spec var ( s uint = 33 - u = 1.0 << s // ERROR "invalid operation" - v float32 = 1 << s // ERROR "invalid operation" "as type float32" + u = 1.0 << s // ERROR "invalid operation|shift of non-integer operand" + v float32 = 1 << s // ERROR "invalid" "as type float32" ) // non-constant shift expressions var ( - e1 = g(2.0 << s) // ERROR "invalid operation" "as type interface" - f1 = h(2 << s) // ERROR "invalid operation" "as type float64" + e1 = g(2.0 << s) // ERROR "invalid" "as type interface" + f1 = h(2 << s) // ERROR "invalid" "as type float64" g1 int64 = 1.1 << s // ERROR "truncated" ) diff --git a/test/syntax/else.go b/test/syntax/else.go new file mode 100644 index 000000000..186d5959a --- /dev/null +++ b/test/syntax/else.go @@ -0,0 +1,12 @@ +// 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 + +func main() { + if true { + } else ; // ERROR "else must be followed by if or statement block" +} |