| // Copyright 2016 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. |
| // Check the compiler's switch handling that happens |
| // This must be separate from other checks, |
| // because errors during typechecking |
| // prevent other errors from being discovered. |
| // Verify that type switch statements with impossible cases are detected by the compiler. |
| case int: // ERROR "impossible type switch case: e \(type error\) cannot have dynamic type int \(missing Error method\)|impossible type assertion" |
| // Verify that the compiler rejects multiple default cases. |
| default: // ERROR "multiple defaults( in switch)?" |
| default: // ERROR "multiple defaults( in switch)?" |
| case X: // ERROR "impossible type switch case: i \(type I\) cannot have dynamic type X \(Foo method has pointer receiver\)|impossible type assertion" |