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.
7 // Verify that erroneous switch statements are detected by the compiler.
21 case s
: // ERROR "mismatched types string and I|incompatible types"
25 case i
: // ERROR "mismatched types I and string|incompatible types"
31 case m1
: // ERROR "can only compare map m to nil|map can only be compared to nil"
38 case a1
: // ERROR "can only compare slice a to nil|slice can only be compared to nil"
45 case f1
: // ERROR "can only compare func f to nil|func can only be compared to nil"
50 switch ar
{ // ERROR "cannot switch on"
55 var st
, st1
struct{ f
func() }
56 switch st
{ // ERROR "cannot switch on"