llvm-project/llgo/test/llgoi/interfaces.test

20 lines
478 B
Plaintext
Raw Normal View History

// RUN: llgoi < %s | FileCheck %s
import "errors"
err := errors.New("foo")
// CHECK: err error {{.*}} = foo
err.(interface{Foo()})
// CHECK: panic: interface conversion
_, _ := err.(interface{Foo()})
// CHECK: #0 interface{Foo()} (<nil>) = <nil>
// CHECK: #1 bool = false
err.(interface{Error() string})
// CHECK: #0 interface{Error() string} {{.*}} = foo
_, _ := err.(interface{Error() string})
// CHECK: #0 interface{Error() string} {{.*}} = foo
// CHECK: #1 bool = true