1// run 2 3// Copyright 2009 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 9import "os" 10 11type S struct { i int } 12func (p *S) Get() int { return p.i } 13 14type Empty interface { 15} 16 17type Getter interface { 18 Get() int; 19} 20 21func f1(p Empty) { 22 switch x := p.(type) { 23 default: println("failed to match interface", x); os.Exit(1); 24 case Getter: break; 25 } 26 27} 28 29func main() { 30 var s S; 31 f1(&s); 32} 33