blob: f38efe68c6e62d3c4b945d2b6252afbbf5954788 [file] [log] [blame]
Tyler Bunnellf6a95252013-03-15 00:35:09 -04001// errorcheck
2
3// Copyright 2011 The Go Authors. All rights reserved.
4// Use of this source code is governed by a BSD-style
5// license that can be found in the LICENSE file.
6
7// Verify that erroneous switch statements are detected by the compiler.
8// Does not compile.
9
10package main
11
12type I interface {
13 M()
14}
15
16func bad() {
17
18 i5 := 5
19 switch i5 {
20 case 5:
21 fallthrough // ERROR "cannot fallthrough final case in switch"
22 }
23}
24
25func good() {
26 var i interface{}
27 var s string
28
29 switch i {
30 case s:
31 }
32
33 switch s {
34 case i:
35 }
36}