From: Robert Griesemer Date: Fri, 29 May 2009 23:43:24 +0000 (-0700) Subject: Replacement for abandoned CL 29626: X-Git-Tag: weekly.2009-11-06~1506 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=705f9af38eb45d7f2281a95dec552571963c11af;p=gostls13.git Replacement for abandoned CL 29626: bug157 and bug158 R=rsc DELTA=59 (59 added, 0 deleted, 0 changed) OCL=29632 CL=29634 --- diff --git a/test/bugs/bug157.go b/test/bugs/bug157.go new file mode 100644 index 0000000000..207f6bcfdb --- /dev/null +++ b/test/bugs/bug157.go @@ -0,0 +1,32 @@ +// $G $D/$F.go || echo BUG: should compile + +// 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 f() {} + +func main() { + x := 0; + + // this compiles + switch x { + case 0: f(); + default: f(); + } + + // this doesn't but it should + // (semicolons are not needed at the end of a statement list) + switch x { + case 0: f() + default: f() + } +} + + +/* +bug155.go:20: syntax error near default +bug155.go:20: first switch statement must be a case +*/ diff --git a/test/bugs/bug158.go b/test/bugs/bug158.go new file mode 100644 index 0000000000..a40bf823a0 --- /dev/null +++ b/test/bugs/bug158.go @@ -0,0 +1,26 @@ +// $G $D/$F.go || echo BUG: should compile + +// 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() { + x := 0; + + // this compiles + switch x { + case 0: + } + + // this doesn't but should + switch 0 { + case 0: + } +} + + +/* +bug156.go:14: fatal error: dowidth: unknown type: E-33 +*/ diff --git a/test/golden.out b/test/golden.out index b5dbddffe6..13c83aa80d 100644 --- a/test/golden.out +++ b/test/golden.out @@ -104,6 +104,15 @@ BUG should compile 5 7 BUG: should crash +=========== bugs/bug157.go +bugs/bug157.go:20: syntax error near default +bugs/bug157.go:20: first switch statement must be a case +BUG: should compile + +=========== bugs/bug158.go +bugs/bug158.go:14: fatal error: dowidth: unknown type: E-33 +BUG: should compile + =========== fixedbugs/bug016.go fixedbugs/bug016.go:7: constant -3 overflows uint