mirror of
https://github.com/golang/go
synced 2024-11-13 19:10:22 -07:00
aad18b849b
- fix/check location of popdcl calls where questioned - remove unnecessary handling of ... (LDDD) in ntype (couldn't be reached) - inlined and fnret_type and simplified fnres as a consequence - leave handling of ... (LDDD) in arg_list alone (remove TODO) - verify that parser requires a ';' after last statement in a case/default (added test case) Fixes #13243. Change-Id: Iad94b498591a5e85f4cb15bbc01e8e101415560d Reviewed-on: https://go-review.googlesource.com/17155 Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Chris Manghane <cmang@golang.org>
40 lines
754 B
Go
40 lines
754 B
Go
// errorcheck
|
|
|
|
// Copyright 2015 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.
|
|
|
|
// Verify that erroneous switch statements are detected by the compiler.
|
|
// Does not compile.
|
|
|
|
package main
|
|
|
|
func f() {
|
|
switch {
|
|
case 0; // ERROR "expecting := or = or : or comma"
|
|
}
|
|
|
|
switch {
|
|
case 0; // ERROR "expecting := or = or : or comma"
|
|
default:
|
|
}
|
|
|
|
switch {
|
|
case 0: case 0: default:
|
|
}
|
|
|
|
switch {
|
|
case 0: f(); case 0:
|
|
case 0: f() case 0: // ERROR "unexpected case at end of statement"
|
|
}
|
|
|
|
switch {
|
|
case 0: f(); default:
|
|
case 0: f() default: // ERROR "unexpected default at end of statement"
|
|
}
|
|
|
|
switch {
|
|
if x: // ERROR "expecting case or default or }"
|
|
}
|
|
}
|