(t *testing.T)
| 1008 | } |
| 1009 | |
| 1010 | func TestFunctionDeclToExprDecl(t *testing.T) { |
| 1011 | tests := []struct { |
| 1012 | fn *FunctionDecl |
| 1013 | exDecl *exprpb.Decl |
| 1014 | }{ |
| 1015 | { |
| 1016 | fn: testFunction(t, "equals", |
| 1017 | Overload("equals_value_value", |
| 1018 | []*types.Type{types.NewTypeParamType("T"), types.NewTypeParamType("T")}, types.BoolType)), |
| 1019 | exDecl: &exprpb.Decl{ |
| 1020 | Name: "equals", |
| 1021 | DeclKind: &exprpb.Decl_Function{ |
| 1022 | Function: &exprpb.Decl_FunctionDecl{ |
| 1023 | Overloads: []*exprpb.Decl_FunctionDecl_Overload{ |
| 1024 | { |
| 1025 | OverloadId: "equals_value_value", |
| 1026 | Params: []*exprpb.Type{ |
| 1027 | chkdecls.NewTypeParamType("T"), |
| 1028 | chkdecls.NewTypeParamType("T"), |
| 1029 | }, |
| 1030 | TypeParams: []string{"T"}, |
| 1031 | ResultType: chkdecls.Bool, |
| 1032 | }, |
| 1033 | }, |
| 1034 | }, |
| 1035 | }, |
| 1036 | }, |
| 1037 | }, |
| 1038 | { |
| 1039 | fn: testFunction(t, "equals", |
| 1040 | MemberOverload("value_equals_value", |
| 1041 | []*types.Type{types.NewTypeParamType("T"), types.NewTypeParamType("T")}, types.BoolType)), |
| 1042 | exDecl: &exprpb.Decl{ |
| 1043 | Name: "equals", |
| 1044 | DeclKind: &exprpb.Decl_Function{ |
| 1045 | Function: &exprpb.Decl_FunctionDecl{ |
| 1046 | Overloads: []*exprpb.Decl_FunctionDecl_Overload{ |
| 1047 | { |
| 1048 | OverloadId: "value_equals_value", |
| 1049 | IsInstanceFunction: true, |
| 1050 | Params: []*exprpb.Type{ |
| 1051 | chkdecls.NewTypeParamType("T"), |
| 1052 | chkdecls.NewTypeParamType("T"), |
| 1053 | }, |
| 1054 | TypeParams: []string{"T"}, |
| 1055 | ResultType: chkdecls.Bool, |
| 1056 | }, |
| 1057 | }, |
| 1058 | }, |
| 1059 | }, |
| 1060 | }, |
| 1061 | }, |
| 1062 | { |
| 1063 | fn: testFunction(t, "equals", |
| 1064 | Overload("equals_int_uint", |
| 1065 | []*types.Type{types.IntType, types.UintType}, types.BoolType)), |
| 1066 | exDecl: &exprpb.Decl{ |
| 1067 | Name: "equals", |
nothing calls this directly
no test coverage detected