| // 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. |
| // Verify that erroneous type switches are caught be the compiler. |
| // Issue 2700, among other things. |
| case string: // ERROR "impossible" |
| // Issue 2700: if the case type is an interface, nothing is impossible |
| switch _ := r.(type) { // ERROR "invalid variable name _|no new variables" |
| switch i.(type) { // ERROR "cannot type switch on non-interface value" |
| switch s.(type) { // ERROR "cannot type switch on non-interface value" |