github.com/neugram/ng@v0.0.0-20180309130942-d472ff93d872/eval/testdata/typeswitch3.ng (about) 1 import ( 2 "bytes" 3 "io" 4 ) 5 6 func isBuffer(r io.Reader) bool { 7 switch r.(type) { 8 case *bytes.Buffer: 9 return true 10 } 11 return false 12 } 13 14 b1 := isBuffer(new(bytes.Reader)) 15 if b1 { 16 panic("ERROR-1") 17 } 18 19 b2 := isBuffer(new(bytes.Buffer)) 20 if !b2 { 21 panic("ERROR-2") 22 } 23 24 print("OK")