1// errorcheck 2 3// Copyright 2018 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 7package main 8 9type Stringer interface { 10 String() string 11} 12 13func main() { 14 var e interface{} 15 switch e := e.(type) { 16 case G: // ERROR "undefined: G|undefined type .*G" 17 e.M() // ok: this error should be ignored because the case failed its typecheck 18 case E: // ERROR "undefined: E|undefined type .*E" 19 e.D() // ok: this error should be ignored because the case failed its typecheck 20 case Stringer: 21 // ok: this error should not be ignored to prove that passing legs aren't left out 22 _ = e.(T) // ERROR "undefined: T|undefined type .*T" 23 } 24} 25