diff --git a/internal/ctrlflow/trash.go b/internal/ctrlflow/trash.go index 9f40d8f..39447b6 100644 --- a/internal/ctrlflow/trash.go +++ b/internal/ctrlflow/trash.go @@ -174,7 +174,7 @@ func isGenericType(p types.Type) bool { // isSupportedSig checks that the function is not generic and all parameters can be generated using valueGenerators func isSupportedSig(m *types.Func) bool { - sig := m.Type().(*types.Signature) + sig := m.Signature() if isGenericType(sig) { return false } @@ -430,7 +430,7 @@ func (t *trashGenerator) generateCall(vars map[string]*definedVar) ast.Stmt { var args []ast.Expr - targetSig := targetFunc.Type().(*types.Signature) + targetSig := targetFunc.Signature() params := targetSig.Params() for i := 0; i < params.Len(); i++ { param := params.At(i) diff --git a/internal/ssa2ast/func_test.go b/internal/ssa2ast/func_test.go index 4d96b24..be5521e 100644 --- a/internal/ssa2ast/func_test.go +++ b/internal/ssa2ast/func_test.go @@ -59,7 +59,7 @@ func TestConvertSignature(t *testing.T) { funcDecl.Body = nil funcObj := info.Defs[funcDecl.Name].(*types.Func) - funcDeclConverted, err := conv.convertSignatureToFuncDecl(funcObj.Name(), funcObj.Type().(*types.Signature)) + funcDeclConverted, err := conv.convertSignatureToFuncDecl(funcObj.Name(), funcObj.Signature()) qt.Assert(t, qt.IsNil(err)) qt.Assert(t, qt.CmpEquals(funcDeclConverted, funcDecl, astCmpOpt)) } diff --git a/main.go b/main.go index 25be35b..2f50d56 100644 --- a/main.go +++ b/main.go @@ -1966,7 +1966,7 @@ func (tf *transformer) transformGoFile(file *ast.File) *ast.File { return true } - sign := obj.Type().(*types.Signature) + sign := obj.Signature() if sign.Recv() == nil { debugName = "func" } else { diff --git a/reflect.go b/reflect.go index fdd4bce..f2a49f1 100644 --- a/reflect.go +++ b/reflect.go @@ -145,7 +145,7 @@ func (ri *reflectInspector) checkInterfaceMethod(m *types.Func) { maps.Copy(reflectParams, ri.result.ReflectAPIs[m.FullName()]) - sig := m.Type().(*types.Signature) + sig := m.Signature() if m.Exported() { ri.checkMethodSignature(reflectParams, sig) }