diff options
Diffstat (limited to 'test/fixedbugs')
27 files changed, 159 insertions, 104 deletions
diff --git a/test/fixedbugs/bug006.go b/test/fixedbugs/bug006.go index e7694f95b..43b5dfb12 100644 --- a/test/fixedbugs/bug006.go +++ b/test/fixedbugs/bug006.go @@ -9,11 +9,16 @@ package main import "os" const ( - x float = iota; - g float = 4.5 * iota; -); + x float64 = iota + g float64 = 4.5 * iota +) func main() { - if g == 0.0 { print("zero\n");} - if g != 4.5 { print(" fail\n"); os.Exit(1); } + if g == 0.0 { + print("zero\n") + } + if g != 4.5 { + print(" fail\n") + os.Exit(1) + } } diff --git a/test/fixedbugs/bug007.go b/test/fixedbugs/bug007.go index bd970de5f..d65f6da45 100644 --- a/test/fixedbugs/bug007.go +++ b/test/fixedbugs/bug007.go @@ -7,7 +7,9 @@ package main type ( - Point struct { x, y float }; + Point struct { + x, y float64 + } Polar Point ) diff --git a/test/fixedbugs/bug010.go b/test/fixedbugs/bug010.go index e71c4d7f0..7d96988d4 100644 --- a/test/fixedbugs/bug010.go +++ b/test/fixedbugs/bug010.go @@ -7,14 +7,14 @@ package main -func f(i int, f float) { - i = 8; - f = 8.0; - return; +func f(i int, f float64) { + i = 8 + f = 8.0 + return } func main() { - f(3, float(5)) + f(3, float64(5)) } /* diff --git a/test/fixedbugs/bug011.go b/test/fixedbugs/bug011.go index 551adb77d..ce627472c 100644 --- a/test/fixedbugs/bug011.go +++ b/test/fixedbugs/bug011.go @@ -8,19 +8,19 @@ package main type T struct { - x, y int; + x, y int } -func (t *T) m(a int, b float) int { - return (t.x+a) * (t.y+int(b)); +func (t *T) m(a int, b float64) int { + return (t.x + a) * (t.y + int(b)) } func main() { - var t *T = new(T); - t.x = 1; - t.y = 2; - r10 := t.m(1, 3.0); - _ = r10; + var t *T = new(T) + t.x = 1 + t.y = 2 + r10 := t.m(1, 3.0) + _ = r10 } /* bug11.go:16: fatal error: walktype: switch 1 unknown op CALLMETH l(16) <int32>INT32 diff --git a/test/fixedbugs/bug016.go b/test/fixedbugs/bug016.go index 461bcf82a..1cdd8df08 100644 --- a/test/fixedbugs/bug016.go +++ b/test/fixedbugs/bug016.go @@ -1,4 +1,4 @@ -// ! $G $D/$F.go +// errchk $G -e $D/$F.go // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style @@ -7,8 +7,8 @@ package main func main() { - var i int = 100; - i = i << -3; // BUG: should not compile (negative shift) + var i int = 100 + i = i << -3 // ERROR "overflows" } /* diff --git a/test/fixedbugs/bug035.go b/test/fixedbugs/bug035.go index 461c0607a..bd2a633f2 100644 --- a/test/fixedbugs/bug035.go +++ b/test/fixedbugs/bug035.go @@ -6,8 +6,8 @@ package main -func f9(a int) (i int, f float) { - i := 9; // ERROR "redecl|no new" - f := float(9); // ERROR "redecl|no new" - return i, f; +func f9(a int) (i int, f float64) { + i := 9 // ERROR "redecl|no new" + f := float64(9) // ERROR "redecl|no new" + return i, f } diff --git a/test/fixedbugs/bug047.go b/test/fixedbugs/bug047.go index f3749e739..5a776abce 100644 --- a/test/fixedbugs/bug047.go +++ b/test/fixedbugs/bug047.go @@ -9,15 +9,15 @@ package main func main() { type T struct { - s string; - f float; - }; - var s string = "hello"; - var f float = 0.2; - t := T{s, f}; + s string + f float64 + } + var s string = "hello" + var f float64 = 0.2 + t := T{s, f} - type M map[int] int; - m0 := M{7:8}; + type M map[int]int + m0 := M{7: 8} - _, _ = t, m0; + _, _ = t, m0 } diff --git a/test/fixedbugs/bug069.go b/test/fixedbugs/bug069.go index d6796cd72..bf7316313 100644 --- a/test/fixedbugs/bug069.go +++ b/test/fixedbugs/bug069.go @@ -6,15 +6,16 @@ package main -func main(){ - c := make(chan int); - ok := false; - var i int; - - i, ok = <-c; // works - _, _ = i, ok; - - ca := new([2]chan int); - i, ok = <-(ca[0]); // fails: c.go:11: bad shape across assignment - cr=1 cl=2 - _, _ = i, ok; +func main() { + //TODO(rsc): uncomment when this syntax is valid for receive+check closed + // c := make(chan int); + // ok := false; + // var i int; + // + // i, ok = <-c; // works + // _, _ = i, ok; + // + // ca := new([2]chan int); + // i, ok = <-(ca[0]); // fails: c.go:11: bad shape across assignment - cr=1 cl=2 + // _, _ = i, ok; } diff --git a/test/fixedbugs/bug080.go b/test/fixedbugs/bug080.go index a5003d29b..bae16cdb2 100644 --- a/test/fixedbugs/bug080.go +++ b/test/fixedbugs/bug080.go @@ -4,18 +4,18 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -package main - -func f1() (x int, y float) { - return; +package main + +func f1() (x int, y float64) { + return } -func f2 (x int, y float) { - return; +func f2(x int, y float64) { + return } func main() { - f2(f1()); // this should be a legal call + f2(f1()) // this should be a legal call } /* diff --git a/test/fixedbugs/bug081.go b/test/fixedbugs/bug081.go index ccb369953..8d3d538c8 100644 --- a/test/fixedbugs/bug081.go +++ b/test/fixedbugs/bug081.go @@ -1,12 +1,12 @@ -// ! $G $D/$F.go +// errchk $G $D/$F.go // 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 - -const x x = 2; +package main + +const x x = 2 // ERROR "loop" /* bug081.go:3: first constant must evaluate an expression diff --git a/test/fixedbugs/bug109.go b/test/fixedbugs/bug109.go index c679771f2..766657723 100644 --- a/test/fixedbugs/bug109.go +++ b/test/fixedbugs/bug109.go @@ -5,10 +5,11 @@ // license that can be found in the LICENSE file. package main -func f(a float) float { - e := 1.0; - e = e * a; - return e; + +func f(a float64) float64 { + e := 1.0 + e = e * a + return e } /* diff --git a/test/fixedbugs/bug167.go b/test/fixedbugs/bug167.go index 729299b66..33eb3cb1a 100644 --- a/test/fixedbugs/bug167.go +++ b/test/fixedbugs/bug167.go @@ -7,20 +7,24 @@ package main func f1() { - type T struct { x int } + type T struct { + x int + } } func f2() { - type T struct { x float } + type T struct { + x float64 + } } func main() { - f1(); - f2(); + f1() + f2() } /* 1606416576: conflicting definitions for main.T·bug167 bug167.6: type main.T·bug167 struct { x int } -bug167.6: type main.T·bug167 struct { x float } +bug167.6: type main.T·bug167 struct { x float64 } */ diff --git a/test/fixedbugs/bug193.go b/test/fixedbugs/bug193.go index f6b03e13d..5ef02b1c1 100644 --- a/test/fixedbugs/bug193.go +++ b/test/fixedbugs/bug193.go @@ -7,10 +7,10 @@ package main func main() { - s := uint(10); - ss := 1<<s; - y1 := float(ss); - y2 := float(1<<s); // ERROR "shift" - y3 := string(1<<s); // ERROR "shift" - _, _, _, _, _ = s, ss, y1, y2, y3; + s := uint(10) + ss := 1 << s + y1 := float64(ss) + y2 := float64(1 << s) // ERROR "shift" + y3 := string(1 << s) // ERROR "shift" + _, _, _, _, _ = s, ss, y1, y2, y3 } diff --git a/test/fixedbugs/bug196.go b/test/fixedbugs/bug196.go index ea8ab0dc1..8cb9c9990 100644 --- a/test/fixedbugs/bug196.go +++ b/test/fixedbugs/bug196.go @@ -13,11 +13,12 @@ var i int func multi() (int, int) { return 1, 2 } func xxx() { - var c chan int - x, ok := <-c + //TODO(rsc): uncomment when this syntax is valid for receive+check closed + // var c chan int + // x, ok := <-c var m map[int]int - x, ok = m[1] + x, ok := m[1] var i interface{} var xx int diff --git a/test/fixedbugs/bug220.go b/test/fixedbugs/bug220.go index 3f8aaa4ec..ff027ddc2 100644 --- a/test/fixedbugs/bug220.go +++ b/test/fixedbugs/bug220.go @@ -7,8 +7,8 @@ package main func main() { - m := make(map[int]map[uint]float); - - m[0] = make(map[uint]float), false; // 6g used to reject this - m[1] = nil; + m := make(map[int]map[uint]float64) + + m[0] = make(map[uint]float64), false // 6g used to reject this + m[1] = nil } diff --git a/test/fixedbugs/bug230.go b/test/fixedbugs/bug230.go index 81b256e31..c7ad1a366 100644 --- a/test/fixedbugs/bug230.go +++ b/test/fixedbugs/bug230.go @@ -8,14 +8,17 @@ package main type S string type I int -type F float +type F float64 func (S) m() {} func (I) m() {} func (F) m() {} func main() { - c := make(chan interface { m() }, 10) + c := make(chan interface { + m() + }, + 10) c <- I(0) c <- F(1) c <- S("hi") diff --git a/test/fixedbugs/bug234.go b/test/fixedbugs/bug234.go index b806ca64e..9affad043 100644 --- a/test/fixedbugs/bug234.go +++ b/test/fixedbugs/bug234.go @@ -7,16 +7,17 @@ package main func main() { - c := make(chan int, 1) - c <- 100 - x, ok := <-c - if x != 100 || !ok { - println("x=", x, " ok=", ok, " want 100, true") - panic("fail") - } - x, ok = <-c - if x != 0 || ok { - println("x=", x, " ok=", ok, " want 0, false") - panic("fail") - } + //TODO(rsc): uncomment when this syntax is valid for receive+check closed + // c := make(chan int, 1) + // c <- 100 + // x, ok := <-c + // if x != 100 || !ok { + // println("x=", x, " ok=", ok, " want 100, true") + // panic("fail") + // } + // x, ok = <-c + // if x != 0 || ok { + // println("x=", x, " ok=", ok, " want 0, false") + // panic("fail") + // } } diff --git a/test/fixedbugs/bug238.go b/test/fixedbugs/bug238.go index 8b7c7ac38..7e8660d37 100644 --- a/test/fixedbugs/bug238.go +++ b/test/fixedbugs/bug238.go @@ -17,6 +17,6 @@ const f struct{} = 6 // ERROR "convert|wrong|invalid" const g interface{} = 7 // ERROR "constant|wrong|invalid" const h bool = false const i int = 2 -const j float = 5 +const j float64 = 5 func main() { println(a, b, c, d, e, f, g) } diff --git a/test/fixedbugs/bug242.go b/test/fixedbugs/bug242.go index 5c21eaaf0..ad1cef8df 100644 --- a/test/fixedbugs/bug242.go +++ b/test/fixedbugs/bug242.go @@ -101,10 +101,13 @@ func main() { c := make(chan byte, 1) c <- 'C' + //TODO(rsc): uncomment when this syntax is valid for receive+check closed // 15 16 - *f(), p1 = <-e1(c, 16) + // *f(), p1 = <-e1(c, 16) + *f(), p1 = <-e1(c, 16), true // delete uncommenting above // 17 18 - *f(), p2 = <-e1(c, 18) + // *f(), p2 = <-e1(c, 18) + *f(), p2, _ = 0, false, e1(c, 18) // delete when uncommenting above a[17] += '0' if !p1 || p2 { println("bad chan check", i, p1, p2) diff --git a/test/fixedbugs/bug248.dir/bug2.go b/test/fixedbugs/bug248.dir/bug2.go index 68c0ce0bc..4ea187a4b 100644 --- a/test/fixedbugs/bug248.dir/bug2.go +++ b/test/fixedbugs/bug248.dir/bug2.go @@ -23,7 +23,7 @@ type t0 int func (t0) M(p0.T) {} -type t1 float +type t1 float64 func (t1) M(p1.T) {} diff --git a/test/fixedbugs/bug248.dir/bug3.go b/test/fixedbugs/bug248.dir/bug3.go index c96bf1676..e5a244955 100644 --- a/test/fixedbugs/bug248.dir/bug3.go +++ b/test/fixedbugs/bug248.dir/bug3.go @@ -26,7 +26,7 @@ type t0 int func (t0) M(p0.T) {} // t1 satisfies I1 and p1.I -type t1 float +type t1 float64 func (t1) M(p1.T) {} diff --git a/test/fixedbugs/bug299.go b/test/fixedbugs/bug299.go index 4d7314432..1c7adb5f5 100644 --- a/test/fixedbugs/bug299.go +++ b/test/fixedbugs/bug299.go @@ -11,9 +11,9 @@ type T struct { x int y (int) int - *float + *float64 // not legal according to spec - (complex) // ERROR "non-declaration|expected|parenthesize" + (complex128) // ERROR "non-declaration|expected|parenthesize" (*string) // ERROR "non-declaration|expected|parenthesize" *(bool) // ERROR "non-declaration|expected|parenthesize" } diff --git a/test/fixedbugs/bug307.go b/test/fixedbugs/bug307.go index a1a30dfb7..1b42c09ab 100644 --- a/test/fixedbugs/bug307.go +++ b/test/fixedbugs/bug307.go @@ -5,11 +5,11 @@ // license that can be found in the LICENSE file. // Valid program, gccgo reported an error. -// bug307.go:14:6: error: cmplx arguments must have identical types +// bug307.go:14:6: error: complex arguments must have identical types package main func main() { var f float64 - _ = cmplx(1 / f, 0) + _ = complex(1/f, 0) } diff --git a/test/fixedbugs/bug315.go b/test/fixedbugs/bug315.go index 198bae77a..c59ef29e6 100644 --- a/test/fixedbugs/bug315.go +++ b/test/fixedbugs/bug315.go @@ -9,7 +9,7 @@ package main func main() { - a := cmplx(2, 2) + a := complex(2, 2) a /= 2 } diff --git a/test/fixedbugs/bug316.go b/test/fixedbugs/bug316.go index bd4d99eb6..2146408a1 100644 --- a/test/fixedbugs/bug316.go +++ b/test/fixedbugs/bug316.go @@ -9,7 +9,7 @@ package main const ( - c = cmplx(1, 2) + c = complex(1, 2) r = real(c) // was: const initializer must be constant i = imag(c) // was: const initializer must be constant ) diff --git a/test/fixedbugs/bug318.go b/test/fixedbugs/bug318.go new file mode 100644 index 000000000..9c46a0426 --- /dev/null +++ b/test/fixedbugs/bug318.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. + +// Issue 1411. + +package main + +const ui uint = 0 +const i int = ui // ERROR "type" diff --git a/test/fixedbugs/bug319.go b/test/fixedbugs/bug319.go new file mode 100644 index 000000000..f60eee4fb --- /dev/null +++ b/test/fixedbugs/bug319.go @@ -0,0 +1,22 @@ +// $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 + +import "unsafe" + +func main() { + var x int + + a := uint64(uintptr(unsafe.Pointer(&x))) + b := uint32(uintptr(unsafe.Pointer(&x))) + c := uint16(uintptr(unsafe.Pointer(&x))) + d := int64(uintptr(unsafe.Pointer(&x))) + e := int32(uintptr(unsafe.Pointer(&x))) + f := int16(uintptr(unsafe.Pointer(&x))) + + _, _, _, _, _, _ = a, b, c, d, e, f +} |