From 7b15ed9ef455b6b66c6b376898a88aef5d6a9970 Mon Sep 17 00:00:00 2001 From: Ondřej Surý Date: Tue, 26 Apr 2011 09:55:32 +0200 Subject: Imported Upstream version 2011.04.13 --- src/pkg/try/try.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/pkg/try/try.go') diff --git a/src/pkg/try/try.go b/src/pkg/try/try.go index af31d0d2c..1171c80c2 100644 --- a/src/pkg/try/try.go +++ b/src/pkg/try/try.go @@ -90,13 +90,13 @@ func tryMethod(pkg, firstArg string, method reflect.Method, args []interface{}) // tryFunction sees if fn satisfies the arguments. func tryFunction(pkg, name string, fn interface{}, args []interface{}) { defer func() { recover() }() - rfn := reflect.NewValue(fn).(*reflect.FuncValue) - typ := rfn.Type().(*reflect.FuncType) + rfn := reflect.NewValue(fn) + typ := rfn.Type() tryOneFunction(pkg, "", name, typ, rfn, args) } // tryOneFunction is the common code for tryMethod and tryFunction. -func tryOneFunction(pkg, firstArg, name string, typ *reflect.FuncType, rfn *reflect.FuncValue, args []interface{}) { +func tryOneFunction(pkg, firstArg, name string, typ reflect.Type, rfn reflect.Value, args []interface{}) { // Any results? if typ.NumOut() == 0 { return // Nothing to do. @@ -166,7 +166,7 @@ func compatible(arg interface{}, typ reflect.Type) bool { } if arg == nil { // nil is OK if the type is an interface. - if _, ok := typ.(*reflect.InterfaceType); ok { + if typ.Kind() == reflect.Interface { return true } } -- cgit v1.2.3