1// Copyright 2013 The Go Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style 3// license that can be found in the LICENSE file. 4 5package a 6 7type I interface { 8 F() 9} 10 11type foo1 []byte 12type foo2 []rune 13type foo3 []uint8 14type foo4 []int32 15type foo5 string 16type foo6 string 17type foo7 string 18type foo8 string 19type foo9 string 20 21func (f foo1) F() { return } 22func (f foo2) F() { return } 23func (f foo3) F() { return } 24func (f foo4) F() { return } 25func (f foo5) F() { return } 26func (f foo6) F() { return } 27func (f foo7) F() { return } 28func (f foo8) F() { return } 29func (f foo9) F() { return } 30 31func Test1(s string) I { return foo1(s) } 32func Test2(s string) I { return foo2(s) } 33func Test3(s string) I { return foo3(s) } 34func Test4(s string) I { return foo4(s) } 35func Test5(s []byte) I { return foo5(s) } 36func Test6(s []rune) I { return foo6(s) } 37func Test7(s []uint8) I { return foo7(s) } 38func Test8(s []int32) I { return foo8(s) } 39func Test9(s int) I { return foo9(s) } 40 41type bar map[int]int 42 43func (b bar) F() { return } 44 45func TestBar() I { return bar{1: 2} } 46 47type baz int 48 49func IsBaz(x interface{}) bool { _, ok := x.(baz); return ok } 50 51type baz2 int 52 53func IsBaz2(x interface{}) bool { 54 switch x.(type) { 55 case baz2: 56 return true 57 default: 58 return false 59 } 60} 61