2015-01-15 12:13:29 +08:00
|
|
|
// RUN: llgoi < %s | FileCheck %s
|
|
|
|
|
|
|
|
import "errors"
|
|
|
|
err := errors.New("foo")
|
2016-04-25 09:18:20 +08:00
|
|
|
err
|
|
|
|
// CHECK: foo
|
2015-01-15 12:13:29 +08:00
|
|
|
|
|
|
|
err.(interface{Foo()})
|
|
|
|
// CHECK: panic: interface conversion
|
|
|
|
|
2016-04-25 09:18:20 +08:00
|
|
|
_, ok := err.(interface{Foo()})
|
|
|
|
ok
|
|
|
|
// CHECK: false
|
2015-01-15 12:13:29 +08:00
|
|
|
|
|
|
|
err.(interface{Error() string})
|
2016-04-25 09:18:20 +08:00
|
|
|
// CHECK: foo
|
2015-01-15 12:13:29 +08:00
|
|
|
|
2016-04-25 09:18:20 +08:00
|
|
|
iface, ok := err.(interface{Error() string})
|
|
|
|
iface
|
|
|
|
// CHECK: foo
|
|
|
|
ok
|
|
|
|
// CHECK: true
|