interfaces.test
339 Bytes
// RUN: llgoi < %s | FileCheck %s
import "errors"
err := errors.New("foo")
err
// CHECK: foo
err.(interface{Foo()})
// CHECK: panic: interface conversion
_, ok := err.(interface{Foo()})
ok
// CHECK: false
err.(interface{Error() string})
// CHECK: foo
iface, ok := err.(interface{Error() string})
iface
// CHECK: foo
ok
// CHECK: true